configure_ocean_p_surf Subroutine

public subroutine configure_ocean_p_surf(cfg, ocean_state, grid, compute_rank)

Configure the atmospheric surface-pressure loading slot (PR-17): copy enable, take ρ₀ from ocean_state%eos%rho0 (the single ρ₀ of record — NOT a namelist knob), and allocate the seam fields. Host-side setup — runs BEFORE ocean_state_enter_data. enable=.false. => no-op, bit-identical. The uniform-p_surf inert warning is emitted in validate_config; here we only log the enable on rank 0.

Arguments

Type IntentOptional Attributes Name
type(config_t), intent(in) :: cfg
type(ocean_state_t), intent(inout) :: ocean_state
type(hgrid_t), intent(in) :: grid
integer, intent(in) :: compute_rank

Calls

proc~~configure_ocean_p_surf~~CallsGraph proc~configure_ocean_p_surf configure_ocean_p_surf info info proc~configure_ocean_p_surf->info proc~p_surf_configure p_surf_configure proc~configure_ocean_p_surf->proc~p_surf_configure to_string to_string proc~configure_ocean_p_surf->to_string

Called by

proc~~configure_ocean_p_surf~~CalledByGraph proc~configure_ocean_p_surf configure_ocean_p_surf proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_p_surf 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 configure_ocean_p_surf(cfg, ocean_state, grid, compute_rank)
      !! Configure the atmospheric surface-pressure loading slot (PR-17):
      !! copy `enable`, take ρ₀ from `ocean_state%eos%rho0` (the single ρ₀
      !! of record — NOT a namelist knob), and allocate the seam fields.
      !! Host-side setup — runs BEFORE `ocean_state_enter_data`.
      !! `enable=.false.` => no-op, bit-identical.  The uniform-`p_surf`
      !! inert warning is emitted in `validate_config`; here we only log the
      !! enable on rank 0.
      type(config_t), intent(in) :: cfg
      type(ocean_state_t), intent(inout) :: ocean_state
      type(hgrid_t), intent(in) :: grid
      integer, intent(in) :: compute_rank
      integer :: nx, ny

      associate (ps => ocean_state%p_surf, pcfg => cfg%ocean%psurf)
         ps%enable = pcfg%enable
         if (.not. pcfg%enable) return

         ! Single ρ₀ of record: the model's own reference density, so the
         ! inverse barometer scales with whatever `&ocean_ic_nml rho_0`
         ! set.  `eos%rho0` is assigned in `ocean_state_init_from_config`
         ! (runs earlier), so it is finalised here.
         ps%rho0 = ocean_state%eos%rho0

         nx = grid%nx_total
         ny = grid%ny_total
         call p_surf_configure(ps, nx, ny)

         if (compute_rank == 0) then
            call logger%info("Surface pressure: inverse-barometer PGF enabled "// &
                             "(eta_ib = -p_surf/(rho0*g_bt), rho0 = "// &
                             to_string(ps%rho0)//" kg/m^3)")
         end if
      end associate
   end subroutine configure_ocean_p_surf