ocean_top_drag_compute_tendencies Subroutine

public pure subroutine ocean_top_drag_compute_tendencies(this, ms, dt)

Fill du_drag / dv_drag with the top-boundary drag acceleration, stress_top with the cell-centred stress magnitude, and (when implicit_fold) lambda_top_u/v with the k = k_top Rayleigh rate the vdiff diagonal consumes (the rate-capture row and the sink row MUST be the same row).

No-op (and no kernel launch) when the slot is disabled — the arrays are (1,1[,1]) placeholders then and must not be indexed. dt is read only in the implicit branch.

Arguments

Type IntentOptional Attributes Name
type(ocean_top_drag_t), intent(inout) :: this
type(multilayer_state_t), intent(in) :: ms
real(kind=wp), intent(in) :: dt

Outer-step length (s); only read when this%implicit.


Calls

proc~~ocean_top_drag_compute_tendencies~~CallsGraph proc~ocean_top_drag_compute_tendencies ocean_top_drag_compute_tendencies proc~top_drag_stress_mag_impl top_drag_stress_mag_impl proc~ocean_top_drag_compute_tendencies->proc~top_drag_stress_mag_impl proc~top_drag_tendencies_impl top_drag_tendencies_impl proc~ocean_top_drag_compute_tendencies->proc~top_drag_tendencies_impl local local proc~top_drag_stress_mag_impl->local proc~top_drag_tendencies_impl->local

Called by

proc~~ocean_top_drag_compute_tendencies~~CalledByGraph proc~ocean_top_drag_compute_tendencies ocean_top_drag_compute_tendencies proc~run_stage run_stage proc~run_stage->proc~ocean_top_drag_compute_tendencies proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_top_drag_compute_tendencies proc~ocean_dyn_step ocean_dyn_step proc~ocean_dyn_step->proc~run_stage 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 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
real(kind=wp), private :: dt_imp
integer, private :: nx
integer, private :: ny
integer, private :: nz
real(kind=wp), private :: tbl_min

Source Code

   pure subroutine ocean_top_drag_compute_tendencies(this, ms, dt)
      !! Fill `du_drag` / `dv_drag` with the top-boundary drag
      !! acceleration, `stress_top` with the cell-centred stress
      !! magnitude, and (when `implicit_fold`) `lambda_top_u/v` with the
      !! `k = k_top` Rayleigh rate the vdiff diagonal consumes (the
      !! rate-capture row and the sink row MUST be the same row).
      !!
      !! No-op (and no kernel launch) when the slot is disabled — the
      !! arrays are `(1,1[,1])` placeholders then and must not be indexed.
      !! `dt` is read only in the `implicit` branch.
      type(ocean_top_drag_t), intent(inout) :: this
      type(multilayer_state_t), intent(in) :: ms
      real(wp), intent(in) :: dt
         !! Outer-step length (s); only read when `this%implicit`.

      real(wp) :: tbl_min, dt_imp
      integer :: nx, ny, nz

      if (.not. this%enable) return

      nx = size(ms%h_layer, 1)
      ny = size(ms%h_layer, 2)
      nz = ms%nz_ml
      tbl_min = this%tbl_thick_min
      if (tbl_min <= 0.0_wp) tbl_min = this%h_min
      dt_imp = 0.0_wp
      if (this%implicit) dt_imp = dt

      call top_drag_tendencies_impl( &
         this%du_drag%data, this%dv_drag%data, &
         this%lambda_top_u, this%lambda_top_v, &
         ms%u_face_x_layer, ms%v_face_y_layer, ms%h_layer, ms%wet_mask, &
         this%cover_u, this%cover_v, ms%k_top_u, ms%k_top_v, H_VANISHED, &
         this%variant, this%r_linear, this%c_drag, this%h_min, &
         this%htbl, this%drag_bg_vel, tbl_min, dt_imp, this%implicit_fold, &
         size(ms%u_face_x_layer, 1), size(ms%u_face_x_layer, 2), &
         size(ms%v_face_y_layer, 1), size(ms%v_face_y_layer, 2), &
         nx, ny, nz)

      call top_drag_stress_mag_impl( &
         this%stress_top, ms%u_face_x_layer, ms%v_face_y_layer, &
         ms%h_layer, ms%wet_mask, this%cover_t, ms%k_top, H_VANISHED, &
         this%variant, this%r_linear, this%c_drag, this%h_min, &
         this%htbl, this%drag_bg_vel, tbl_min, this%rho0, &
         size(ms%u_face_x_layer, 1), size(ms%u_face_x_layer, 2), &
         size(ms%v_face_y_layer, 1), size(ms%v_face_y_layer, 2), &
         nx, ny, nz)
   end subroutine ocean_top_drag_compute_tendencies