Compute inter states (23*-states) from state1 and state4.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R_P), | intent(in) | :: | r1 | Density of state 1. |
||
real(kind=R_P), | intent(in) | :: | p1 | Pressure of state 1. |
||
real(kind=R_P), | intent(in) | :: | u1 | Velocity of state 1. |
||
real(kind=R_P), | intent(in) | :: | g1 | Specific heat ratio of state 1. |
||
real(kind=R_P), | intent(in) | :: | r4 | Density of state 4. |
||
real(kind=R_P), | intent(in) | :: | p4 | Pressure of state 4. |
||
real(kind=R_P), | intent(in) | :: | u4 | Velocity of state 4. |
||
real(kind=R_P), | intent(in) | :: | g4 | Specific heat ratio of state 4. |
||
real(kind=R_P), | intent(out) | :: | p | Pressure of the intermediate states. |
||
real(kind=R_P), | intent(out) | :: | S | Contact discontinuity signal velocity. |
||
real(kind=R_P), | intent(out) | :: | S1 | Left fastest signal velocity. |
||
real(kind=R_P), | intent(out) | :: | S4 | Right fastest signal velocity. |
pure subroutine compute_inter_states(r1, p1, u1, g1, r4, p4, u4, g4, p, S, S1, S4)
!------------------------------------------------------------------------------------------------------------------------------
!< Compute inter states (23*-states) from state1 and state4.
!------------------------------------------------------------------------------------------------------------------------------
real(R_P), intent(IN) :: r1 !< Density of state 1.
real(R_P), intent(IN) :: p1 !< Pressure of state 1.
real(R_P), intent(IN) :: u1 !< Velocity of state 1.
real(R_P), intent(IN) :: g1 !< Specific heat ratio of state 1.
real(R_P), intent(IN) :: r4 !< Density of state 4.
real(R_P), intent(IN) :: p4 !< Pressure of state 4.
real(R_P), intent(IN) :: u4 !< Velocity of state 4.
real(R_P), intent(IN) :: g4 !< Specific heat ratio of state 4.
real(R_P), intent(OUT) :: p !< Pressure of the intermediate states.
real(R_P), intent(OUT) :: S !< Contact discontinuity signal velocity.
real(R_P), intent(OUT) :: S1 !< Left fastest signal velocity.
real(R_P), intent(OUT) :: S4 !< Right fastest signal velocity.
real(R_P) :: a1 !< Speed of sound of state 1.
real(R_P) :: a4 !< Speed of sound of state 4.
real(R_P) :: ram !< Mean value of rho*a.
real(R_P), parameter :: toll=1e-10_R_P !< Tollerance.
!------------------------------------------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------------------------------------------
! evaluation of the intermediate states pressure and velocity
a1 = sqrt(g1 * p1 / r1) ! left speed of sound
a4 = sqrt(g4 * p4 / r4) ! right speed of sound
ram = 0.5_R_P * (r1 + r4) * 0.5_R_P * (a1 + a4) ! product of mean density for mean speed of sound
S = 0.5_R_P * (u1 + u4) - 0.5_R_P * (p4 - p1) / ram ! evaluation of the contact wave speed (velocity of intermediate states)
p = 0.5_R_P * (p1 + p4) - 0.5_R_P * (u4 - u1) * ram ! evaluation of the pressure of the intermediate states
! evaluation of the left wave speeds
if (p<=p1*(1._R_P + toll)) then
! rarefaction
S1 = u1 - a1
else
! shock
S1 = u1 - a1 * sqrt(1._R_P + (g1 + 1._R_P) / (2._R_P * g1) * (p / p1 - 1._R_P))
endif
! evaluation of the right wave speeds
if (p<=p4 * (1._R_P + toll)) then
! rarefaction
S4 = u4 + a4
else
! shock
S4 = u4 + a4 * sqrt(1._R_P + (g4 + 1._R_P) / (2._R_P * g4) * ( p / p4 - 1._R_P))
endif
return
!------------------------------------------------------------------------------------------------------------------------------
endsubroutine compute_inter_states