Convert primitive variables to conservative variables.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(euler_1D_omp_nf), | intent(in) | :: | self | Euler field. |
||
real(kind=R_P), | intent(in) | :: | primitive(:) | Primitive variables. |
Conservative variables.
pure function primitive2conservative(self, primitive) result(conservative)
!---------------------------------------------------------------------------------------------------------------------------------
!< Convert primitive variables to conservative variables.
!---------------------------------------------------------------------------------------------------------------------------------
class(euler_1D_omp_nf), intent(IN) :: self !< Euler field.
real(R_P), intent(IN) :: primitive(:) !< Primitive variables.
real(R_P) :: conservative(1:self%Nc) !< Conservative variables.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
associate(Ns=>self%Ns)
conservative(1:Ns) = primitive(1:Ns)
conservative(Ns + 1) = primitive(Ns + 3) * primitive(Ns + 1)
conservative(Ns + 2) = primitive(Ns + 2) / (primitive(Ns + 4) - 1._R_P) + &
0.5_R_P*primitive(Ns + 3) * primitive(Ns + 1) * primitive(Ns + 1)
endassociate
return
!---------------------------------------------------------------------------------------------------------------------------------
endfunction primitive2conservative