Skip to content

Commit

Permalink
More informative message when user provides smaller halo size than Im…
Browse files Browse the repository at this point in the history
…mersedBoundraryGrid requires (#2984)

* give more informative message when user provides smaller halo size than img requires

* removes warning from regrid

* adds clarification
  • Loading branch information
navidcy authored Mar 18, 2023
1 parent 2001a7f commit a3cb9f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
4 changes: 0 additions & 4 deletions src/Fields/regridding_fields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ const c = Center()
Regrid field `b` onto the grid of field `a`.
!!! warning "Functionality limitation"
Currently `regrid!` only regrids in the vertical ``z`` direction and works only on
fields that have data only in ``z`` direction.
Example
=======
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ validate_momentum_advection(momentum_advection, grid::AbstractHorizontallyCurvil
validate_momentum_advection(momentum_advection::Union{VectorInvariant, Nothing}, grid::AbstractHorizontallyCurvilinearGrid) = momentum_advection

function validate_model_halo(grid, momentum_advection, tracer_advection, closure)
user_halo = halo_size(grid)
required_halo = inflate_halo_size(1, 1, 1, grid,
momentum_advection,
tracer_advection,
closure)

any(user_halo .< required_halo) &&
throw(ArgumentError("The grid halo $user_halo must be at least equal to $required_halo. Note that an ImmersedBoundaryGrid requires an extra halo point."))
user_halo = halo_size(grid)
required_halo = inflate_halo_size(1, 1, 1, grid,
momentum_advection,
tracer_advection,
closure)

any(user_halo .< required_halo) &&
throw(ArgumentError("The grid halo $user_halo must be at least equal to $required_halo. Note that an ImmersedBoundaryGrid requires an extra halo point in all non-flat directions compared to a non-immersed boundary grid."))
end

initialize_model!(model::HydrostaticFreeSurfaceModel) = initialize_free_surface!(model.free_surface, model.grid, model.velocities)
Expand Down
2 changes: 1 addition & 1 deletion src/Models/NonhydrostaticModels/nonhydrostatic_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function inflate_grid_halo_size(grid, tendency_terms...)

if any(user_halo .< required_halo) # Replace grid
@warn "Inflating model grid halo size to ($Hx, $Hy, $Hz) and recreating grid. " *
"Note that an ImmersedBoundaryGrid requires an extra halo point. "
"Note that an ImmersedBoundaryGrid requires an extra halo point in all non-flat directions compared to a non-immersed boundary grid."
"The model grid will be different from the input grid. To avoid this warning, " *
"pass halo=($Hx, $Hy, $Hz) when constructing the grid."

Expand Down

0 comments on commit a3cb9f8

Please sign in to comment.