Solve the Riemann problem between the state $1$ and $4$ using the (local) Lax Friedrichs (Rusanov) solver.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(euler_1D), | intent(in) | :: | self | Euler field. |
||
real(kind=R_P), | intent(in) | :: | p1 | Pressure of state 1. |
||
real(kind=R_P), | intent(in) | :: | r1 | Density of state 1. |
||
real(kind=R_P), | intent(in) | :: | u1 | Velocity of state 1. |
||
real(kind=R_P), | intent(in) | :: | g1 | Specific heats ratio of state 1. |
||
real(kind=R_P), | intent(in) | :: | p4 | Pressure of state 4. |
||
real(kind=R_P), | intent(in) | :: | r4 | Density of state 4. |
||
real(kind=R_P), | intent(in) | :: | u4 | Velocity of state 4. |
||
real(kind=R_P), | intent(in) | :: | g4 | Specific heats ratio of state 4. |
||
real(kind=R_P), | intent(out) | :: | F(1:self%Nc) | Resulting fluxes. |
pure subroutine riemann_solver(self, p1, r1, u1, g1, p4, r4, u4, g4, F)
!---------------------------------------------------------------------------------------------------------------------------------
!< Solve the Riemann problem between the state $1$ and $4$ using the (local) Lax Friedrichs (Rusanov) solver.
!---------------------------------------------------------------------------------------------------------------------------------
class(euler_1D), intent(IN) :: self !< Euler field.
real(R_P), intent(IN) :: p1 !< Pressure of state 1.
real(R_P), intent(IN) :: r1 !< Density of state 1.
real(R_P), intent(IN) :: u1 !< Velocity of state 1.
real(R_P), intent(IN) :: g1 !< Specific heats ratio of state 1.
real(R_P), intent(IN) :: p4 !< Pressure of state 4.
real(R_P), intent(IN) :: r4 !< Density of state 4.
real(R_P), intent(IN) :: u4 !< Velocity of state 4.
real(R_P), intent(IN) :: g4 !< Specific heats ratio of state 4.
real(R_P), intent(OUT) :: F(1:self%Nc) !< Resulting fluxes.
real(R_P) :: F1(1:3) !< State 1 fluxes.
real(R_P) :: F4(1:3) !< State 4 fluxes.
real(R_P) :: u !< Velocity of the intermediate states.
real(R_P) :: p !< Pressure of the intermediate states.
real(R_P) :: S1 !< Maximum wave speed of state 1 and 4.
real(R_P) :: S4 !< Maximum wave speed of state 1 and 4.
real(R_P) :: lmax !< Maximum wave speed estimation.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
! evaluating the intermediates states 2 and 3 from the known states U1,U4 using the PVRS approximation
call compute_inter_states(p1 = p1, r1 = r1, u1 = u1, g1 = g1, p4 = p4, r4 = r4, u4 = u4, g4 = g4, p = p, S = u, S1 = S1, S4 = S4)
! evalutaing the maximum waves speed
lmax = max(abs(S1), abs(u), abs(S4))
! computing the fluxes of state 1 and 4
F1 = fluxes(p = p1, r = r1, u = u1, g = g1)
F4 = fluxes(p = p4, r = r4, u = u4, g = g4)
! computing the Lax-Friedrichs fluxes approximation
F(1) = 0.5_R_P*(F1(1) + F4(1) - lmax*(r4 - r1 ))
F(self%Ns+1) = 0.5_R_P*(F1(2) + F4(2) - lmax*(r4*u4 - r1*u1 ))
F(self%Ns+2) = 0.5_R_P*(F1(3) + F4(3) - lmax*(r4*E(p=p4,r=r4,u=u4,g=g4) - r1*E(p=p1,r=r1,u=u1,g=g1)))
return
!---------------------------------------------------------------------------------------------------------------------------------
contains
pure function fluxes(p, r, u, g) result(Fc)
!-------------------------------------------------------------------------------------------------------------------------------
!< 1D Euler fluxes from primitive variables.
!-------------------------------------------------------------------------------------------------------------------------------
real(R_P), intent(IN) :: p !< Pressure.
real(R_P), intent(IN) :: r !< Density.
real(R_P), intent(IN) :: u !< Velocity.
real(R_P), intent(IN) :: g !< Specific heats ratio.
real(R_P) :: Fc(1:3) !< State fluxes.
!-------------------------------------------------------------------------------------------------------------------------------
!-------------------------------------------------------------------------------------------------------------------------------
Fc(1) = r*u
Fc(2) = Fc(1)*u + p
Fc(3) = Fc(1)*H(p=p, r=r, u=u, g=g)
return
!-------------------------------------------------------------------------------------------------------------------------------
endfunction fluxes
endsubroutine riemann_solver