-
Notifications
You must be signed in to change notification settings - Fork 108
Legacy boundary conditions #3420
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?
Changes from all commits
06d7ff5
a9a5f41
a960447
5bef26e
4687df8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,30 @@ private: | |
| BoutReal val; | ||
| }; | ||
|
|
||
| /// Dirichlet (set to zero) boundary condition | ||
| class BoundaryDirichlet_O1 : public BoundaryOp { | ||
| public: | ||
| BoundaryDirichlet_O1() : gen(nullptr) {} | ||
| BoundaryDirichlet_O1(BoundaryRegion* region, std::shared_ptr<FieldGenerator> g) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "std::shared_ptr" is directly included [misc-include-cleaner] include/bout/boundary_standard.hxx:10: - #include <utility>
+ #include <memory>
+ #include <utility> |
||
| : BoundaryOp(region), gen(std::move(g)) {} | ||
|
|
||
| using BoundaryOp::clone; | ||
| BoundaryOp* clone(BoundaryRegion* region, const std::list<std::string>& args) override; | ||
|
|
||
| using BoundaryOp::apply; | ||
| void apply(Field2D& f) override; | ||
| void apply(Field2D& f, BoutReal t) override; | ||
| void apply(Field3D& f) override; | ||
| void apply(Field3D& f, BoutReal t) override; | ||
|
|
||
| using BoundaryOp::apply_ddt; | ||
| void apply_ddt(Field2D& f) override; | ||
| void apply_ddt(Field3D& f) override; | ||
|
|
||
| private: | ||
| std::shared_ptr<FieldGenerator> gen; // Generator | ||
| }; | ||
|
|
||
| /// Dirichlet (set to zero) boundary condition | ||
| class BoundaryDirichlet : public BoundaryOp { | ||
| public: | ||
|
|
@@ -163,6 +187,30 @@ public: | |
| void apply(Field3D& f) override; | ||
| }; | ||
|
|
||
| /// Neumann (zero-gradient) boundary condition, using 1st order on boundary | ||
| class BoundaryNeumann_O1 : public BoundaryOp { | ||
| public: | ||
| BoundaryNeumann_O1() : gen(nullptr) {} | ||
| BoundaryNeumann_O1(BoundaryRegion* region, std::shared_ptr<FieldGenerator> g) | ||
| : BoundaryOp(region), gen(std::move(g)) {} | ||
|
|
||
| using BoundaryOp::clone; | ||
| BoundaryOp* clone(BoundaryRegion* region, const std::list<std::string>& args) override; | ||
|
|
||
| using BoundaryOp::apply; | ||
| void apply(Field2D& f) override; | ||
| void apply(Field2D& f, BoutReal t) override; | ||
| void apply(Field3D& f) override; | ||
| void apply(Field3D& f, BoutReal t) override; | ||
|
|
||
| using BoundaryOp::apply_ddt; | ||
| void apply_ddt(Field2D& f) override; | ||
| void apply_ddt(Field3D& f) override; | ||
|
|
||
| private: | ||
| std::shared_ptr<FieldGenerator> gen; | ||
| }; | ||
|
|
||
| /// Neumann boundary condition set half way between guard cell and grid cell at 2nd order accuracy | ||
| class BoundaryNeumann_2ndOrder : public BoundaryOp { | ||
| public: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,15 +21,18 @@ using std::string; | |
| BoundaryFactory* BoundaryFactory::instance = nullptr; | ||
|
|
||
| BoundaryFactory::BoundaryFactory() { | ||
| add(new BoundaryDirichlet(), "dirichlet"); | ||
| add(new BoundaryDirichlet(), "dirichlet_o2"); // Synonym for "dirichlet" | ||
| add(new BoundaryDirichlet(), "dirichlet"); // Default | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: initializing non-owner argument of type 'BoundaryOp *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory] add(new BoundaryDirichlet(), "dirichlet"); // Default
^ |
||
| add(new BoundaryDirichlet_O1(), "dirichlet_o1"); // Old implementation in v3 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryDirichlet_O1(), "dirichlet_o1"); // Old implementation in v3
^Additional contextsrc/mesh/boundary_factory.cxx:73: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:73: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:75: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:22: Memory is allocated add(new BoundaryDirichlet(), "dirichlet"); // Default
^src/mesh/boundary_factory.cxx:23: Potential memory leak add(new BoundaryDirichlet_O1(), "dirichlet_o1"); // Old implementation in v3
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: initializing non-owner argument of type 'BoundaryOp *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory] add(new BoundaryDirichlet_O1(), "dirichlet_o1"); // Old implementation in v3
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryDirichlet_O1(), "dirichlet_o1"); // Old implementation in v3
^Additional contextsrc/mesh/boundary_factory.cxx:74: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:74: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:76: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:23: Memory is allocated add(new BoundaryDirichlet(), "dirichlet"); // Default
^src/mesh/boundary_factory.cxx:24: Potential memory leak add(new BoundaryDirichlet_O1(), "dirichlet_o1"); // Old implementation in v3
^ |
||
| add(new BoundaryDirichlet(), "dirichlet_o2"); // Synonym for "dirichlet" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryDirichlet(), "dirichlet_o2"); // Synonym for "dirichlet"
^Additional contextsrc/mesh/boundary_factory.cxx:74: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:74: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:76: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:24: Memory is allocated add(new BoundaryDirichlet_O1(), "dirichlet_o1"); // Old implementation in v3
^src/mesh/boundary_factory.cxx:25: Potential memory leak add(new BoundaryDirichlet(), "dirichlet_o2"); // Synonym for "dirichlet"
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: initializing non-owner argument of type 'BoundaryOp *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory] add(new BoundaryDirichlet(), "dirichlet_o2"); // Synonym for "dirichlet"
^ |
||
| add(new BoundaryDirichlet_O3(), "dirichlet_o3"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryDirichlet_O3(), "dirichlet_o3");
^Additional contextsrc/mesh/boundary_factory.cxx:74: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:74: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:76: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:25: Memory is allocated add(new BoundaryDirichlet(), "dirichlet_o2"); // Synonym for "dirichlet"
^src/mesh/boundary_factory.cxx:26: Potential memory leak add(new BoundaryDirichlet_O3(), "dirichlet_o3");
^ |
||
| add(new BoundaryDirichlet_O4(), "dirichlet_o4"); | ||
| add(new BoundaryDirichlet_4thOrder(), "dirichlet_4thorder"); | ||
| add(new BoundaryNeumann(), "neumann"); | ||
| add(new BoundaryNeumann(), "neumann_O2"); // Synonym for "neumann" | ||
|
|
||
| add(new BoundaryNeumann(), "neumann"); // Default | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann(), "neumann"); // Default
^Additional contextsrc/mesh/boundary_factory.cxx:73: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:73: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:75: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:27: Memory is allocated add(new BoundaryDirichlet_4thOrder(), "dirichlet_4thorder");
^src/mesh/boundary_factory.cxx:29: Potential memory leak add(new BoundaryNeumann(), "neumann"); // Default
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: initializing non-owner argument of type 'BoundaryOp *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory] add(new BoundaryNeumann(), "neumann"); // Default
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann(), "neumann"); // Default
^Additional contextsrc/mesh/boundary_factory.cxx:74: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:74: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:76: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:28: Memory is allocated add(new BoundaryDirichlet_4thOrder(), "dirichlet_4thorder");
^src/mesh/boundary_factory.cxx:30: Potential memory leak add(new BoundaryNeumann(), "neumann"); // Default
^ |
||
| add(new BoundaryNeumann_O1(), "neumann_o1"); // Old implementation in v3 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann_O1(), "neumann_o1"); // Old implementation in v3
^Additional contextsrc/mesh/boundary_factory.cxx:73: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:73: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:75: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:29: Memory is allocated add(new BoundaryNeumann(), "neumann"); // Default
^src/mesh/boundary_factory.cxx:30: Potential memory leak add(new BoundaryNeumann_O1(), "neumann_o1"); // Old implementation in v3
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: initializing non-owner argument of type 'BoundaryOp *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory] add(new BoundaryNeumann_O1(), "neumann_o1"); // Old implementation in v3
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann_O1(), "neumann_o1"); // Old implementation in v3
^Additional contextsrc/mesh/boundary_factory.cxx:74: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:74: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:76: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:30: Memory is allocated add(new BoundaryNeumann(), "neumann"); // Default
^src/mesh/boundary_factory.cxx:31: Potential memory leak add(new BoundaryNeumann_O1(), "neumann_o1"); // Old implementation in v3
^ |
||
| add(new BoundaryNeumann(), "neumann_o2"); // Synonym for "neumann" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann(), "neumann_o2"); // Synonym for "neumann"
^Additional contextsrc/mesh/boundary_factory.cxx:73: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:73: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:75: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:30: Memory is allocated add(new BoundaryNeumann_O1(), "neumann_o1"); // Old implementation in v3
^src/mesh/boundary_factory.cxx:31: Potential memory leak add(new BoundaryNeumann(), "neumann_o2"); // Synonym for "neumann"
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: initializing non-owner argument of type 'BoundaryOp *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory] add(new BoundaryNeumann(), "neumann_o2"); // Synonym for "neumann"
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann(), "neumann_o2"); // Synonym for "neumann"
^Additional contextsrc/mesh/boundary_factory.cxx:74: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:74: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:76: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:31: Memory is allocated add(new BoundaryNeumann_O1(), "neumann_o1"); // Old implementation in v3
^src/mesh/boundary_factory.cxx:32: Potential memory leak add(new BoundaryNeumann(), "neumann_o2"); // Synonym for "neumann"
^ |
||
| add(new BoundaryNeumann_4thOrder(), "neumann_4thorder"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann_4thOrder(), "neumann_4thorder");
^Additional contextsrc/mesh/boundary_factory.cxx:73: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:73: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:75: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:31: Memory is allocated add(new BoundaryNeumann(), "neumann_o2"); // Synonym for "neumann"
^src/mesh/boundary_factory.cxx:32: Potential memory leak add(new BoundaryNeumann_4thOrder(), "neumann_4thorder");
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann_4thOrder(), "neumann_4thorder");
^Additional contextsrc/mesh/boundary_factory.cxx:74: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:74: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:76: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:32: Memory is allocated add(new BoundaryNeumann(), "neumann_o2"); // Synonym for "neumann"
^src/mesh/boundary_factory.cxx:33: Potential memory leak add(new BoundaryNeumann_4thOrder(), "neumann_4thorder");
^ |
||
| add(new BoundaryNeumann_O4(), "neumann_O4"); | ||
| add(new BoundaryNeumann_O4(), "neumann_o4"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann_O4(), "neumann_o4");
^Additional contextsrc/mesh/boundary_factory.cxx:73: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:73: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:75: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:32: Memory is allocated add(new BoundaryNeumann_4thOrder(), "neumann_4thorder");
^src/mesh/boundary_factory.cxx:33: Potential memory leak add(new BoundaryNeumann_O4(), "neumann_o4");
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: initializing non-owner argument of type 'BoundaryOp *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory] add(new BoundaryNeumann_O4(), "neumann_o4");
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumann_O4(), "neumann_o4");
^Additional contextsrc/mesh/boundary_factory.cxx:74: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:74: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:76: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:33: Memory is allocated add(new BoundaryNeumann_4thOrder(), "neumann_4thorder");
^src/mesh/boundary_factory.cxx:34: Potential memory leak add(new BoundaryNeumann_O4(), "neumann_o4");
^ |
||
| add(new BoundaryNeumannPar(), "neumannpar"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumannPar(), "neumannpar");
^Additional contextsrc/mesh/boundary_factory.cxx:73: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:73: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:75: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:33: Memory is allocated add(new BoundaryNeumann_O4(), "neumann_o4");
^src/mesh/boundary_factory.cxx:34: Potential memory leak add(new BoundaryNeumannPar(), "neumannpar");
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks] add(new BoundaryNeumannPar(), "neumannpar");
^Additional contextsrc/mesh/boundary_factory.cxx:74: Assuming the condition is true if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:74: Taking true branch if (instance == nullptr) {
^src/mesh/boundary_factory.cxx:76: Calling default constructor for 'BoundaryFactory' instance = new BoundaryFactory();
^src/mesh/boundary_factory.cxx:34: Memory is allocated add(new BoundaryNeumann_O4(), "neumann_o4");
^src/mesh/boundary_factory.cxx:35: Potential memory leak add(new BoundaryNeumannPar(), "neumannpar");
^ |
||
| add(new BoundaryNeumann_NonOrthogonal(), "neumann_nonorthogonal"); | ||
| add(new BoundaryRobin(), "robin"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -117,6 +117,133 @@ void verifyNumPoints(BoundaryRegion*, int) {} | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /////////////////////////////////////////////////////////////// | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| BoundaryOp* BoundaryDirichlet_O1::clone(BoundaryRegion* region, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const std::list<std::string>& args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "std::list" is directly included [misc-include-cleaner] src/mesh/boundary_standard.cxx:12: + #include <list> |
||||||||||||||||||||||||||||||||||||||||||||||||||
| verifyNumPoints(region, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| std::shared_ptr<FieldGenerator> newgen; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "FieldGenerator" is directly included [misc-include-cleaner] src/mesh/boundary_standard.cxx:0: - #include <bout/boundary_standard.hxx>
+ #include "bout/sys/expressionparser.hxx"
+ #include <bout/boundary_standard.hxx>
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "std::shared_ptr" is directly included [misc-include-cleaner] src/mesh/boundary_standard.cxx:12: + #include <memory> |
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!args.empty()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // First argument should be an expression | ||||||||||||||||||||||||||||||||||||||||||||||||||
| newgen = FieldFactory::get()->parse(args.front()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return new BoundaryDirichlet_O1(region, newgen); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: returning a newly created resource of type 'BoundaryOp *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory] return new BoundaryDirichlet_O1(region, newgen);
^ |
||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryDirichlet_O1::apply(Field2D& f) { BoundaryDirichlet_O1::apply(f, 0.); } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "Field2D" is directly included [misc-include-cleaner] src/mesh/boundary_standard.cxx:0: - #include <bout/boundary_standard.hxx>
+ #include "bout/field2d.hxx"
+ #include <bout/boundary_standard.hxx> |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryDirichlet_O1::apply(Field2D& f, BoutReal t) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "BoutReal" is directly included [misc-include-cleaner] src/mesh/boundary_standard.cxx:0: - #include <bout/boundary_standard.hxx>
+ #include "bout/bout_types.hxx"
+ #include <bout/boundary_standard.hxx> |
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Set (at 1st order) the value at the grid cell to the guard cells. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Mesh* mesh = bndry->localmesh; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ASSERT1(mesh == f.getMesh()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "ASSERT1" is directly included [misc-include-cleaner] src/mesh/boundary_standard.cxx:0: - #include <bout/boundary_standard.hxx>
+ #include "bout/assert.hxx"
+ #include <bout/boundary_standard.hxx> |
||||||||||||||||||||||||||||||||||||||||||||||||||
| bndry->first(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Decide which generator to use | ||||||||||||||||||||||||||||||||||||||||||||||||||
| std::shared_ptr<FieldGenerator> fg = gen; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fg = f.getBndryGenerator(bndry->location); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| BoutReal val = 0.0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check for staggered grids | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| CELL_LOC loc = f.getLocation(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "CELL_LOC" is directly included [misc-include-cleaner] CELL_LOC loc = f.getLocation();
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'loc' of type 'CELL_LOC' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (mesh->StaggerGrids) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Staggered | ||||||||||||||||||||||||||||||||||||||||||||||||||
| throw BoutException("dirichlet_o1 BC is not implementated for staggered grids."); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Non-staggered, standard case | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (; !bndry->isDone(); bndry->next1d()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| val = fg->generate(Context(bndry, loc, t, mesh)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x, bndry->y) = val; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Need to set second guard cell, as may be used for interpolation or upwinding derivatives | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // This is not very efficient. Both boundary cells can be treated in one loop. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (int i = 1; i < bndry->width; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int xi = bndry->x + i * bndry->bx; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses] int xi = bndry->x + i * bndry->bx;
^this fix will not be applied because it overlaps with another fix
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'xi' of type 'int' can be declared 'const' [misc-const-correctness] int xi = bndry->x + i * bndry->bx;
^this fix will not be applied because it overlaps with another fix |
||||||||||||||||||||||||||||||||||||||||||||||||||
| int yi = bndry->y + i * bndry->by; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses] int yi = bndry->y + i * bndry->by;
^this fix will not be applied because it overlaps with another fix
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'yi' of type 'int' can be declared 'const' [misc-const-correctness] int yi = bndry->y + i * bndry->by;
^this fix will not be applied because it overlaps with another fix |
||||||||||||||||||||||||||||||||||||||||||||||||||
| f(xi, yi) = val; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: do not use 'else' after 'throw' [readability-else-after-return]
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryDirichlet_O1::apply(Field3D& f) { BoundaryDirichlet_O1::apply(f, 0.); } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "Field3D" is directly included [misc-include-cleaner] src/mesh/boundary_standard.cxx:0: - #include <bout/boundary_standard.hxx>
+ #include "bout/field3d.hxx"
+ #include <bout/boundary_standard.hxx> |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryDirichlet_O1::apply(Field3D& f, BoutReal t) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Set (at 1st order) the value at the grid cell to the guard cells. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Mesh* mesh = bndry->localmesh; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ASSERT1(mesh == f.getMesh()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| bndry->first(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Decide which generator to use | ||||||||||||||||||||||||||||||||||||||||||||||||||
| std::shared_ptr<FieldGenerator> fg = gen; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fg = f.getBndryGenerator(bndry->location); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| BoutReal val = 0.0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check for staggered grids | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| CELL_LOC loc = f.getLocation(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'loc' of type 'CELL_LOC' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (mesh->StaggerGrids) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Staggered. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| throw BoutException("dirichlet_o1 BC is not implementated for staggered grids."); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Standard (non-staggered) case | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (; !bndry->isDone(); bndry->next1d()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (int zk = mesh->zstart; zk <= mesh->zend; zk++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| val = fg->generate(Context(bndry, zk, loc, t, mesh)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x, bndry->y, zk) = val; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // This is not very efficient. Both boundary cells can be treated in one loop. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (int i = 1; i < bndry->width; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Set any other guard cells using the values on the cells | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int xi = bndry->x + i * bndry->bx; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses] int xi = bndry->x + i * bndry->bx;
^this fix will not be applied because it overlaps with another fix
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'xi' of type 'int' can be declared 'const' [misc-const-correctness] int xi = bndry->x + i * bndry->bx;
^this fix will not be applied because it overlaps with another fix |
||||||||||||||||||||||||||||||||||||||||||||||||||
| int yi = bndry->y + i * bndry->by; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses] int yi = bndry->y + i * bndry->by;
^this fix will not be applied because it overlaps with another fix
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'yi' of type 'int' can be declared 'const' [misc-const-correctness] int yi = bndry->y + i * bndry->by;
^this fix will not be applied because it overlaps with another fix |
||||||||||||||||||||||||||||||||||||||||||||||||||
| for (int zk = mesh->zstart; zk <= mesh->zend; zk++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| val = fg->generate(Context(bndry, zk, loc, t, mesh)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(xi, yi, zk) = val; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: do not use 'else' after 'throw' [readability-else-after-return]
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryDirichlet_O1::apply_ddt(Field2D& f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Field2D* dt = f.timeDeriv(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (bndry->first(); !bndry->isDone(); bndry->next()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| (*dt)(bndry->x, bndry->y) = 0.; // Set time derivative to zero | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryDirichlet_O1::apply_ddt(Field3D& f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Mesh* mesh = bndry->localmesh; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: pointee of variable 'mesh' of type 'Mesh *' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| ASSERT1(mesh == f.getMesh()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Field3D* dt = f.timeDeriv(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| for (bndry->first(); !bndry->isDone(); bndry->next()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (int z = mesh->zstart; z <= mesh->zend; z++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| (*dt)(bndry->x, bndry->y, z) = 0.; // Set time derivative to zero | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /////////////////////////////////////////////////////////////// | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| BoundaryOp* BoundaryDirichlet::clone(BoundaryRegion* region, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const std::list<std::string>& args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| verifyNumPoints(region, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1714,6 +1841,138 @@ void BoundaryNeumann_NonOrthogonal::apply(Field3D& f) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /////////////////////////////////////////////////////////////// | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| BoundaryOp* BoundaryNeumann_O1::clone(BoundaryRegion * region, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const std::list<std::string>& args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| verifyNumPoints(region, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| std::shared_ptr<FieldGenerator> newgen = nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!args.empty()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // First argument should be an expression | ||||||||||||||||||||||||||||||||||||||||||||||||||
| newgen = FieldFactory::get()->parse(args.front()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return new BoundaryNeumann_O1(region, newgen); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: returning a newly created resource of type 'BoundaryOp *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory] return new BoundaryNeumann_O1(region, newgen);
^ |
||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryNeumann_O1::apply(Field2D & f) { BoundaryNeumann_O1::apply(f, 0.); } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryNeumann_O1::apply(Field2D & f, BoutReal t) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Set (at 1st order) the gradient/value at the grid cell to the guard cells. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| #if not(BOUT_USE_METRIC_3D) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Mesh* mesh = bndry->localmesh; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ASSERT1(mesh == f.getMesh()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Coordinates* metric = f.getCoordinates(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| bndry->first(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Decide which generator to use | ||||||||||||||||||||||||||||||||||||||||||||||||||
| std::shared_ptr<FieldGenerator> fg = gen; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fg = f.getBndryGenerator(bndry->location); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| BoutReal val = 0.0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check for staggered grids | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| CELL_LOC loc = f.getLocation(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'loc' of type 'CELL_LOC' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (mesh->StaggerGrids) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Staggered. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| throw BoutException("neumann_o1 BC is not implementated for staggered grids."); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Non-staggered, standard case | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| for (bndry->first(); !bndry->isDone(); bndry->next1d()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| BoutReal delta = bndry->bx * metric->dx(bndry->x, bndry->y) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| + bndry->by * metric->dy(bndry->x, bndry->y); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| val = fg->generate(Context(bndry, loc, t, mesh)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x, bndry->y) = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x - bndry->bx, bndry->y - bndry->by) + delta * val; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (bndry->width == 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x + bndry->bx, bndry->y + bndry->by) = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x, bndry->y) + delta * val; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| #else | ||||||||||||||||||||||||||||||||||||||||||||||||||
| throw BoutException("Applying boundary condition 'neumann' to Field2D " | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "not compatible with 3D metrics in all cases."); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryNeumann_O1::apply(Field3D & f) { BoundaryNeumann_O1::apply(f, 0.); } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryNeumann_O1::apply(Field3D & f, BoutReal t) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Mesh* mesh = bndry->localmesh; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ASSERT1(mesh == f.getMesh()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Coordinates* metric = f.getCoordinates(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| bndry->first(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Decide which generator to use | ||||||||||||||||||||||||||||||||||||||||||||||||||
| std::shared_ptr<FieldGenerator> fg = gen; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fg = f.getBndryGenerator(bndry->location); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| BoutReal val = 0.0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check for staggered grids | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| CELL_LOC loc = f.getLocation(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (mesh->StaggerGrids) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Staggered. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| throw BoutException("neumann_o1 BC is not implementated for staggered grids."); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (; !bndry->isDone(); bndry->next1d()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| #if BOUT_USE_METRIC_3D | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (int zk = mesh->zstart; zk <= mesh->zend; zk++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| BoutReal delta = bndry->bx * metric->dx(bndry->x, bndry->y, zk) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| + bndry->by * metric->dy(bndry->x, bndry->y, zk); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| #else | ||||||||||||||||||||||||||||||||||||||||||||||||||
| BoutReal delta = bndry->bx * metric->dx(bndry->x, bndry->y) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| + bndry->by * metric->dy(bndry->x, bndry->y); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (int zk = mesh->zstart; zk <= mesh->zend; zk++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| val = fg->generate(Context(bndry, zk, loc, t, mesh)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x, bndry->y, zk) = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x - bndry->bx, bndry->y - bndry->by, zk) + delta * val; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (bndry->width == 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x + bndry->bx, bndry->y + bndry->by, zk) = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| f(bndry->x, bndry->y, zk) + delta * val; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryNeumann_O1::apply_ddt(Field2D & f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Field2D* dt = f.timeDeriv(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (bndry->first(); !bndry->isDone(); bndry->next()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| (*dt)(bndry->x, bndry->y) = 0.; // Set time derivative to zero | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void BoundaryNeumann_O1::apply_ddt(Field3D & f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Mesh* mesh = bndry->localmesh; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ASSERT1(mesh == f.getMesh()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Field3D* dt = f.timeDeriv(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (bndry->first(); !bndry->isDone(); bndry->next()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for (int z = mesh->zstart; z <= mesh->zend; z++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| (*dt)(bndry->x, bndry->y, z) = 0.; // Set time derivative to zero | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /////////////////////////////////////////////////////////////// | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| BoundaryOp* BoundaryNeumann::clone(BoundaryRegion * region, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const std::list<std::string>& args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| verifyNumPoints(region, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
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 "FieldGenerator" is directly included [misc-include-cleaner]
include/bout/boundary_standard.hxx:7: