Fold the kappa-shear diffusivity into the vmix interface
fields, ADDITIVELY (MOM6 interior-diffusivity semantics).
Called EVERY stage (the interior closure rewrites kv/kt each
stage; kd_int itself refreshes at thermo cadence). Interior
interfaces only — K=1 (bed) and K=nz+1 (surface) stay zero in
both source and target.
Vertex mode (at_vertex): the CELL-CENTRED kv add is
suppressed (kv_fac = 0) — the shear viscosity instead reaches
the momentum solve as the corner field kd_corner, routed
corner→face inside vdiff_apply_momentum
(kv_corner_source), never via a tracer point. Adding it
here too would double-count (the reference implementation
zeroes the tracer-point Kv_shear when the vertex form is
selected, for exactly this reason). kt still receives the
Pass-C tracer-point kd_int in both modes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_kappa_shear_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | nx |
Interface-field extents (explicit shape: assumed-shape
dummies in a |
||
| integer, | intent(in) | :: | ny |
Interface-field extents (explicit shape: assumed-shape
dummies in a |
||
| integer, | intent(in) | :: | nzp1 |
Interface-field extents (explicit shape: assumed-shape
dummies in a |
||
| real(kind=wp), | intent(inout) | :: | kv(nx,ny,nzp1) |
Momentum viscosity at interfaces; gets prandtl_turb*kd (column mode) or nothing (vertex mode — see above). |
||
| real(kind=wp), | intent(inout) | :: | kt(nx,ny,nzp1) |
Tracer diffusivity at interfaces; gets kd. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| integer, | private | :: | j | ||||
| integer, | private | :: | k | ||||
| real(kind=wp), | private | :: | kv_fac |
pure subroutine kappa_shear_merge_into_kv_kt(this, nx, ny, nzp1, kv, kt) !! Fold the kappa-shear diffusivity into the vmix interface !! fields, ADDITIVELY (MOM6 interior-diffusivity semantics). !! Called EVERY stage (the interior closure rewrites kv/kt each !! stage; `kd_int` itself refreshes at thermo cadence). Interior !! interfaces only — K=1 (bed) and K=nz+1 (surface) stay zero in !! both source and target. !! !! Vertex mode (`at_vertex`): the CELL-CENTRED kv add is !! suppressed (kv_fac = 0) — the shear viscosity instead reaches !! the momentum solve as the corner field `kd_corner`, routed !! corner→face inside `vdiff_apply_momentum` !! (`kv_corner_source`), never via a tracer point. Adding it !! here too would double-count (the reference implementation !! zeroes the tracer-point `Kv_shear` when the vertex form is !! selected, for exactly this reason). `kt` still receives the !! Pass-C tracer-point `kd_int` in both modes. type(ocean_kappa_shear_t), intent(in) :: this integer, intent(in) :: nx, ny, nzp1 !! Interface-field extents (explicit shape: assumed-shape !! dummies in a `do concurrent` kernel make NVHPC walk the !! descriptor with per-launch memcpys — this runs every stage). real(wp), intent(inout) :: kv(nx, ny, nzp1) !! Momentum viscosity at interfaces; gets prandtl_turb*kd !! (column mode) or nothing (vertex mode — see above). real(wp), intent(inout) :: kt(nx, ny, nzp1) !! Tracer diffusivity at interfaces; gets kd. integer :: i, j, k real(wp) :: kv_fac ! Host-hoisted scalar (bit-identical in column mode: kv_fac IS ! prandtl_turb, same multiply). kv_fac = this%prandtl_turb if (this%at_vertex) kv_fac = 0.0_wp do concurrent(k=2:nzp1 - 1, j=1:ny, i=1:nx) kt(i, j, k) = kt(i, j, k) + this%kd_int(i, j, k) kv(i, j, k) = kv(i, j, k) + kv_fac*this%kd_int(i, j, k) end do end subroutine kappa_shear_merge_into_kv_kt