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

Distinguish between "masking" and "enforcing impenetrability" in immersed boundary routines #2249

Open
glwagner opened this issue Feb 16, 2022 · 8 comments
Labels
cleanup 🧹 Paying off technical debt immersed boundaries ⛰️ Less Ocean, more anigans

Comments

@glwagner
Copy link
Member

Is this correct?

return @inbounds ifelse(solid_interface(LX, LY, LZ, i, j, k, grid),

I'd expect it to use solid_node for masking scalars. Right?

For masking velocity fields for the purpose of enforcing impenetrable boundary conditions, it makes sense to me that we'd use solid_interface. But we should have a separate function for that.

In reality, we only need masking for the velocity field for our algorithm to work correctly. However, being able to mask scalars is sometimes useful for development purposes.

@simone-silvestri can you shed some light?

@glwagner glwagner added the cleanup 🧹 Paying off technical debt label Feb 16, 2022
@simone-silvestri
Copy link
Collaborator

simone-silvestri commented Feb 16, 2022

solid_interface should be the correct function because

solid_interface(Center(), Center(), Center(), i, j, k, ibg) = solid_node(Center(), Center(), Center(), i, j, k, ibg) = solid_node(i, j, k, ibg). (a "center location" can either only be fully solid or fully fluid)

You are correct that we don't need to mask scalars (also the free surface should not need masking)

@glwagner
Copy link
Member Author

Maybe if we want to be defensive we should implement both

  1. A mask_immersed_cells!" function that inserts a mask value into immersed cells. In reality this is just a convenience as noted, perhaps something to do just prior to output but not needed during the course of a computation.

  2. An enforce_impenetrability! function that takes in the velocity field and enforces no normal flow. This is a necessary component of our time-step.

For the implementations we have now, these are identical (thus we use solid_interface for both), but that might not be the case in the future.

@simone-silvestri
Copy link
Collaborator

I agree, also we have to remember to remove the masking of the tracers as that is not required...

@francispoulin
Copy link
Collaborator

Maybe a silly question, but don't we want to allow for the masking of tracers? I'm thinking about #2251, which is trying to mask a tracer.

@simone-silvestri
Copy link
Collaborator

simone-silvestri commented Feb 17, 2022

We should have a way to mask the tracers for sure.

On the other hand, in our current algorithm we do not "use" immersed "halo" nodes because we impose a no-flux condition by just setting to zero the fluxes on the immersed boundaries - opposed to actual boundaries where the "no-flux" condition is imposed by mirroring the values outside the boundary and explicitly calculating a flux.

For this reason, we don't need to mask the tracer within the time integration. So, it is not necessary, but It is definitely a function we want to allow...
I see the confusion, what I meant is we need to remove it if it is done within the time stepping, but we leave the functionality there

@glwagner
Copy link
Member Author

glwagner commented Feb 17, 2022

Right. The masking is "only" for things like visualization / inspection of field values. We have implemented (or have tried to implement) a fully featured system for reducing fields in the presence of immersed boundaries; furthermore the tendency functions are "boundary aware", so the values of the fields inside the immersed boundaries should be irrelevant. They could be NaN (maybe...). So we don't need the mask for calculations.

In fact I think we may want to use NaN as the mask value for output, because lots of visualization software (like Makie) will put blanks in for NaN, which is convenient... ?

On #2251 it seems we are basically using the mask to debug is_immersed.

@francispoulin
Copy link
Collaborator

Thanks for the explainations.

I like the idea of defaulting the masked regions to NaN. Good for plotting and might be helpful to identify if these values are ever used, which of course they shouldn't be.

@glwagner glwagner changed the title scalar_mask uses solid_interface Distinguish between "masking" and "enforcing impenetrability" in immersed boundary routines Feb 18, 2022
@navidcy navidcy added the immersed boundaries ⛰️ Less Ocean, more anigans label Feb 19, 2022
@glwagner
Copy link
Member Author

@navidcy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup 🧹 Paying off technical debt immersed boundaries ⛰️ Less Ocean, more anigans
Projects
None yet
Development

No branches or pull requests

4 participants