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

static_column_depth interface #3841

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open

Conversation

simone-silvestri
Copy link
Collaborator

@simone-silvestri simone-silvestri commented Oct 9, 2024

This PR introduces an interface for column_height that returns the height of the water column.
This is simply grid.Lz in regular grids.

For AbstractGridFittedBottom immersed grids, the column height is readily read from the immersed boundary, provided that the immersed boundary represents the numerical bottom rather than the physical bottom.
Therefore, this PR changes the constructor of the ImmersedBoundaryGrid to store the z-coordinate of the last immersed cell. In this way, the bottom height is also uniquely defined for GridFittedBottom, removing the necessity of having aCenterImmersedCondition and a InterfaceImmersedCondition.

An immediate application of this interface is in the SplitExplicitFreeSurface where the bottom_height was previously stored.

@simone-silvestri simone-silvestri changed the title Bottom height for ImmersedBoundaries bottom_height interface Oct 9, 2024
@simone-silvestri simone-silvestri changed the title bottom_height interface column_height interface Oct 9, 2024
@simone-silvestri
Copy link
Collaborator Author

Correction: InterfaceImmersedCondition and CenterImmersedCondition might still useful during construction because they inform where the bottom height will be.

@glwagner
Copy link
Member

glwagner commented Oct 9, 2024

Is column_height a good name?

There's a naming issue. We had previously referred to "z" as "height". Usually this doesn't matter but when it does, eg in realistic contexts and using nonlinear equation of state, then we are trying to be consistent with the literature where "z" is the "geopotential height".

We can change the user-facing naming and notation for sure but it has to be done carefully and with consensus. I think this PR makes some big changes to notation and language that could have wide-ranging impacts on how we communicate about numerical models.


struct GridFittedBottom{H, I} <: AbstractGridFittedBottom{H}
bottom_height :: H
z_bottom :: H
Copy link
Member

Choose a reason for hiding this comment

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

why this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I though we want to refer to z as the coordinate and height as a positive value.
At least, this is the direction we are taking in ClimaOcean where we are distinguishing very carefully between z and h or height.
In this case, this is technically a coordinate, not a height, for example we have now

@inline z_bottom(i, j, ibg::GFBIBG) = @inbounds ibg.immersed_boundary.bottom_height[i, j, 1]
which conflates the meaning of z with height. I thought we had decided this over at ClimaOcean and I wanted to update this code to reflect the decision we had made.

Copy link
Member

@glwagner glwagner Oct 9, 2024

Choose a reason for hiding this comment

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

I though we want to refer to z as the coordinate and height as a positive value.

Usually "z" is called "geopotential height". In the way it's usually used, height can be positive or negative; the point is that it increases as we go upwards away from the center of the Earth (as opposed to "depth" which increases downwards). What would you call "z" instead? Altitude?

Copy link
Member

Choose a reason for hiding this comment

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

this is technically a coordinate, not a height

Another name for z is "height coordinate".

Copy link
Collaborator

Choose a reason for hiding this comment

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

As someone who hasn't used immersed boundaries that much, I always find it a bit confusing that it's called bottom height because it makes me think I'm meant to put in a positive "height" from the bottom of the domain, but I would know that "z" is meant to be from the top

Co-authored-by: Gregory L. Wagner <[email protected]>
@@ -55,6 +55,7 @@ using Oceananigans.ImmersedBoundaries: z_bottom
import Oceananigans.Grids: required_halo_size_x, required_halo_size_y, required_halo_size_z
import Oceananigans.Architectures: on_architecture

import Oceananigans.ImmersedBoundaries: z_bottom
Copy link
Member

Choose a reason for hiding this comment

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

leftover?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's the new rearrangement of the modules.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have changed z_bottom to be only in TurbulenceClosures as it is the only module in which is needed / used and all similar methods (z_top, depth, height_above_bottom...) are defined only there

Comment on lines +147 to +148
full_Δz = Δzᶜᶜᶜ(i, j, k, ibg.underlying_grid)
partial_Δz = z - zb
Copy link
Member

Choose a reason for hiding this comment

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

This should go in a different PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The new numerical bottom height is located at by convention at z⁻ + Δz * (1 - ϵ) so ϵ * full_Δz == z - h removing the necessity of the max. I thought this change can clean up the partial cell code

Copy link
Collaborator Author

@simone-silvestri simone-silvestri Oct 23, 2024

Choose a reason for hiding this comment

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

actually, there is a bug here with how the immersed bottom height is computed. I have corrected it

@simone-silvestri
Copy link
Collaborator Author

The dependency on OrthogonalSphericalShellGrids here is blocking the progress (the SplitExplicitAuxiliaryFields type has changed in this PR). How do we deal with this? We could remove the dependency in the tests of Oceananigans and move those tests over at OrthogonalSphericalShellGrids

@simone-silvestri
Copy link
Collaborator Author

simone-silvestri commented Oct 25, 2024

The dependency on OrthogonalSphericalShellGrids here is blocking the progress (the SplitExplicitAuxiliaryFields type has changed in this PR). How do we deal with this? We could remove the dependency in the tests of Oceananigans and move those tests over at OrthogonalSphericalShellGrids

Shall we do this? In case we want to do it I have prepared CliMA/OrthogonalSphericalShellGrids.jl#47.
If yes, we can merge that one then this one, then update OrthogonalSphericalShellGrids with the new interface

@simone-silvestri
Copy link
Collaborator Author

This PR should be ready to merge

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

Successfully merging this pull request may close these issues.

4 participants