Local Lax-Friedrichs (Rusanov) Riemann flux. Provided as a fallback; the model overrides BoundaryFlux directly with the LMARS solver.
F = 0.5(fL.n + fR.n) - 0.5lambda_max(sR - sL)
where lambda_max = max(|vL.n| + cL, |vR.n| + cR) and c = sqrt(gamma * p / rho) is the sound speed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ESAtmo2D_t), | intent(in) | :: | this | |||
| real(kind=prec), | intent(in) | :: | sL(1:this%nvar) | |||
| real(kind=prec), | intent(in) | :: | sR(1:this%nvar) | |||
| real(kind=prec), | intent(in) | :: | dsdx(1:this%nvar,1:2) | |||
| real(kind=prec), | intent(in) | :: | nhat(1:2) |
pure function riemannflux2d_ESAtmo2D_t(this,sL,sR,dsdx,nhat) result(flux)
!! Local Lax-Friedrichs (Rusanov) Riemann flux. Provided as a fallback;
!! the model overrides BoundaryFlux directly with the LMARS solver.
!!
!! F* = 0.5*(fL.n + fR.n) - 0.5*lambda_max*(sR - sL)
!!
!! where lambda_max = max(|vL.n| + cL, |vR.n| + cR)
!! and c = sqrt(gamma * p / rho) is the sound speed.
class(ESAtmo2D_t),intent(in) :: this
real(prec),intent(in) :: sL(1:this%nvar)
real(prec),intent(in) :: sR(1:this%nvar)
real(prec),intent(in) :: dsdx(1:this%nvar,1:2)
real(prec),intent(in) :: nhat(1:2)
real(prec) :: flux(1:this%nvar)
! Local
real(prec) :: rhoL,uL,vL,thetaL,pL,unL,cL
real(prec) :: rhoR,uR,vR,thetaR,pR,unR,cR
real(prec) :: fL(1:4),fR(1:4)
real(prec) :: gamma,lam
gamma = this%cp/this%cv
! Left state
rhoL = sL(1)
uL = sL(2)/rhoL
vL = sL(3)/rhoL
thetaL = sL(4)/rhoL
pL = this%p0*(rhoL*this%Rd*thetaL/this%p0)**gamma
unL = uL*nhat(1)+vL*nhat(2)
cL = sqrt(gamma*pL/rhoL)
! Right state
rhoR = sR(1)
uR = sR(2)/rhoR
vR = sR(3)/rhoR
thetaR = sR(4)/rhoR
pR = this%p0*(rhoR*this%Rd*thetaR/this%p0)**gamma
unR = uR*nhat(1)+vR*nhat(2)
cR = sqrt(gamma*pR/rhoR)
! Normal flux from left state
fL(1) = rhoL*unL
fL(2) = sL(2)*unL+pL*nhat(1)
fL(3) = sL(3)*unL+pL*nhat(2)
fL(4) = sL(4)*unL
! Normal flux from right state
fR(1) = rhoR*unR
fR(2) = sR(2)*unR+pR*nhat(1)
fR(3) = sR(3)*unR+pR*nhat(2)
fR(4) = sR(4)*unR
! Maximum wave speed
lam = max(abs(unL)+cL,abs(unR)+cR)
! LLF flux
flux(1:4) = 0.5_prec*(fL(1:4)+fR(1:4))- &
0.5_prec*lam*(sR(1:4)-sL(1:4))
! Geopotential is carried in the state vector but has no flux.
flux(5) = 0.0_prec
if(.false.) flux(1) = flux(1)+dsdx(1,1) ! suppress unused-dummy-argument warning
endfunction riemannflux2d_ESAtmo2D_t