redi_ppm_ave Function

private pure function redi_ppm_ave(xL, xR, aL, aR, aMean) result(av)

Mean of a PPM parabola between fractional positions xL,xR in [0,1] (MOM6 ppm_ave). Device-safe: dx<0 / dx>1 FATALs collapse to the dx==0 branch value (no host I/O on device).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: xL
real(kind=wp), intent(in) :: xR
real(kind=wp), intent(in) :: aL
real(kind=wp), intent(in) :: aR
real(kind=wp), intent(in) :: aMean

Return Value real(kind=wp)


Called by

proc~~redi_ppm_ave~~CalledByGraph proc~redi_ppm_ave redi_ppm_ave proc~redi_sublayer_dt redi_sublayer_dT proc~redi_sublayer_dt->proc~redi_ppm_ave proc~redi_face_flux redi_face_flux proc~redi_face_flux->proc~redi_sublayer_dt proc~redi_apply_flux_impl redi_apply_flux_impl proc~redi_apply_flux_impl->proc~redi_face_flux proc~redi_apply_flux redi_apply_flux proc~redi_apply_flux->proc~redi_apply_flux_impl proc~run_continuity_chain run_continuity_chain proc~run_continuity_chain->proc~redi_apply_flux

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: a6
real(kind=wp), private :: a6o3
real(kind=wp), private :: dx
real(kind=wp), private :: xave

Source Code

   pure function redi_ppm_ave(xL, xR, aL, aR, aMean) result(av)
      !$acc routine seq
      !! Mean of a PPM parabola between fractional positions xL,xR in [0,1]
      !! (MOM6 `ppm_ave`).  Device-safe: dx<0 / dx>1 FATALs collapse to the
      !! dx==0 branch value (no host I/O on device).
      real(wp), intent(in) :: xL, xR, aL, aR, aMean
      real(wp) :: av
      real(wp) :: dx, xave, a6, a6o3
      dx = xR - xL
      xave = 0.5_wp*(xR + xL)
      a6o3 = 2.0_wp*aMean - (aL + aR)
      a6 = 3.0_wp*a6o3
      if (dx > 0.0_wp .and. dx <= 1.0_wp) then
         av = (aL + xave*((aR - aL) + a6)) - a6o3*(xR*xR + xR*xL + xL*xL)
      else
         av = aL + (aR - aL)*xR + a6*xR*(1.0_wp - xR)
      end if
   end function redi_ppm_ave