ocean_linear_layer_density Function

public 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.

Arguments

Type IntentOptional 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.

Return Value real(kind=wp), (nz_ml)


Called by

proc~~ocean_linear_layer_density~~CalledByGraph proc~ocean_linear_layer_density ocean_linear_layer_density proc~ocean_state_seed_from_cfg ocean_state_seed_from_cfg proc~ocean_state_seed_from_cfg->proc~ocean_linear_layer_density proc~engine_setup engine_setup proc~engine_setup->proc~ocean_state_seed_from_cfg proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Variables

Type Visibility Attributes Name Initial
integer, private :: k

Source Code

   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