Hold land T-cells (wet_mask==0) at FINITE reference values so
the masked dyn-core never evaluates 0*NaN (a zeroed face metric
times a NaN land contribution is still NaN). Spec §13.3 /
land_mask_final_resolution.md R-land-state:
* h_layer floored to H_VANISHED (never 0 — avoids 1/0);
* tracer content zeroed (hTr = 0, so T = S = 0 — finite);
* layer + barotropic face velocities zeroed at land faces.
The (h, hTr) = (H_VANISHED, 0) pair is the LAND-STATE CONTRACT:
it is what every vanished-gated operator already holds a land
column at, so a land column looks the same to the budget at the
latch and at every later step. seed_land_tracer_hold_impl
carries the full statement and the history.
Runs at SETUP, after metrics_apply_land_mask has derived
wet_u/wet_v, BEFORE ocean_state_enter_data. Plain host loops
(pre-enter_data). No-op for an all-wet domain (wet_mask≡1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_state_t), | intent(inout) | :: | state | |||
| type(hgrid_t), | intent(in) | :: | grid |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | nz_ml | ||||
| integer, | private | :: | t |
subroutine ocean_state_seed_land_cells(state, grid) !! Hold land T-cells (`wet_mask==0`) at FINITE reference values so !! the masked dyn-core never evaluates `0*NaN` (a zeroed face metric !! times a NaN land contribution is still NaN). Spec §13.3 / !! `land_mask_final_resolution.md` R-land-state: !! * `h_layer` floored to `H_VANISHED` (never 0 — avoids 1/0); !! * tracer content zeroed (`hTr = 0`, so `T = S = 0` — finite); !! * layer + barotropic face velocities zeroed at land faces. !! !! The `(h, hTr) = (H_VANISHED, 0)` pair is the LAND-STATE CONTRACT: !! it is what every vanished-gated operator already holds a land !! column at, so a land column looks the same to the budget at the !! latch and at every later step. `seed_land_tracer_hold_impl` !! carries the full statement and the history. !! !! Runs at SETUP, after `metrics_apply_land_mask` has derived !! `wet_u/wet_v`, BEFORE `ocean_state_enter_data`. Plain host loops !! (pre-enter_data). No-op for an all-wet domain (`wet_mask≡1`). type(ocean_state_t), intent(inout) :: state type(hgrid_t), intent(in) :: grid integer :: nz_ml, t associate (ms => state%multilayer) nz_ml = size(ms%h_layer, 3) ! Tracer content on land is ZERO — the state every vanished-gated ! operator (ALE remap first) holds a land column at, and therefore ! the state the budget latch must see. Order-independent of the ! thickness floor below: neither reads the other. See ! `seed_land_tracer_hold_impl`'s land-state contract. if (allocated(ms%tracers)) then do t = 1, size(ms%tracers) call seed_land_tracer_hold_impl(ms%tracers(t)%hTr, & ms%wet_mask, nz_ml) end do end if ! h_layer floor on land. call seed_land_h_floor_impl(ms%h_layer, ms%wet_mask, nz_ml) ! On a WET column, the inert fillers a rigid-top coordinate leaves ! inside the ice (and below the bed) are seeded with the IC's own ! `c(z)*h_min` — the concentration at the filler's depth, not its ! donor's. Establish invariant I1′ (`hTr = h*c_live`) HERE, with ! the one definition (`rdb_vl_merge_content`, host twin because ! this runs before `enter_data`), so the budget latch sees the ! state every later step holds. Column-conservative, so the ! latch's content is unchanged either way; this is about the ! seeded state satisfying the invariant, not about the budget. ! (Under the previous rule, I1, the first regrid ZEROED these ! fillers un-budgeted — `-1.604E-06` relative at step 1 on ! `cavity_sloping_lid_rest_zfixed.nml` — which is why this fence ! was a zeroing hold.) Fenced to `z_fixed` x cavity so every ! other namelist's step-0 state is bit-identical. if (state%metrics%use_cavity .and. state%vcoord%coord_type == VCOORD_Z_FIXED) then call ms%enforce_vanished_content_host(size(ms%h_layer, 1), size(ms%h_layer, 2)) end if ! Zero layer face velocities at land faces. call seed_land_face_vel_impl(ms%u_face_x_layer, state%metrics%wet_u, nz_ml) call seed_land_face_vel_impl(ms%v_face_y_layer, state%metrics%wet_v, nz_ml) end associate ! Zero the layer mass-transports + barotropic face velocities at land ! faces (the transports ride masked metrics anyway, but resetting them ! keeps the held land state internally consistent). call seed_land_face_vel_impl(state%multilayer%hu_face_x_layer, & state%metrics%wet_u, nz_ml) call seed_land_face_vel_impl(state%multilayer%hv_face_y_layer, & state%metrics%wet_v, nz_ml) call seed_land_face_vel_2d_impl(state%barotropic%u_face_x, state%metrics%wet_u) call seed_land_face_vel_2d_impl(state%barotropic%v_face_y, state%metrics%wet_v) call seed_land_face_vel_2d_impl(state%barotropic%hu_face_x, state%metrics%wet_u) call seed_land_face_vel_2d_impl(state%barotropic%hv_face_y, state%metrics%wet_v) ! `grid` is part of the setup contract (shapes come from the state ! allocations); not re-read here. associate (unused => grid%nx_total) end associate end subroutine ocean_state_seed_land_cells