Linearly-spaced layer densities for the MOM6 COORD_CONFIG="linear"
IC analogue (set_coord_linear), re-derived for Roundabout’s bottom-up
layer convention. Returns nz_ml densities, bed k=1 heaviest →
surface k=nz_ml lightest, layer-centred:
ρ(k) = rho_lightest + rho_range · (nz_ml − k + 0.5)/nz_ml
so ρ(nz_ml) ≈ rho_lightest (surface, lightest) and ρ(1) ≈
rho_lightest + rho_range (bed, heaviest), with uniform spacing
rho_range/nz_ml between adjacent layers. MOM6 indexes k=1 at the
lightest (top) layer; the (nz_ml − k) flip here gives the same
physical column under Roundabout’s k=1-is-bed orientation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | rho_lightest |
Surface (lightest) layer density [kg/m³]. |
||
| real(kind=wp), | intent(in) | :: | rho_range |
Top-to-bottom density contrast [kg/m³]. |
||
| integer, | intent(in) | :: | nz_ml |
Number of layers. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | k |
pure function ocean_linear_layer_density(rho_lightest, rho_range, nz_ml) result(rho) !! Linearly-spaced layer densities for the MOM6 `COORD_CONFIG="linear"` !! IC analogue (`set_coord_linear`), re-derived for Roundabout's bottom-up !! layer convention. Returns `nz_ml` densities, bed `k=1` heaviest → !! surface `k=nz_ml` lightest, layer-centred: !! !! ρ(k) = rho_lightest + rho_range · (nz_ml − k + 0.5)/nz_ml !! !! so ρ(nz_ml) ≈ rho_lightest (surface, lightest) and ρ(1) ≈ !! rho_lightest + rho_range (bed, heaviest), with uniform spacing !! rho_range/nz_ml between adjacent layers. MOM6 indexes `k=1` at the !! lightest (top) layer; the `(nz_ml − k)` flip here gives the same !! physical column under Roundabout's `k=1`-is-bed orientation. real(wp), intent(in) :: rho_lightest !! Surface (lightest) layer density [kg/m³]. real(wp), intent(in) :: rho_range !! Top-to-bottom density contrast [kg/m³]. integer, intent(in) :: nz_ml !! Number of layers. real(wp) :: rho(nz_ml) integer :: k do k = 1, nz_ml rho(k) = rho_lightest + rho_range* & ((real(nz_ml - k, wp) + 0.5_wp)/real(nz_ml, wp)) end do end function ocean_linear_layer_density