bt_halo_auto_exclusion Subroutine

public pure subroutine bt_halo_auto_exclusion(cfg, excluded, reason)

Single source of truth for the BT march-in exclusion set (mirrors the explicit-bt_halo > 0 fail-loud checks in validate_config). Reports whether ANY exclusion is active and names the first one (for the AUTO resolution log). When none is active, reason is “”.

Arguments

Type IntentOptional Attributes Name
type(config_t), intent(in) :: cfg
logical, intent(out) :: excluded
character(len=:), intent(out), allocatable :: reason

Called by

proc~~bt_halo_auto_exclusion~~CalledByGraph proc~bt_halo_auto_exclusion bt_halo_auto_exclusion proc~engine_setup engine_setup proc~engine_setup->proc~bt_halo_auto_exclusion 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 subroutine bt_halo_auto_exclusion(cfg, excluded, reason)
      !! Single source of truth for the BT march-in exclusion set (mirrors the
      !! explicit-`bt_halo > 0` fail-loud checks in `validate_config`).  Reports
      !! whether ANY exclusion is active and names the first one (for the AUTO
      !! resolution log).  When none is active, `reason` is "".
      type(config_t), intent(in) :: cfg
      logical, intent(out) :: excluded
      character(len=:), allocatable, intent(out) :: reason
      reason = ""
      if (cfg%ocean%wetdry%enable) then
         reason = "wetdry enable"
      else if (cfg%ocean%bt%use_cont_type) then
         reason = "use_cont_type"
      else if (cfg%ocean%bt%upstream_h_face) then
         reason = "upstream_h_face"
      else if (cfg%ocean%tides%enable) then
         reason = "tides enable"
      else if (cfg%ocean%psurf%enable) then
         ! Surface-pressure loading rides the SAME `eta_forcing` seam as
         ! the body tide, and the wide BT clone carries no copy of it:
         ! `run_stage_split` `error stop`s on `bt_halo > 0` with an
         ! `eta_forcing` actual.  Must exclude alongside tides.
         reason = "psurf enable"
      else if (cfg%ocean%porous%enable) then
         reason = "porous enable"
      else if (cfg%ocean%cavity_dyn%enable) then
         ! The wide BT clone rebuilds `metrics_w` from the grid formula and
         ! carries no `z_draft`, so its reference depth would be the BED —
         ! it would solve a 1000 m ocean where the cavity has 500 m of
         ! water under 500 m of ice.  `validate_config` refuses an EXPLICIT
         ! `bt_halo > 0`; AUTO must resolve to 0 here or a multi-rank
         ! cavity run manufactures a width the user never asked for and
         ! then trips that abort.
         reason = "cavity_dyn enable"
      else if (trim(cfg%ocean%grid%grid_config) == "supergrid" .or. &
               trim(cfg%ocean%grid%grid_config) == "tripolar") then
         reason = "grid_config='"//trim(cfg%ocean%grid%grid_config)//"'"
      end if
      excluded = len_trim(reason) > 0
   end subroutine bt_halo_auto_exclusion