ocean_top_drag_init Subroutine

private subroutine ocean_top_drag_init(this, grid, nz_ml)

Allocate the slot. Gated on enable (latched before this runs), so a run without an ice shelf pays five (1,1) placeholders and two (1,1,1) scratch buffers.

Type Bound

ocean_top_drag_t

Arguments

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

Calls

proc~~ocean_top_drag_init~~CallsGraph proc~ocean_top_drag_init ocean_top_drag_t%ocean_top_drag_init proc~scratch_3d_buffer_init scratch_3d_buffer_t%scratch_3d_buffer_init proc~ocean_top_drag_init->proc~scratch_3d_buffer_init

Variables

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

Source Code

   subroutine ocean_top_drag_init(this, grid, nz_ml)
      !! Allocate the slot.  Gated on `enable` (latched before this runs),
      !! so a run without an ice shelf pays five `(1,1)` placeholders and
      !! two `(1,1,1)` scratch buffers.
      class(ocean_top_drag_t), intent(inout) :: this
      type(hgrid_t), intent(in) :: grid
      integer, intent(in), optional :: nz_ml
      integer :: nx, ny, nz

      nz = 1
      if (this%enable) then
         nx = grid%nx_total
         ny = grid%ny_total
         if (present(nz_ml)) nz = nz_ml
      else
         nx = 1
         ny = 1
      end if

      call this%du_drag%init(nx + 1, ny, nz, "ocean_tdrag_du_drag")
      call this%dv_drag%init(nx, ny + 1, nz, "ocean_tdrag_dv_drag")
      allocate (this%cover_u(nx + 1, ny), source=0.0_wp)
      allocate (this%cover_v(nx, ny + 1), source=0.0_wp)
      allocate (this%cover_t(nx, ny), source=0.0_wp)
      allocate (this%lambda_top_u(nx + 1, ny), source=0.0_wp)
      allocate (this%lambda_top_v(nx, ny + 1), source=0.0_wp)
      allocate (this%stress_top(nx, ny), source=0.0_wp)
      this%is_init = .true.
   end subroutine ocean_top_drag_init