Populate the isopycnal rho_target(0:nz_ml) interface densities
for VCOORD_RHO / VCOORD_HYCOM. rho_target(0) is the surface
(lightest) interface, rho_target(nz_ml) the bed (densest).
&vcoord_nml rho_target_profile = "uniform" (default) — a
uniform light→dense linspace from rho_target_light /
rho_target_dense (MOM6 ALE_COORDINATE_CONFIG=UNIFORM);"list" — the nz_ml+1 interface densities of
rho_target_list, light first (MOM6 target densities from a
list or a file, e.g. HYBRID:file,sigma2,dz).validate_config has already refused a list of the wrong length
or one that is not strictly increasing; a short list reaching here
is an error stop. Harmless on other families.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(config_t), | intent(in) | :: | cfg | |||
| real(kind=wp), | intent(inout) | :: | rho_target(0:) | |||
| integer, | intent(in) | :: | nz_ml |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | frac | ||||
| integer, | private | :: | k |
subroutine configure_rho_target(cfg, rho_target, nz_ml) !! Populate the isopycnal `rho_target(0:nz_ml)` interface densities !! for `VCOORD_RHO` / `VCOORD_HYCOM`. `rho_target(0)` is the surface !! (lightest) interface, `rho_target(nz_ml)` the bed (densest). !! !! * `&vcoord_nml rho_target_profile = "uniform"` (default) — a !! uniform light→dense linspace from `rho_target_light` / !! `rho_target_dense` (MOM6 `ALE_COORDINATE_CONFIG=UNIFORM`); !! * `"list"` — the `nz_ml+1` interface densities of !! `rho_target_list`, light first (MOM6 target densities from a !! list or a file, e.g. `HYBRID:file,sigma2,dz`). !! !! `validate_config` has already refused a list of the wrong length !! or one that is not strictly increasing; a short list reaching here !! is an `error stop`. Harmless on other families. type(config_t), intent(in) :: cfg real(wp), intent(inout) :: rho_target(0:) integer, intent(in) :: nz_ml integer :: k real(wp) :: frac if (trim(cfg%rho_target_profile) == "list") then ! validate_config refuses a short list; reaching here with one is ! a bug, so stop rather than fall back to the linspace. if (count(cfg%rho_target_list > 0.0_wp) < nz_ml + 1) then error stop "configure_rho_target: rho_target_list shorter than nz_ml+1" end if do k = 0, nz_ml rho_target(k) = cfg%rho_target_list(k + 1) end do return end if do k = 0, nz_ml if (nz_ml > 0) then frac = real(k, wp)/real(nz_ml, wp) else frac = 0.0_wp end if rho_target(k) = cfg%rho_target_light & + (cfg%rho_target_dense - cfg%rho_target_light)*frac end do end subroutine configure_rho_target