Dispatch the &ocean_zinit_nml T/S overlay across its two axes:
the profile SOURCE ("file" — the pre-regridded NetCDF reader;
"linear" — the analytic affine lin_* profile) and whether a
cavity draft is present.
The draft is the whole reason this is a separate routine. Both
seeders measure each layer centre’s GEOPOTENTIAL depth from
z = 0; under an ice shelf the column top is z_draft metres
down, so metrics%z_draft has to reach them or a T(z) profile
lands systematically too shallow (and, under a SLOPING lid,
tilts the isopycnals with the ice base — not a state of rest).
With the cavity off metrics%z_draft is the (1, 1)
placeholder, so the argument is simply not passed and the
arithmetic is bit-identical to the pre-cavity path.
NOT pure: the seeders it dispatches to read files and log.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_state_t), | intent(inout) | :: | state | |||
| type(hgrid_t), | intent(in) | :: | grid | |||
| type(config_t), | intent(in) | :: | cfg | |||
| integer, | intent(out), | optional | :: | ierr |
Threaded straight through to the seeder; an ABSENT |
|
| real(kind=wp), | intent(in), | optional | :: | z_top(:,:) |
Column-top depth (m, positive down), FULL ghosted shape, in
place of |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | private | :: | cav |
subroutine seed_zinit_overlay(state, grid, cfg, ierr, z_top) !! Dispatch the `&ocean_zinit_nml` T/S overlay across its two axes: !! the profile SOURCE (`"file"` — the pre-regridded NetCDF reader; !! `"linear"` — the analytic affine `lin_*` profile) and whether a !! cavity draft is present. !! !! The draft is the whole reason this is a separate routine. Both !! seeders measure each layer centre's GEOPOTENTIAL depth from !! `z = 0`; under an ice shelf the column top is `z_draft` metres !! down, so `metrics%z_draft` has to reach them or a `T(z)` profile !! lands systematically too shallow (and, under a SLOPING lid, !! tilts the isopycnals with the ice base — not a state of rest). !! With the cavity off `metrics%z_draft` is the `(1, 1)` !! placeholder, so the argument is simply not passed and the !! arithmetic is bit-identical to the pre-cavity path. !! !! NOT `pure`: the seeders it dispatches to read files and log. type(ocean_state_t), intent(inout) :: state type(hgrid_t), intent(in) :: grid type(config_t), intent(in) :: cfg integer, intent(out), optional :: ierr !! Threaded straight through to the seeder; an ABSENT `ierr` !! stays absent there, so each keeps its own `error stop` text. real(wp), intent(in), optional :: z_top(:, :) !! Column-top depth (m, positive down), FULL ghosted shape, in !! place of `metrics%z_draft`: the TRIMMED cavity IC !! (`&ocean_cavity_dyn_nml trim_ic_for_p_surf`) puts the top at !! `z_draft - eta_trim`. Absent => `metrics%z_draft`. logical :: cav cav = state%metrics%use_cavity if (present(z_top)) then if (trim(adjustl(cfg%ocean%zinit%source)) == "linear") then call seed_ts_linear_z(state%multilayer, cfg%ocean%zinit, ierr, z_top) else call seed_ts_from_zfile(state%multilayer, grid, cfg%ocean%zinit, ierr, z_top) end if return end if if (trim(adjustl(cfg%ocean%zinit%source)) == "linear") then if (cav) then call seed_ts_linear_z(state%multilayer, cfg%ocean%zinit, ierr, & state%metrics%z_draft) else call seed_ts_linear_z(state%multilayer, cfg%ocean%zinit, ierr) end if else if (cav) then call seed_ts_from_zfile(state%multilayer, grid, cfg%ocean%zinit, ierr, & state%metrics%z_draft) else call seed_ts_from_zfile(state%multilayer, grid, cfg%ocean%zinit, ierr) end if end if end subroutine seed_zinit_overlay