redi_calc_coeffs_x Subroutine

private subroutine redi_calc_coeffs_x(nx, ny, nz, ns, eos, h_layer, t_htr, s_htr, wet_u, uKb, uKt, uPoL, uPoR, uKoL, uKoR, uhEff)

Flat-impl Phase-A u-face kernel. Parallel over (i,j) interior u-faces (i=2..nx); the 2*nz+2 sweep runs serially inside each thread over a column pair (iw=i-1 west, i east). Wall faces and land faces leave the inert (zero/identity) coefficients. The sweep runs on each face’s open window uKb..uKt (1..nz off the z-level closed-face path; module header); a face with no open layer (uKt < uKb) is inert.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nx
integer, intent(in) :: ny
integer, intent(in) :: nz
integer, intent(in) :: ns
type(eos_t), intent(in) :: eos
real(kind=wp), intent(in) :: h_layer(nx,ny,nz)
real(kind=wp), intent(in) :: t_htr(nx,ny,nz)
real(kind=wp), intent(in) :: s_htr(nx,ny,nz)
real(kind=wp), intent(in) :: wet_u(nx+1,ny)
integer, intent(in) :: uKb(nx+1,ny)

Per-face open window (native layers).

integer, intent(in) :: uKt(nx+1,ny)

Per-face open window (native layers).

real(kind=wp), intent(out) :: uPoL(nx+1,ny,ns)
real(kind=wp), intent(out) :: uPoR(nx+1,ny,ns)
integer, intent(out) :: uKoL(nx+1,ny,ns)
integer, intent(out) :: uKoR(nx+1,ny,ns)
real(kind=wp), intent(out) :: uhEff(nx+1,ny,ns-1)

Calls

proc~~redi_calc_coeffs_x~~CallsGraph proc~redi_calc_coeffs_x redi_calc_coeffs_x local local proc~redi_calc_coeffs_x->local proc~redi_face_coeffs redi_face_coeffs proc~redi_calc_coeffs_x->proc~redi_face_coeffs proc~redi_build_column redi_build_column proc~redi_face_coeffs->proc~redi_build_column proc~redi_neutral_positions_continuous redi_neutral_positions_continuous proc~redi_face_coeffs->proc~redi_neutral_positions_continuous proc~eos_density_specvol_derivs eos_density_specvol_derivs proc~redi_build_column->proc~eos_density_specvol_derivs proc~redi_interface_scalar redi_interface_scalar proc~redi_build_column->proc~redi_interface_scalar rdb_vl_column_conc rdb_vl_column_conc proc~redi_build_column->rdb_vl_column_conc proc~redi_absolute_position redi_absolute_position proc~redi_neutral_positions_continuous->proc~redi_absolute_position proc~redi_interpolate_position redi_interpolate_position proc~redi_neutral_positions_continuous->proc~redi_interpolate_position proc~roquet_spv_point roquet_spv_point proc~eos_density_specvol_derivs->proc~roquet_spv_point proc~redi_plm_diff redi_plm_diff proc~redi_interface_scalar->proc~redi_plm_diff proc~redi_ppm_edge redi_ppm_edge proc~redi_interface_scalar->proc~redi_ppm_edge proc~redi_fv_diff redi_fv_diff proc~redi_plm_diff->proc~redi_fv_diff proc~redi_signum redi_signum proc~redi_plm_diff->proc~redi_signum

Called by

proc~~redi_calc_coeffs_x~~CalledByGraph proc~redi_calc_coeffs_x redi_calc_coeffs_x proc~redi_calc_coeffs redi_calc_coeffs proc~redi_calc_coeffs->proc~redi_calc_coeffs_x proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~redi_calc_coeffs 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 proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
integer, private :: KoLc(2*NZ_STACK_MAX+2)
integer, private :: KoRc(2*NZ_STACK_MAX+2)
real(kind=wp), private :: PoLc(2*NZ_STACK_MAX+2)
real(kind=wp), private :: PoRc(2*NZ_STACK_MAX+2)
real(kind=wp), private :: hEc(2*NZ_STACK_MAX+1)
real(kind=wp), private :: hL(NZ_STACK_MAX)
real(kind=wp), private :: hR(NZ_STACK_MAX)
integer, private :: i
integer, private :: j
integer, private :: k
integer, private :: kb
integer, private :: kt
integer, private :: s
real(kind=wp), private :: scL(NZ_STACK_MAX)
real(kind=wp), private :: scR(NZ_STACK_MAX)
real(kind=wp), private :: tcL(NZ_STACK_MAX)
real(kind=wp), private :: tcR(NZ_STACK_MAX)

Source Code

   subroutine redi_calc_coeffs_x(nx, ny, nz, ns, eos, h_layer, &
                                 t_htr, s_htr, wet_u, uKb, uKt, &
                                 uPoL, uPoR, uKoL, uKoR, uhEff)
      !! Flat-impl Phase-A u-face kernel.  Parallel over (i,j) interior
      !! u-faces (i=2..nx); the 2*nz+2 sweep runs serially inside each
      !! thread over a column pair (iw=i-1 west, i east).  Wall faces and
      !! land faces leave the inert (zero/identity) coefficients.  The
      !! sweep runs on each face's open window `uKb..uKt` (`1..nz` off the
      !! z-level closed-face path; module header); a face with no open
      !! layer (`uKt < uKb`) is inert.
      integer, intent(in) :: nx, ny, nz, ns
      type(eos_t), intent(in) :: eos
      real(wp), intent(in) :: h_layer(nx, ny, nz)
      real(wp), intent(in) :: t_htr(nx, ny, nz)
      real(wp), intent(in) :: s_htr(nx, ny, nz)
      real(wp), intent(in) :: wet_u(nx + 1, ny)
      integer, intent(in) :: uKb(nx + 1, ny), uKt(nx + 1, ny)
         !! Per-face open window (native layers).
      real(wp), intent(out) :: uPoL(nx + 1, ny, ns)
      real(wp), intent(out) :: uPoR(nx + 1, ny, ns)
      integer, intent(out) :: uKoL(nx + 1, ny, ns)
      integer, intent(out) :: uKoR(nx + 1, ny, ns)
      real(wp), intent(out) :: uhEff(nx + 1, ny, ns - 1)

      integer :: i, j, k, s, kb, kt
      real(wp) :: hL(NZ_STACK_MAX), tcL(NZ_STACK_MAX), scL(NZ_STACK_MAX)
      real(wp) :: hR(NZ_STACK_MAX), tcR(NZ_STACK_MAX), scR(NZ_STACK_MAX)
      real(wp) :: PoLc(2*NZ_STACK_MAX + 2), PoRc(2*NZ_STACK_MAX + 2)
      integer :: KoLc(2*NZ_STACK_MAX + 2), KoRc(2*NZ_STACK_MAX + 2)
      real(wp) :: hEc(2*NZ_STACK_MAX + 1)

      do concurrent(j=1:ny, i=2:nx) &
         local(k, s, kb, kt, hL, tcL, scL, hR, tcR, scR, PoLc, PoRc, KoLc, KoRc, hEc)
         do s = 1, ns
            uPoL(i, j, s) = 0.0_wp
            uPoR(i, j, s) = 0.0_wp
            uKoL(i, j, s) = 1
            uKoR(i, j, s) = 1
         end do
         do s = 1, ns - 1
            uhEff(i, j, s) = 0.0_wp
         end do
         kb = uKb(i, j)
         kt = uKt(i, j)
         if (wet_u(i, j) > 0.0_wp .and. kt >= kb) then
            do k = 1, nz
               hL(k) = h_layer(i - 1, j, k)
               tcL(k) = t_htr(i - 1, j, k)
               scL(k) = s_htr(i - 1, j, k)
               hR(k) = h_layer(i, j, k)
               tcR(k) = t_htr(i, j, k)
               scR(k) = s_htr(i, j, k)
            end do
            call redi_face_coeffs(nz, ns, kb, kt, hL, tcL, scL, hR, tcR, scR, eos, &
                                  PoLc, PoRc, KoLc, KoRc, hEc)
            do s = 1, ns
               uPoL(i, j, s) = PoLc(s)
               uPoR(i, j, s) = PoRc(s)
               uKoL(i, j, s) = KoLc(s)
               uKoR(i, j, s) = KoRc(s)
            end do
            do s = 1, ns - 1
               uhEff(i, j, s) = hEc(s)
            end do
         end if
      end do
   end subroutine redi_calc_coeffs_x