-
Notifications
You must be signed in to change notification settings - Fork 103
Options periodicY function #3175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
Provides a variable "periodicY" that is 1 in the core and 0 outside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
src/field/field_factory.cxx
Outdated
| addGenerator("where", std::make_shared<FieldWhere>(nullptr, nullptr, nullptr)); | ||
|
|
||
| // Periodic in the Y direction? | ||
| addGenerator("periodicY", std::make_shared<FieldPeriodicY>(nullptr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::make_shared" is directly included [misc-include-cleaner]
^
src/field/fieldgenerators.hxx
Outdated
| FieldPeriodicY(Mesh* mesh) : mesh(mesh) { | ||
| // Note: Assumes symmetricGlobalX | ||
| local_inner_boundary = | ||
| 0.5 * (mesh->GlobalX(mesh->xstart - 1) + mesh->GlobalX(mesh->xstart)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'local_inner_boundary' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
src/field/fieldgenerators.hxx:357:
- FieldPeriodicY(Mesh* mesh) : mesh(mesh) {
+ FieldPeriodicY(Mesh* mesh) : mesh(mesh), local_inner_boundary(0.5 * (mesh->GlobalX(mesh->xstart - 1) + mesh->GlobalX(mesh->xstart))) {| 0.5 * (mesh->GlobalX(mesh->xstart - 1) + mesh->GlobalX(mesh->xstart)); | |
src/field/fieldgenerators.hxx
Outdated
| local_inner_boundary = | ||
| 0.5 * (mesh->GlobalX(mesh->xstart - 1) + mesh->GlobalX(mesh->xstart)); | ||
| local_outer_boundary = | ||
| 0.5 * (mesh->GlobalX(mesh->xend + 1) + mesh->GlobalX(mesh->xend)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'local_outer_boundary' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
src/field/fieldgenerators.hxx:357:
- FieldPeriodicY(Mesh* mesh) : mesh(mesh) {
+ FieldPeriodicY(Mesh* mesh) : mesh(mesh), local_outer_boundary(0.5 * (mesh->GlobalX(mesh->xend + 1) + mesh->GlobalX(mesh->xend))) {| 0.5 * (mesh->GlobalX(mesh->xend + 1) + mesh->GlobalX(mesh->xend)); | |
src/field/fieldgenerators.hxx
Outdated
| return std::make_shared<FieldPeriodicY>(ctx.getMesh()); | ||
| } | ||
| BoutReal generate(const bout::generator::Context& ctx) override { | ||
| int local_index = mesh->xstart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'local_index' of type 'int' can be declared 'const' [misc-const-correctness]
| int local_index = mesh->xstart | |
| int const local_index = mesh->xstart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
| public: | ||
| FieldPeriodicY() = default; | ||
| FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> UNUSED(args)) override { | ||
| return std::make_shared<FieldPeriodicY>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::make_shared" is directly included [misc-include-cleaner]
return std::make_shared<FieldPeriodicY>();
^
Provides a variable "periodicY" that is 1 in the core and 0 outside.
This at least partly addresses #3171 by allowing input functions that distinguish core and PF regions.
Opinions on the name? @mikekryjak 's suggestion of
is_periodicis good;periodicYis the name of the Mesh function that's used internally. Checks for periodicity in X or Z might also make sense in some cases.Tests incoming...