Skip to content

Legacy boundary conditions - #3420

Open
malamast wants to merge 9 commits into
nextfrom
legacy-boundary-conditions
Open

Legacy boundary conditions#3420
malamast wants to merge 9 commits into
nextfrom
legacy-boundary-conditions

Conversation

@malamast

@malamast malamast commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Added a legacy implementation of 1st order Dirichlet and Neumann BCs.

  • This is what we used to do in Bout++ version 3.
  • The default BC remain unchanged.
  • Higher order extrapolation can be unstable sometimes when using C4 so I added back the 1st order BC.
  • You can use them in the input file by setting e.g. bndry_all = dirichlet_o1.
  • Implementation for staggered grids is not done.

malamast added 3 commits July 7, 2026 16:39
…et and Neumann BCs.

- This is what we used to do in Bout++ version 3.

- Higher order extrapolation can be unstable sometimes so I added back the 1st order BC. You can use thm in the input file by setting e.g. dirichlet_o1.

- Implementation for staggered grids is not done.
… the rest of the BC code.

-This was a later change to the BCs
@malamast
malamast requested a review from ZedThree July 8, 2026 00:30
@malamast malamast added feature backport candidiate Does not break backward compatibility, so can be back-ported to v4.4 labels Jul 8, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

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

There were too many comments to post at once. Showing the first 25 out of 54. Check the log or trigger a new build to see more.

Comment thread include/bout/boundary_standard.hxx
Comment thread include/bout/boundary_standard.hxx
Comment thread src/mesh/boundary_factory.cxx
Comment thread src/mesh/boundary_factory.cxx
Comment thread src/mesh/boundary_factory.cxx
Comment thread src/mesh/boundary_standard.cxx
Comment thread src/mesh/boundary_standard.cxx
Comment thread src/mesh/boundary_standard.cxx
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
@dschwoerer

dschwoerer commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
* Implementation for staggered grids is not done.

Could you add an assert?

Also, please fix the clang-tidy and clang-format issues.

@malamast

malamast commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author
* Implementation for staggered grids is not done.

Could you add an assert?

Also, please fix the clang-tidy and clang-format issues.

I have this line here:

throw BoutException("dirichlet_o1 BC is not implementated for staggered grids.");

throw BoutException("neumann_o1 BC is not implementated for staggered grids.");
That throws an Exception if this BC is used with staggered grids. Does this BoutException work as an error message or a an assert statement?

Also, I used: git clang-format origin/next for the formatting. Is there another command I sue use for clang-tidy?

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

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

There were too many comments to post at once. Showing the first 25 out of 39. Check the log or trigger a new build to see more.

Comment thread src/mesh/boundary_factory.cxx
Comment thread src/mesh/boundary_factory.cxx
Comment thread src/mesh/boundary_factory.cxx
Comment thread src/mesh/boundary_factory.cxx
Comment thread src/mesh/boundary_factory.cxx
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx
Comment thread src/mesh/boundary_standard.cxx Outdated
@dschwoerer

Copy link
Copy Markdown
Contributor

I have this line here:

throw BoutException("dirichlet_o1 BC is not implementated for staggered grids.");

That is sufficient. However, it would be better to check whether the fields location is at CELL_CENTRE.
Running with staggered grids is not an issue for this operator, as long as it is only used for fields at CELL_CENTRE.

Also, I used: git clang-format origin/next for the formatting. Is there another command I sue use for clang-tidy?

Formatting is now fine. For clang-tidy you see the comments that it posts. Some of them would require a refactoring, which is probably not in scope for this PR, like this:

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]

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx
Comment thread src/mesh/boundary_standard.cxx Outdated
Whether staggering is enabled or not does not really matter.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated
Comment thread src/mesh/boundary_standard.cxx Outdated

@dschwoerer dschwoerer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks decent. The only question is whether we want to add more stuff to boundary_standard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport candidiate Does not break backward compatibility, so can be back-ported to v4.4 feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants