pgf_nonoverlap_gate_on Function

public pure function pgf_nonoverlap_gate_on(cfg, variant) result(on)

Uses

  • proc~~pgf_nonoverlap_gate_on~~UsesGraph proc~pgf_nonoverlap_gate_on pgf_nonoverlap_gate_on module~rdb_constants rdb_constants proc~pgf_nonoverlap_gate_on->module~rdb_constants pic_types pic_types module~rdb_constants->pic_types

Single source of truth for “is the grounded-layer PGF gate armed?” (&ocean_isopycnal_nml pgf_skip_nonoverlap → ocean_pressure_force_t%skip_nonoverlap).

Two call sites must agree BEFORE any array is allocated: ocean_state_init_from_config latches the answer so the PGF slot’s allocation gate can decide whether FV_MOM6 needs z_centre (it is read by nothing else on that path), and configure_ocean_pgf re-evaluates it after the full config pass and fails loud if the two disagree. Keeping the predicate in one place is what makes that guard meaningful.

ONLY under VCOORD_LAGRANGIAN: that is the coordinate where layers wedge out against the bed onto the angstrom_h floor while staying massive one cell away, which is what makes the face PGF ill-posed and leaves a spurious gradient AT REST. gprime differences interface positions directly (no layer-centre Jacobian, no z_centre buffer), so it is the one variant excluded here — configure_ocean_pgf warns for it. mont IS covered: the Montgomery potential is exact at rest wherever a layer is present on both sides of the face, but a grounded layer sits at the bed on one side and at its flat-isopycnal height on the other, so M stops being horizontally uniform and the residual returns.

Arguments

Type IntentOptional Attributes Name
type(config_t), intent(in) :: cfg
integer, intent(in) :: variant

OPGF_VARIANT_* code (already parsed from cfg%ocean%pgf%form).

Return Value logical


Calls

proc~~pgf_nonoverlap_gate_on~~CallsGraph proc~pgf_nonoverlap_gate_on pgf_nonoverlap_gate_on proc~parse_ocean_vcoord_type parse_ocean_vcoord_type proc~pgf_nonoverlap_gate_on->proc~parse_ocean_vcoord_type proc~parse_vcoord_type parse_vcoord_type proc~parse_ocean_vcoord_type->proc~parse_vcoord_type

Called by

proc~~pgf_nonoverlap_gate_on~~CalledByGraph proc~pgf_nonoverlap_gate_on pgf_nonoverlap_gate_on proc~configure_ocean_pgf configure_ocean_pgf proc~configure_ocean_pgf->proc~pgf_nonoverlap_gate_on proc~ocean_state_init_from_config ocean_state_t%ocean_state_init_from_config proc~ocean_state_init_from_config->proc~pgf_nonoverlap_gate_on proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_pgf proc~engine_setup->proc~ocean_state_init_from_config 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

   pure function pgf_nonoverlap_gate_on(cfg, variant) result(on)
      !! Single source of truth for "is the grounded-layer PGF gate armed?"
      !! (`&ocean_isopycnal_nml pgf_skip_nonoverlap` →
      !! `ocean_pressure_force_t%skip_nonoverlap`).
      !!
      !! Two call sites must agree BEFORE any array is allocated:
      !! `ocean_state_init_from_config` latches the answer so the PGF
      !! slot's allocation gate can decide whether FV_MOM6 needs `z_centre`
      !! (it is read by nothing else on that path), and `configure_ocean_pgf`
      !! re-evaluates it after the full config pass and fails loud if the two
      !! disagree.  Keeping the predicate in one place is what makes that
      !! guard meaningful.
      !!
      !! ONLY under `VCOORD_LAGRANGIAN`: that is the coordinate where layers
      !! wedge out against the bed onto the `angstrom_h` floor while staying
      !! massive one cell away, which is what makes the face PGF ill-posed and
      !! leaves a spurious gradient AT REST.  `gprime` differences interface
      !! positions directly (no layer-centre Jacobian, no `z_centre` buffer),
      !! so it is the one variant excluded here — `configure_ocean_pgf` warns
      !! for it.  `mont` IS covered: the Montgomery potential is exact at rest
      !! wherever a layer is present on both sides of the face, but a grounded
      !! layer sits at the bed on one side and at its flat-isopycnal height on
      !! the other, so `M` stops being horizontally uniform and the residual
      !! returns.
      use rdb_constants, only: VCOORD_LAGRANGIAN
      type(config_t), intent(in) :: cfg
      integer, intent(in) :: variant
         !! `OPGF_VARIANT_*` code (already parsed from `cfg%ocean%pgf%form`).
      logical :: on
      on = cfg%ocean%isopycnal%pgf_skip_nonoverlap .and. &
           parse_ocean_vcoord_type(cfg%vcoord_type) == VCOORD_LAGRANGIAN .and. &
           (variant == OPGF_VARIANT_MONT .or. &
            variant == OPGF_VARIANT_FV_LITE .or. &
            variant == OPGF_VARIANT_FV_WRIGHT .or. &
            variant == OPGF_VARIANT_FV_MOM6)
   end function pgf_nonoverlap_gate_on