meke_source Subroutine

private pure subroutine meke_source(nx, ny, bgsrc, gmcoeff, frcoeff, sdt, i_mass, gm_src, ke_diss, src, meke)

Aggregate source src = bgsrc + gmcoeff*I_mass*gm_src - frcoeff*I_mass*ke_diss and the explicit bump E += sdt*src. gmcoeff<0 ⇒ GM source off; frcoeff<0 ⇒ frictional source off. ke_diss is the lateral-viscosity KE dissipation rate (≤0), so -frcoeff*I_mass*ke_diss ≥ 0 is a mean→eddy source (0 ⇒ inert).

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nx
integer, intent(in) :: ny
real(kind=wp), intent(in) :: bgsrc
real(kind=wp), intent(in) :: gmcoeff
real(kind=wp), intent(in) :: frcoeff
real(kind=wp), intent(in) :: sdt
real(kind=wp), intent(in) :: i_mass(nx,ny)
real(kind=wp), intent(in) :: gm_src(nx,ny)
real(kind=wp), intent(in) :: ke_diss(nx,ny)
real(kind=wp), intent(inout) :: src(nx,ny)
real(kind=wp), intent(inout) :: meke(nx,ny)

Calls

proc~~meke_source~~CallsGraph proc~meke_source meke_source local local proc~meke_source->local

Called by

proc~~meke_source~~CalledByGraph proc~meke_source meke_source proc~meke_step meke_step proc~meke_step->proc~meke_source proc~run_meke_step run_meke_step proc~run_meke_step->proc~meke_step proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_meke_step proc~engine_step engine_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

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
real(kind=wp), private :: s

Source Code

   pure subroutine meke_source(nx, ny, bgsrc, gmcoeff, frcoeff, sdt, i_mass, &
                               gm_src, ke_diss, src, meke)
      !! Aggregate source `src = bgsrc + gmcoeff*I_mass*gm_src
      !! - frcoeff*I_mass*ke_diss` and the explicit bump `E += sdt*src`.
      !! `gmcoeff<0` ⇒ GM source off; `frcoeff<0` ⇒ frictional source off.
      !! `ke_diss` is the lateral-viscosity KE dissipation rate (≤0), so
      !! `-frcoeff*I_mass*ke_diss ≥ 0` is a mean→eddy source (0 ⇒ inert).
      integer, intent(in) :: nx, ny
      real(wp), intent(in) :: bgsrc, gmcoeff, frcoeff, sdt
      real(wp), intent(in) :: i_mass(nx, ny)
      real(wp), intent(in) :: gm_src(nx, ny)
      real(wp), intent(in) :: ke_diss(nx, ny)
      real(wp), intent(inout) :: src(nx, ny)
      real(wp), intent(inout) :: meke(nx, ny)
      integer :: i, j
      real(wp) :: s

      do concurrent(j=1:ny, i=1:nx) local(s)
         s = bgsrc
         if (gmcoeff >= 0.0_wp) s = s + gmcoeff*i_mass(i, j)*gm_src(i, j)
         if (frcoeff >= 0.0_wp) s = s - frcoeff*i_mass(i, j)*ke_diss(i, j)
         src(i, j) = s
         meke(i, j) = meke(i, j) + sdt*s
      end do
   end subroutine meke_source