reset_bt_rem Subroutine

public pure subroutine reset_bt_rem(grid, bt_work)

bt_rem_u/v ≡ 1 (the init value). bt_rem_u/v is otherwise reset only by compute_bt_rem, which only runs when bt_substep_drag is on. compute_bt_rem_wave_drag MULTIPLIES into bt_rem_u/v, so when wave drag is on and bt_substep_drag is off, something must still reset it to 1 each stage — otherwise it compounds geometrically across outer steps (bt_rem = R^n after n stages), silently annihilating the barotropic mode. See src/core/ocean/README.md for the multiplicative-accumulator contract this establishes.

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(barotropic_workstate_t), intent(inout) :: bt_work

Called by

proc~~reset_bt_rem~~CalledByGraph proc~reset_bt_rem reset_bt_rem proc~run_stage_split run_stage_split proc~run_stage_split->proc~reset_bt_rem proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_stage_split proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step_split proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
integer, private :: nx
integer, private :: ny

Source Code

   pure subroutine reset_bt_rem(grid, bt_work)
      !! bt_rem_u/v ≡ 1 (the init value). `bt_rem_u/v` is otherwise reset
      !! only by `compute_bt_rem`, which only runs when `bt_substep_drag`
      !! is on. `compute_bt_rem_wave_drag` MULTIPLIES into `bt_rem_u/v`,
      !! so when wave drag is on and `bt_substep_drag` is off, something
      !! must still reset it to 1 each stage — otherwise it compounds
      !! geometrically across outer steps (bt_rem = R^n after n stages),
      !! silently annihilating the barotropic mode. See
      !! `src/core/ocean/README.md` for the multiplicative-accumulator
      !! contract this establishes.
      type(hgrid_t), intent(in) :: grid
      type(barotropic_workstate_t), intent(inout) :: bt_work
      integer :: i, j, nx, ny

      nx = grid%nx_total
      ny = grid%ny_total
      do concurrent(j=1:ny, i=1:nx + 1)
         bt_work%bt_rem_u(i, j) = 1.0_wp
      end do
      do concurrent(j=1:ny + 1, i=1:nx)
         bt_work%bt_rem_v(i, j) = 1.0_wp
      end do
   end subroutine reset_bt_rem