p_ideal_gas Subroutine

public pure subroutine p_ideal_gas(rho, u, p, c)

应用状态方程通过密度和能量计算理想气体压力和声速

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: rho

密度

real(kind=rk), intent(in) :: u

内部能量

real(kind=rk), intent(out) :: p

压力

real(kind=rk), intent(out) :: c

声速


Contents

Source Code


Source Code

    pure subroutine p_ideal_gas(rho, u, p, c)
        real(rk), intent(in) :: rho     !! 密度
        real(rk), intent(in) :: u       !! 内部能量
        real(rk), intent(out) :: p      !! 压力
        real(rk), intent(out) :: c      !! 声速
        real(rk), parameter :: gamma = 1.4_rk

        associate (tmp => (gamma - 1.0_rk)*u)
            p = rho*tmp
            c = sqrt(gamma*tmp)
        end associate

    end subroutine p_ideal_gas