Skip to content
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

Inconsistency between mask_immersed_field and condition_operand #3791

Open
glwagner opened this issue Sep 25, 2024 · 0 comments
Open

Inconsistency between mask_immersed_field and condition_operand #3791

glwagner opened this issue Sep 25, 2024 · 0 comments
Labels
bug 🐞 Even a perfect program still has bugs user interface/experience 💻

Comments

@glwagner
Copy link
Member

glwagner commented Sep 25, 2024

Here's an MWE:

using Oceananigans
using Oceananigans.ImmersedBoundaries: mask_immersed_field!

grid = RectilinearGrid(size=(2, 2), x = (0, 4), z=(0, 4), topology = (Periodic, Flat, Bounded))
mask = CenterField(grid)
mask[1, 1, 1] = 1
grid = ImmersedBoundaryGrid(grid, GridFittedBoundary(mask))

c = CenterField(grid)
w = ZFaceField(grid)
set!(c, 1)
set!(w, 1)

@show maximum(c) maximum(w)

as might be expected this returns

maximum(c) = 1.0
maximum(w) = 1.0

but then writing

mask_immersed_field!(c, NaN)
mask_immersed_field!(w, NaN)

@show maximum(c) maximum(w)

leads to

maximum(c) = 1.0
maximum(w) = NaN

The reason is because mask_immersed_field will touch nodes that maximum does not ignore. But we want consistency between the two for many reasons, including analysis.

I believe @simone-silvestri's suggestion is to fix condition_operand to ignore all peripheral_nodes --- not just inactive and immersed_peripheral_node. The difference between the two are points that lie on non-immersed boundaries, and only affect fields with at least one Face location (like w above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Even a perfect program still has bugs user interface/experience 💻
Projects
None yet
Development

No branches or pull requests

1 participant