ocean_mle_init Subroutine

private subroutine ocean_mle_init(this, grid, nz_ml)

Allocate the 2D ML diagnostics + per-layer face transports. Always allocates (configure runs after init); the off-state footprint is two 2D + two face-shaped 3D arrays.

Type Bound

ocean_mle_t

Arguments

Type IntentOptional Attributes Name
class(ocean_mle_t), intent(inout) :: this
type(hgrid_t), intent(in) :: grid
integer, intent(in), optional :: nz_ml

Variables

Type Visibility Attributes Name Initial
integer, private :: nx
integer, private :: ny
integer, private :: nz

Source Code

   subroutine ocean_mle_init(this, grid, nz_ml)
      !! Allocate the 2D ML diagnostics + per-layer face transports.
      !! Always allocates (configure runs after init); the off-state
      !! footprint is two 2D + two face-shaped 3D arrays.
      class(ocean_mle_t), intent(inout) :: this
      type(hgrid_t), intent(in) :: grid
      integer, intent(in), optional :: nz_ml
      integer :: nx, ny, nz

      nx = grid%nx_total
      ny = grid%ny_total
      nz = 1
      if (present(nz_ml)) nz = nz_ml
      if (nz < 1) nz = 1
      this%nx_total = nx
      this%ny_total = ny
      this%nz_ml = nz

      allocate (this%b_ml(nx, ny), source=0.0_wp)
      allocate (this%htot_ml(nx, ny), source=0.0_wp)
      ! -1 sentinel = unseeded; the first filtered step copies the
      ! instantaneous MLD into the running mean.
      allocate (this%mld_filtered(nx, ny), source=-1.0_wp)
      allocate (this%uhml(nx + 1, ny, nz), source=0.0_wp)
      allocate (this%vhml(nx, ny + 1, nz), source=0.0_wp)
      this%is_init = .true.
   end subroutine ocean_mle_init