coriolis_adv_init Subroutine

private subroutine coriolis_adv_init(this, grid, nz_ml)

Allocate the 4 scratch buffers sized at (nx_face / ny_face / corner, nz). Default nz=1 covers the barotropic kernel; passing nz_ml sizes them for the multilayer kernel. Same backward-compatible pattern as continuity_init.

Type Bound

coriolis_adv_t

Arguments

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

Calls

proc~~coriolis_adv_init~~CallsGraph proc~coriolis_adv_init coriolis_adv_t%coriolis_adv_init proc~scratch_3d_buffer_init scratch_3d_buffer_t%scratch_3d_buffer_init proc~coriolis_adv_init->proc~scratch_3d_buffer_init

Variables

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

Source Code

   subroutine coriolis_adv_init(this, grid, nz_ml)
      !! Allocate the 4 scratch buffers sized at
      !! (nx_face / ny_face / corner, nz).  Default nz=1 covers the
      !! barotropic kernel; passing `nz_ml` sizes them for the
      !! multilayer kernel.  Same backward-compatible pattern as
      !! `continuity_init`.
      class(coriolis_adv_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

      ! Corner-located: (nx+1, ny+1, nz)
      call this%q_corner%init(nx + 1, ny + 1, nz, "coriolis_adv_q_corner")
      ! Cell-centred: (nx, ny, nz)
      call this%ke_centre%init(nx, ny, nz, "coriolis_adv_ke_centre")
      ! East-face: (nx+1, ny, nz) — same shape as u_face_x_layer
      call this%pv_flux_x%init(nx + 1, ny, nz, "coriolis_adv_pv_flux_x")
      ! North-face: (nx, ny+1, nz) — same shape as v_face_y_layer
      call this%pv_flux_y%init(nx, ny + 1, nz, "coriolis_adv_pv_flux_y")
      ! HK mass fluxes — same shapes as pv_flux_x / pv_flux_y.
      call this%mass_flux_u%init(nx + 1, ny, nz, "coriolis_adv_mass_flux_u")
      call this%mass_flux_v%init(nx, ny + 1, nz, "coriolis_adv_mass_flux_v")

      ! Coriolis parameter at corners, initialised to f_0 everywhere.
      allocate (this%f_corner(nx + 1, ny + 1), source=this%f_0)

      this%is_init = .true.
   end subroutine coriolis_adv_init