ocean_kappa_shear_init Subroutine

private subroutine ocean_kappa_shear_init(this, grid, nz_ml)

Allocate the persistent fields. Always allocates (configure runs after init, so enable is not known yet); the off-cost is the f_centre + two interface fields.

Type Bound

ocean_kappa_shear_t

Arguments

Type IntentOptional Attributes Name
class(ocean_kappa_shear_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_kappa_shear_init(this, grid, nz_ml)
      !! Allocate the persistent fields.  Always allocates (configure
      !! runs after init, so `enable` is not known yet); the off-cost
      !! is the f_centre + two interface fields.
      class(ocean_kappa_shear_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

      allocate (this%f_centre(nx, ny), source=0.0_wp)
      allocate (this%kd_int(nx, ny, nz + 1), source=0.0_wp)
      allocate (this%tke_int(nx, ny, nz + 1), source=0.0_wp)

      this%is_init = .true.
   end subroutine ocean_kappa_shear_init