ocean_diag_set_output_z_levels Subroutine

private subroutine ocean_diag_set_output_z_levels(this, z, ierr)

Configure the fixed-z output grid. Stored copy; the original z array is not retained. Must be called BEFORE any register with output_vgrid == DIAG_VGRID_Z_FIXED so the manager knows the output buffer shape.

Type Bound

ocean_diag_t

Arguments

Type IntentOptional Attributes Name
class(ocean_diag_t), intent(inout) :: this
real(kind=wp), intent(in) :: z(:)
integer, intent(out), optional :: ierr

Non-zero (OCEAN_STATUS_ERR_SETUP) when size(z) > NZ_STACK_MAX, when present; absent behaves as today (error stop). (F5 residual, P2.4)


Calls

proc~~ocean_diag_set_output_z_levels~~CallsGraph proc~ocean_diag_set_output_z_levels ocean_diag_t%ocean_diag_set_output_z_levels proc~fail fail proc~ocean_diag_set_output_z_levels->proc~fail error error proc~fail->error proc~error_ring_push error_ring_push proc~fail->proc~error_ring_push

Called by

proc~~ocean_diag_set_output_z_levels~~CalledByGraph proc~ocean_diag_set_output_z_levels ocean_diag_t%ocean_diag_set_output_z_levels proc~engine_configure_diag engine_configure_diag proc~engine_configure_diag->proc~ocean_diag_set_output_z_levels proc~engine_setup engine_setup proc~engine_setup->proc~engine_configure_diag 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

Source Code

   subroutine ocean_diag_set_output_z_levels(this, z, ierr)
      !! Configure the fixed-z output grid.  Stored copy; the original
      !! `z` array is not retained.  Must be called BEFORE any
      !! `register` with `output_vgrid == DIAG_VGRID_Z_FIXED` so the
      !! manager knows the output buffer shape.
      class(ocean_diag_t), intent(inout) :: this
      real(wp), intent(in) :: z(:)
      integer, intent(out), optional :: ierr
         !! Non-zero (`OCEAN_STATUS_ERR_SETUP`) when `size(z) >
         !! NZ_STACK_MAX`, when present; absent behaves as today
         !! (`error stop`). (F5 residual, P2.4)
      if (present(ierr)) ierr = OCEAN_STATUS_OK
      if (.not. this%is_init) return
      ! The conservative remap pads to max(nz, nz_out) in NZ_STACK_MAX-sized
      ! per-column stack buffers; more output levels than that would overrun
      ! them (silent device illegal-address).  Fail loud instead.
      if (size(z) > NZ_STACK_MAX) then
         call fail("set_output_z_levels: number of z-levels exceeds "// &
                   "NZ_STACK_MAX; raise NZ_STACK_MAX or use fewer levels", &
                   ierr, OCEAN_STATUS_ERR_SETUP)
         return
      end if
      if (allocated(this%z_out)) deallocate (this%z_out)
      this%nz_out = size(z)
      allocate (this%z_out(this%nz_out), source=z)
   end subroutine ocean_diag_set_output_z_levels