ocean_horizontal_viscosity_compute_ke_diss Subroutine

public subroutine ocean_horizontal_viscosity_compute_ke_diss(this, ms)

Fill this%ke_diss with the lateral-viscosity KE dissipation rate Σ_k ρ_k h_k (u·du_visc + v·dv_visc) at T-cell centres (kg/s³; ≤0 where the viscosity removes KE). MUST run AFTER compute_tendencies (du_visc fresh) and BEFORE the viscous apply, while u_face/v_face still hold the velocity the viscosity acted on. No-op (and bit-identical) unless compute_ke_diss is set and the density field is live. Feeds the MEKE frictional source.

Arguments

Type IntentOptional Attributes Name
type(ocean_horizontal_viscosity_t), intent(inout) :: this
type(multilayer_state_t), intent(in) :: ms

Calls

proc~~ocean_horizontal_viscosity_compute_ke_diss~~CallsGraph proc~ocean_horizontal_viscosity_compute_ke_diss ocean_horizontal_viscosity_compute_ke_diss proc~hvisc_ke_diss_impl hvisc_ke_diss_impl proc~ocean_horizontal_viscosity_compute_ke_diss->proc~hvisc_ke_diss_impl local local proc~hvisc_ke_diss_impl->local

Called by

proc~~ocean_horizontal_viscosity_compute_ke_diss~~CalledByGraph proc~ocean_horizontal_viscosity_compute_ke_diss ocean_horizontal_viscosity_compute_ke_diss proc~run_stage run_stage proc~run_stage->proc~ocean_horizontal_viscosity_compute_ke_diss proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_horizontal_viscosity_compute_ke_diss 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
integer, private :: nx
integer, private :: ny
integer, private :: nz

Source Code

   subroutine ocean_horizontal_viscosity_compute_ke_diss(this, ms)
      !! Fill `this%ke_diss` with the lateral-viscosity KE dissipation rate
      !! `Σ_k ρ_k h_k (u·du_visc + v·dv_visc)` at T-cell centres (kg/s³; ≤0
      !! where the viscosity removes KE).  MUST run AFTER
      !! `compute_tendencies` (du_visc fresh) and BEFORE the viscous apply,
      !! while `u_face`/`v_face` still hold the velocity the viscosity acted
      !! on.  No-op (and bit-identical) unless `compute_ke_diss` is set and
      !! the density field is live.  Feeds the MEKE frictional source.
      type(ocean_horizontal_viscosity_t), intent(inout) :: this
      type(multilayer_state_t), intent(in) :: ms
      integer :: nx, ny, nz
      if (.not. this%compute_ke_diss) return
      if (.not. allocated(ms%rho_layer)) return
      nx = size(ms%u_face_x_layer, 1) - 1
      ny = size(ms%v_face_y_layer, 2) - 1
      nz = ms%nz_ml
      call hvisc_ke_diss_impl(nx, ny, nz, ms%u_face_x_layer, ms%v_face_y_layer, &
                              this%du_visc%data, this%dv_visc%data, &
                              ms%rho_layer, ms%h_layer, this%ke_diss)
   end subroutine ocean_horizontal_viscosity_compute_ke_diss