seed_zinit_overlay Subroutine

private subroutine seed_zinit_overlay(state, grid, cfg, ierr, z_top)

Dispatch the &ocean_zinit_nml T/S overlay across its two axes: the profile SOURCE ("file" — the pre-regridded NetCDF reader; "linear" — the analytic affine lin_* profile) and whether a cavity draft is present.

The draft is the whole reason this is a separate routine. Both seeders measure each layer centre’s GEOPOTENTIAL depth from z = 0; under an ice shelf the column top is z_draft metres down, so metrics%z_draft has to reach them or a T(z) profile lands systematically too shallow (and, under a SLOPING lid, tilts the isopycnals with the ice base — not a state of rest). With the cavity off metrics%z_draft is the (1, 1) placeholder, so the argument is simply not passed and the arithmetic is bit-identical to the pre-cavity path.

NOT pure: the seeders it dispatches to read files and log.

Arguments

Type IntentOptional Attributes Name
type(ocean_state_t), intent(inout) :: state
type(hgrid_t), intent(in) :: grid
type(config_t), intent(in) :: cfg
integer, intent(out), optional :: ierr

Threaded straight through to the seeder; an ABSENT ierr stays absent there, so each keeps its own error stop text.

real(kind=wp), intent(in), optional :: z_top(:,:)

Column-top depth (m, positive down), FULL ghosted shape, in place of metrics%z_draft: the TRIMMED cavity IC (&ocean_cavity_dyn_nml trim_ic_for_p_surf) puts the top at z_draft - eta_trim. Absent => metrics%z_draft.


Calls

proc~~seed_zinit_overlay~~CallsGraph proc~seed_zinit_overlay seed_zinit_overlay proc~seed_ts_from_zfile seed_ts_from_zfile proc~seed_zinit_overlay->proc~seed_ts_from_zfile proc~seed_ts_linear_z seed_ts_linear_z proc~seed_zinit_overlay->proc~seed_ts_linear_z info info proc~seed_ts_from_zfile->info proc~build_z_ctr build_z_ctr proc~seed_ts_from_zfile->proc~build_z_ctr proc~draft_shape_ok draft_shape_ok proc~seed_ts_from_zfile->proc~draft_shape_ok proc~fail fail proc~seed_ts_from_zfile->proc~fail proc~find_var find_var proc~seed_ts_from_zfile->proc~find_var proc~interp_column_linear_z interp_column_linear_z proc~seed_ts_from_zfile->proc~interp_column_linear_z proc~nc_close nc_close proc~seed_ts_from_zfile->proc~nc_close proc~nc_get_var_1d nc_get_var_1d proc~seed_ts_from_zfile->proc~nc_get_var_1d proc~nc_open_read nc_open_read proc~seed_ts_from_zfile->proc~nc_open_read proc~read_dims read_dims proc~seed_ts_from_zfile->proc~read_dims proc~read_field_xyz read_field_xyz proc~seed_ts_from_zfile->proc~read_field_xyz proc~zinit_io_ok zinit_io_ok proc~seed_ts_from_zfile->proc~zinit_io_ok to_string to_string proc~seed_ts_from_zfile->to_string proc~seed_ts_linear_z->info proc~seed_ts_linear_z->proc~build_z_ctr proc~seed_ts_linear_z->proc~draft_shape_ok proc~seed_ts_linear_z->proc~fail proc~linear_in_z linear_in_z proc~seed_ts_linear_z->proc~linear_in_z proc~seed_ts_linear_z->to_string error error proc~fail->error proc~error_ring_push error_ring_push proc~fail->proc~error_ring_push proc~find_var->proc~fail proc~find_var->proc~nc_close nf90_inq_varid nf90_inq_varid proc~find_var->nf90_inq_varid nf90_close nf90_close proc~nc_close->nf90_close proc~nc_check nc_check proc~nc_close->proc~nc_check nf90_get_var nf90_get_var proc~nc_get_var_1d->nf90_get_var proc~nc_get_var_1d->proc~nc_check nf90_open nf90_open proc~nc_open_read->nf90_open proc~nc_open_read->proc~nc_check proc~read_dims->proc~fail proc~read_dims->proc~nc_close proc~read_dims->proc~zinit_io_ok proc~read_dims->to_string nf90_inquire_dimension nf90_inquire_dimension proc~read_dims->nf90_inquire_dimension nf90_inquire_variable nf90_inquire_variable proc~read_dims->nf90_inquire_variable proc~read_dims->proc~nc_check proc~nc_get_var_slab_3d nc_get_var_slab_3d proc~read_field_xyz->proc~nc_get_var_slab_3d proc~zinit_io_ok->proc~nc_close proc~nc_check->proc~fail nf90_strerror nf90_strerror proc~nc_check->nf90_strerror proc~nc_get_var_slab_3d->nf90_get_var proc~nc_get_var_slab_3d->proc~nc_check

Called by

proc~~seed_zinit_overlay~~CalledByGraph proc~seed_zinit_overlay seed_zinit_overlay proc~ocean_state_seed_from_cfg ocean_state_seed_from_cfg proc~ocean_state_seed_from_cfg->proc~seed_zinit_overlay proc~engine_setup engine_setup proc~engine_setup->proc~ocean_state_seed_from_cfg 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
logical, private :: cav

Source Code

   subroutine seed_zinit_overlay(state, grid, cfg, ierr, z_top)
      !! Dispatch the `&ocean_zinit_nml` T/S overlay across its two axes:
      !! the profile SOURCE (`"file"` — the pre-regridded NetCDF reader;
      !! `"linear"` — the analytic affine `lin_*` profile) and whether a
      !! cavity draft is present.
      !!
      !! The draft is the whole reason this is a separate routine.  Both
      !! seeders measure each layer centre's GEOPOTENTIAL depth from
      !! `z = 0`; under an ice shelf the column top is `z_draft` metres
      !! down, so `metrics%z_draft` has to reach them or a `T(z)` profile
      !! lands systematically too shallow (and, under a SLOPING lid,
      !! tilts the isopycnals with the ice base — not a state of rest).
      !! With the cavity off `metrics%z_draft` is the `(1, 1)`
      !! placeholder, so the argument is simply not passed and the
      !! arithmetic is bit-identical to the pre-cavity path.
      !!
      !! NOT `pure`: the seeders it dispatches to read files and log.
      type(ocean_state_t), intent(inout) :: state
      type(hgrid_t), intent(in) :: grid
      type(config_t), intent(in) :: cfg
      integer, intent(out), optional :: ierr
         !! Threaded straight through to the seeder; an ABSENT `ierr`
         !! stays absent there, so each keeps its own `error stop` text.
      real(wp), intent(in), optional :: z_top(:, :)
         !! Column-top depth (m, positive down), FULL ghosted shape, in
         !! place of `metrics%z_draft`: the TRIMMED cavity IC
         !! (`&ocean_cavity_dyn_nml trim_ic_for_p_surf`) puts the top at
         !! `z_draft - eta_trim`.  Absent => `metrics%z_draft`.

      logical :: cav

      cav = state%metrics%use_cavity
      if (present(z_top)) then
         if (trim(adjustl(cfg%ocean%zinit%source)) == "linear") then
            call seed_ts_linear_z(state%multilayer, cfg%ocean%zinit, ierr, z_top)
         else
            call seed_ts_from_zfile(state%multilayer, grid, cfg%ocean%zinit, ierr, z_top)
         end if
         return
      end if
      if (trim(adjustl(cfg%ocean%zinit%source)) == "linear") then
         if (cav) then
            call seed_ts_linear_z(state%multilayer, cfg%ocean%zinit, ierr, &
                                  state%metrics%z_draft)
         else
            call seed_ts_linear_z(state%multilayer, cfg%ocean%zinit, ierr)
         end if
      else
         if (cav) then
            call seed_ts_from_zfile(state%multilayer, grid, cfg%ocean%zinit, ierr, &
                                    state%metrics%z_draft)
         else
            call seed_ts_from_zfile(state%multilayer, grid, cfg%ocean%zinit, ierr)
         end if
      end if
   end subroutine seed_zinit_overlay