Return density.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(eos_compressible), | intent(in) | :: | self | Equation of state. |
||
| real(kind=R8P), | intent(in), | optional | :: | energy | Specific internal energy value. |
|
| real(kind=R8P), | intent(in), | optional | :: | pressure | Pressure value. |
|
| real(kind=R8P), | intent(in), | optional | :: | speed_of_sound | Speed of sound value. |
|
| real(kind=R8P), | intent(in), | optional | :: | temperature | Temperature value. |
Density value.
elemental function density(self, energy, pressure, speed_of_sound, temperature) result(density_)
!< Return density.
class(eos_compressible), intent(in) :: self !< Equation of state.
real(R8P), intent(in), optional :: energy !< Specific internal energy value.
real(R8P), intent(in), optional :: pressure !< Pressure value.
real(R8P), intent(in), optional :: speed_of_sound !< Speed of sound value.
real(R8P), intent(in), optional :: temperature !< Temperature value.
real(R8P) :: density_ !< Density value.
density_ = 0._R8P
if (present(energy).and.present(pressure)) then
density_ = pressure / ((self%g_ - 1._R8P) * energy)
elseif (present(pressure).and.present(speed_of_sound)) then
density_ = self%g_ * pressure / (speed_of_sound * speed_of_sound)
elseif (present(pressure).and.present(temperature)) then
density_ = pressure / (self%R_ * temperature)
endif
endfunction density