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 | Intent | Optional | 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 |
| 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 |
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