Compute total specific energy (per unit of mass). $$ E = \frac{p}{{\left( {\g - 1} \right)\r }} + \frac{{u^2 }}{2} $$
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R_P), | intent(in) | :: | p | Pressure. |
||
real(kind=R_P), | intent(in) | :: | r | Density. |
||
real(kind=R_P), | intent(in) | :: | u | Module of velocity vector. |
||
real(kind=R_P), | intent(in) | :: | g | Specific heats ratio \(\frac{{c_p}}{{c_v}}\). |
Total specific energy (per unit of mass).
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
elemental function E(p, r, u, g) result(energy)
!---------------------------------------------------------------------------------------------------------------------------------
!< Compute total specific energy (per unit of mass).
!<$$
!< E = \frac{p}{{\left( {\g - 1} \right)\r }} + \frac{{u^2 }}{2}
!<$$
!---------------------------------------------------------------------------------------------------------------------------------
real(R_P), intent(IN) :: p !< Pressure.
real(R_P), intent(IN) :: r !< Density.
real(R_P), intent(IN) :: u !< Module of velocity vector.
real(R_P), intent(IN) :: g !< Specific heats ratio \(\frac{{c_p}}{{c_v}}\).
real(R_P) :: energy !< Total specific energy (per unit of mass).
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
energy = p/((g - 1._R_P) * r) + 0.5_R_P * u * u
return
!---------------------------------------------------------------------------------------------------------------------------------
endfunction E