metrics_closed_faces_alloc Subroutine

public subroutine metrics_closed_faces_alloc(this, grid, nz)

Grow the z-level closed-face masks from their (1,1,1) placeholder to full face size. Call ONLY when &vcoord_nml zfixed_closed_faces is on, at configure time — after init and BEFORE ocean_state_enter_data, so the device map captures the final shapes (a realloc after enter_data would leave the device pointing at freed host memory).

Seeded fully OPEN (1) so a stage that somehow reads them before the builder runs sees an inert mask.

Arguments

Type IntentOptional Attributes Name
type(ocean_metrics_t), intent(inout) :: this
type(hgrid_t), intent(in) :: grid
integer, intent(in) :: nz

Number of layers (multilayer%nz_ml).


Called by

proc~~metrics_closed_faces_alloc~~CalledByGraph proc~metrics_closed_faces_alloc metrics_closed_faces_alloc proc~configure_ocean_closed_faces configure_ocean_closed_faces proc~configure_ocean_closed_faces->proc~metrics_closed_faces_alloc proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_closed_faces 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 :: nx
integer, private :: ny

Source Code

   subroutine metrics_closed_faces_alloc(this, grid, nz)
      !! Grow the z-level closed-face masks from their `(1,1,1)`
      !! placeholder to full face size.  Call ONLY when
      !! `&vcoord_nml zfixed_closed_faces` is on, at configure time —
      !! after `init` and BEFORE `ocean_state_enter_data`, so the device
      !! map captures the final shapes (a realloc after `enter_data`
      !! would leave the device pointing at freed host memory).
      !!
      !! Seeded fully OPEN (1) so a stage that somehow reads them before
      !! the builder runs sees an inert mask.
      type(ocean_metrics_t), intent(inout) :: this
      type(hgrid_t), intent(in) :: grid
      integer, intent(in) :: nz
         !! Number of layers (`multilayer%nz_ml`).

      integer :: nx, ny

      nx = grid%nx_total
      ny = grid%ny_total

      if (allocated(this%open_u)) deallocate (this%open_u)
      if (allocated(this%open_v)) deallocate (this%open_v)

      allocate (this%open_u(nx + 1, ny, nz), source=1.0_wp)
      allocate (this%open_v(nx, ny + 1, nz), source=1.0_wp)
   end subroutine metrics_closed_faces_alloc