Run kappa-shear over the domain: fill this%kd_int (interface
diffusivity). Call at thermo cadence with the thermo dt.
Outer shim: dereferences the tracer-registry hTr arrays on the
host (the array-of-DT indirection blocks NVHPC device codegen),
then forwards to the column kernel. Velocities reach the
kernel as the C-grid face arrays, face-averaged to tracer
points inside (same source as the PP81 interior shear).
Vertex mode (at_vertex): solves the columns at C-grid corners
from the NATIVE face velocities (no centre average), then
averages the corner Kd back to tracer points — two kernels with
kd_corner as the required carrier. Needs the metrics wet
masks (halo-valid wet_T + face masks); fail-loud if absent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(hgrid_t), | intent(in) | :: | grid | |||
| type(ocean_kappa_shear_t), | intent(inout) | :: | this | |||
| type(multilayer_state_t), | intent(in) | :: | ms | |||
| real(kind=wp), | intent(in) | :: | dt | |||
| real(kind=wp), | intent(in), | optional | :: | wet_t(:,:) |
Halo-valid tracer-cell wet mask ( |
|
| real(kind=wp), | intent(in), | optional | :: | wet_u(:,:) |
u-face open mask ( |
|
| real(kind=wp), | intent(in), | optional | :: | wet_v(:,:) |
v-face open mask ( |
pure subroutine kappa_shear_compute(grid, this, ms, dt, wet_t, wet_u, wet_v) !! Run kappa-shear over the domain: fill `this%kd_int` (interface !! diffusivity). Call at thermo cadence with the thermo dt. !! Outer shim: dereferences the tracer-registry hTr arrays on the !! host (the array-of-DT indirection blocks NVHPC device codegen), !! then forwards to the column kernel. Velocities reach the !! kernel as the C-grid face arrays, face-averaged to tracer !! points inside (same source as the PP81 interior shear). !! !! Vertex mode (`at_vertex`): solves the columns at C-grid corners !! from the NATIVE face velocities (no centre average), then !! averages the corner Kd back to tracer points — two kernels with !! `kd_corner` as the required carrier. Needs the metrics wet !! masks (halo-valid `wet_T` + face masks); fail-loud if absent. type(hgrid_t), intent(in) :: grid type(ocean_kappa_shear_t), intent(inout) :: this type(multilayer_state_t), intent(in) :: ms real(wp), intent(in) :: dt ! assumed-shape-ok: host shim only — forwarded to the flat kernels ! as explicit-shape dummies; thermo cadence. real(wp), intent(in), optional :: wet_t(:, :) !! Halo-valid tracer-cell wet mask (`metrics%wet_T`), (nx,ny). real(wp), intent(in), optional :: wet_u(:, :) ! assumed-shape-ok: host shim; thermo cadence !! u-face open mask (`metrics%wet_u`), (nx+1,ny). real(wp), intent(in), optional :: wet_v(:, :) ! assumed-shape-ok: host shim; thermo cadence !! v-face open mask (`metrics%wet_v`), (nx,ny+1). if (ms%idx_temperature <= 0 .or. ms%idx_salinity <= 0) return if (this%at_vertex) then if (.not. (present(wet_t) .and. present(wet_u) .and. present(wet_v))) then error stop "kappa_shear_compute: at_vertex requires the wet_t/wet_u/wet_v masks" end if call kappa_shear_vertex_kernel(this, grid%nx_total, grid%ny_total, & ms%nz_ml, dt, & ms%h_layer, ms%u_face_x_layer, & ms%v_face_y_layer, & ms%tracers(ms%idx_temperature)%hTr, & ms%tracers(ms%idx_salinity)%hTr, & wet_t, wet_u, wet_v) call kappa_shear_vertex_scatter(grid%nx_total, grid%ny_total, & ms%nz_ml + 1, & this%vertex_geometric_mean, & this%vertex_geomean_kdmin, & wet_t, this%kd_corner, & this%kd_int, this%tke_int) else call kappa_shear_column_kernel(grid, this, ms, & ms%tracers(ms%idx_temperature)%hTr, & ms%tracers(ms%idx_salinity)%hTr, dt) end if end subroutine kappa_shear_compute