Athena++/Atmosphere
Planetary Atmosphere Simulator
Thermodynamics Class Reference

#include <thermodynamics.hpp>

Public Member Functions

 Thermodynamics (MeshBlock *pmb, ParameterInput *pin)
 
 ~Thermodynamics ()
 
Real GetRd () const
 
Real GetCvRatio (int i) const
 
Real GetCv (int i) const
 
Real GetCpRatio (int i) const
 
Real GetCp (int i) const
 
Real GetLatent (int j, Real temp=0.) const
 
Real GetMassRatio (int i) const
 
Real GetBeta (int j) const
 
Real GetDelta (int j) const
 
void ConstructAtmosphere (Real **w, Real Ts, Real Ps, Real grav, Real dz, int len, Adiabat method, Real dTdz=0.) const
 
void UpdateTPConservingU (Real q[], Real rho, Real uhat) const
 
void ConservedToThermo (AthenaArray< Real > &q, AthenaArray< Real > const &u, int il, int iu, int jl, int ju, int kl, int ku) const
 
void ThermoToConserved (AthenaArray< Real > &u, AthenaArray< Real > const &q, int il, int iu, int jl, int ju, int kl, int ku) const
 
template<typename T >
Real GetGamma (T w)
 polytropic index \(\gamma=c_p/c_v\) More...
 
template<typename T >
void ChemicalToPrimitive (T w, Real const q[])
 
template<typename T >
void PrimitiveToChemical (Real q[], T const w)
 
template<typename T >
Real RovRd (T w)
 
template<typename T >
Real GetTemp (T w)
 Temperature. More...
 
template<typename T >
Real GetPres (T u)
 
template<typename T >
Real GetChi (T w)
 
template<typename T >
Real GetCp (T w)
 
template<typename T >
Real GetCv (T w)
 
template<typename T >
Real GetTheta (T w, Real p0)
 Potential temperature. More...
 
template<typename T >
void SaturationSurplus (Real dw[], T v, VariableType vtype=VariableType::prim)
 
template<typename T >
Real GetRelativeHumidity (T w, int iv)
 Relative humidity. More...
 

Public Attributes

MeshBlockpmy_block
 

Private Attributes

Real ftol_
 Equivalent potential temperature. More...
 
int max_iter_
 
Real w1_ [NHYDRO+2 *NVAPOR]
 scratch array for storing variables More...
 
Real dw_ [1+NVAPOR]
 scratch array for storing variables More...
 
Real Rd_
 ideal gas constant of dry air in J/kg More...
 
Real mu_ratios_ [1+3 *NVAPOR]
 ratio of mean molecular weights More...
 
Real cp_ratios_ [1+3 *NVAPOR]
 ratio of specific heat capacities at constant pressure More...
 
Real beta_ [1+3 *NVAPOR]
 
Real t3_ [1+NVAPOR]
 triple point temperature [K] More...
 
Real p3_ [1+NVAPOR]
 triple point pressure [pa] More...
 
Real latent_ [1+3 *NVAPOR]
 
Real delta_ [1+3 *NVAPOR]
 
Real cv_ratios_ [1+3 *NVAPOR]
 ratio of specific heat capacities at constant volume More...
 

Friends

std::ostream & operator<< (std::ostream &os, Thermodynamics const &my)
 

Detailed Description

Definition at line 36 of file thermodynamics.hpp.

Constructor & Destructor Documentation

◆ Thermodynamics()

Thermodynamics::Thermodynamics ( MeshBlock pmb,
ParameterInput pin 
)

Definition at line 81 of file thermodynamics.cpp.

◆ ~Thermodynamics()

Thermodynamics::~Thermodynamics ( )
inline

Definition at line 44 of file thermodynamics.hpp.

Member Function Documentation

◆ GetRd()

Real Thermodynamics::GetRd ( ) const
inline

Ideal gas constant of dry air in [J/(kg K)]

Returns
\(R_d=\hat{R}/m_d\)

Definition at line 49 of file thermodynamics.hpp.

◆ GetCvRatio()

Real Thermodynamics::GetCvRatio ( int  i) const
inline

Ratio of specific heat capacity at constant volume

Parameters
iindex of the vapor
Returns
\(c_{v,i}/c_{v,d}\)

Definition at line 57 of file thermodynamics.hpp.

◆ GetCv() [1/2]

Real Thermodynamics::GetCv ( int  i) const
inline

Specific heat capacity at constant volume

\(c_{v,d} = \frac{R_d}{\gamma_d - 1}\)
\(c_{v,i} = \frac{c_{v,i}}{c_{v,d}}\times c_{v,d}\)

Parameters
iindex of the vapor
Returns
\(c_v\) [J/(kg K)]

Definition at line 68 of file thermodynamics.hpp.

◆ GetCpRatio()

Real Thermodynamics::GetCpRatio ( int  i) const
inline

Ratio of specific heat capacity at constant pressure

Parameters
iindex of the vapor
Returns
\(c_{p,i}/c_{p,d}\)

Definition at line 77 of file thermodynamics.hpp.

◆ GetCp() [1/2]

Real Thermodynamics::GetCp ( int  i) const
inline

Specific heat capacity at constant pressure

\(c_{p,d} = \frac{\gamma_d}{\gamma_d - 1}R_d\)
\(c_{p,i} = \frac{c_{p,i}}{c_{p,d}}\times c_{p,d}\)

Parameters
iindex of the vapor
Returns
\(c_p\) [J/(kg K)]

Definition at line 88 of file thermodynamics.hpp.

◆ GetLatent()

Real Thermodynamics::GetLatent ( int  j,
Real  temp = 0. 
) const
inline

Temperature dependent specific latent heat of condensates at constant volume

\(L_{ij}(T) = L_{ij}^r - (c_{ij} - c_{p,i})\times(T - T^r)\) \(= L_{ij}^r - \delta_{ij}R_i(T - T^r)\)

Parameters
jindex of condensate
temptemperature (default to 0)
Returns
\(L_{ij}(T)\) [J/kg]

Definition at line 102 of file thermodynamics.hpp.

◆ GetMassRatio()

Real Thermodynamics::GetMassRatio ( int  i) const
inline

Ratio of molecular weights

Parameters
iindex of the vapor or the condensate
Returns
\(\epsilon_i=m_i/m_d\)

Definition at line 110 of file thermodynamics.hpp.

◆ GetBeta()

Real Thermodynamics::GetBeta ( int  j) const
inline

\(\beta\) parameter of a condensate

\(\beta_{ij} = \frac{\Delta U_{ij}}{R_i T^r}\)
\(\Delta U_{ij}\) is the difference in internal energy between the vapor \(i\) and the condensate \(j\)
\(R_i=\hat{R}/m_i=R_d/\epsilon_i\)
\(T^r\) is the triple point temperature

Parameters
jindex of the condensate
Returns
\(\beta_{ij}\)

Definition at line 124 of file thermodynamics.hpp.

◆ GetDelta()

Real Thermodynamics::GetDelta ( int  j) const
inline

\(\delta\) parameter of a condensate

\(\delta_{ij} = \frac{\Delta c_{ij}}{R_i}\)
\(\Delta c_{ij} = c_{ij} - c_{p,j}\) is the difference in specific heat capacity at constant temperature.
\(c_{ij}\) is the heat capacity of condensate \(j\) of vapor \(i\)

Parameters
jindex of the condensate
Returns
\(\delta_{ij}\)

Definition at line 137 of file thermodynamics.hpp.

◆ ConstructAtmosphere()

void Thermodynamics::ConstructAtmosphere ( Real **  w,
Real  Ts,
Real  Ps,
Real  grav,
Real  dz,
int  len,
Adiabat  method,
Real  dTdz = 0. 
) const

Construct an 1d atmosphere

Parameters
method= 0 - reversible adiabat
= 1 - pseudo adiabat
= 2 - an adiabat with no latent heat release

Definition at line 19 of file construct_atmosphere.cpp.

◆ UpdateTPConservingU()

void Thermodynamics::UpdateTPConservingU ( Real  q[],
Real  rho,
Real  uhat 
) const

◆ ConservedToThermo()

void Thermodynamics::ConservedToThermo ( AthenaArray< Real > &  q,
AthenaArray< Real > const &  u,
int  il,
int  iu,
int  jl,
int  ju,
int  kl,
int  ku 
) const

adjust conserved variable to a sub-saturated state

Parameters
uconserved variables

Conserved variables to thermodynamic variables

Parameters
qthermodynamic variables
uconserved variables
ilstart index in dim 1
iuend index in dim 1
jlstart index in dim 2
juend index in dim 2
klstart index in dim 3
kuend index in dim 3

◆ ThermoToConserved()

void Thermodynamics::ThermoToConserved ( AthenaArray< Real > &  u,
AthenaArray< Real > const &  q,
int  il,
int  iu,
int  jl,
int  ju,
int  kl,
int  ku 
) const

◆ GetGamma()

template<typename T >
Real Thermodynamics::GetGamma ( w)
inline

polytropic index \(\gamma=c_p/c_v\)

Definition at line 184 of file thermodynamics.hpp.

◆ ChemicalToPrimitive()

template<typename T >
void Thermodynamics::ChemicalToPrimitive ( w,
Real const  q[] 
)
inline

Definition at line 196 of file thermodynamics.hpp.

◆ PrimitiveToChemical()

template<typename T >
void Thermodynamics::PrimitiveToChemical ( Real  q[],
T const  w 
)
inline

Definition at line 202 of file thermodynamics.hpp.

◆ RovRd()

template<typename T >
Real Thermodynamics::RovRd ( w)
inline

Definition at line 208 of file thermodynamics.hpp.

◆ GetTemp()

template<typename T >
Real Thermodynamics::GetTemp ( w)
inline

Temperature.

Definition at line 217 of file thermodynamics.hpp.

◆ GetPres()

template<typename T >
Real Thermodynamics::GetPres ( u)
inline

Definition at line 222 of file thermodynamics.hpp.

◆ GetChi()

template<typename T >
Real Thermodynamics::GetChi ( w)
inline

Definition at line 235 of file thermodynamics.hpp.

◆ GetCp() [2/2]

template<typename T >
Real Thermodynamics::GetCp ( w)
inline

Definition at line 249 of file thermodynamics.hpp.

◆ GetCv() [2/2]

template<typename T >
Real Thermodynamics::GetCv ( w)
inline

Definition at line 260 of file thermodynamics.hpp.

◆ GetTheta()

template<typename T >
Real Thermodynamics::GetTheta ( w,
Real  p0 
)
inline

Potential temperature.

Definition at line 272 of file thermodynamics.hpp.

◆ SaturationSurplus()

template<typename T >
void Thermodynamics::SaturationSurplus ( Real  dw[],
v,
VariableType  vtype = VariableType::prim 
)
inline

Saturation surplus for vapors can be both positive and negative positive value represents supersaturation
negative value represents saturation deficit

Definition at line 283 of file thermodynamics.hpp.

◆ GetRelativeHumidity()

template<typename T >
Real Thermodynamics::GetRelativeHumidity ( w,
int  iv 
)
inline

Relative humidity.

Definition at line 322 of file thermodynamics.hpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
Thermodynamics const &  my 
)
friend

Definition at line 17 of file thermodynamics.cpp.

Member Data Documentation

◆ pmy_block

MeshBlock* Thermodynamics::pmy_block

pointer to MeshBlock

Definition at line 40 of file thermodynamics.hpp.

◆ ftol_

Real Thermodynamics::ftol_
private

Equivalent potential temperature.

Definition at line 332 of file thermodynamics.hpp.

◆ max_iter_

int Thermodynamics::max_iter_
private

Definition at line 333 of file thermodynamics.hpp.

◆ w1_

Real Thermodynamics::w1_[NHYDRO+2 *NVAPOR]
private

scratch array for storing variables

Definition at line 336 of file thermodynamics.hpp.

◆ dw_

Real Thermodynamics::dw_[1+NVAPOR]
private

scratch array for storing variables

Definition at line 339 of file thermodynamics.hpp.

◆ Rd_

Real Thermodynamics::Rd_
private

ideal gas constant of dry air in J/kg

Definition at line 343 of file thermodynamics.hpp.

◆ mu_ratios_

Real Thermodynamics::mu_ratios_[1+3 *NVAPOR]
private

ratio of mean molecular weights

Definition at line 345 of file thermodynamics.hpp.

◆ cp_ratios_

Real Thermodynamics::cp_ratios_[1+3 *NVAPOR]
private

ratio of specific heat capacities at constant pressure

Definition at line 347 of file thermodynamics.hpp.

◆ beta_

Real Thermodynamics::beta_[1+3 *NVAPOR]
private

dimensionless latent heat \(\beta_{ij} == \frac{L_{ij}^r + \Delta c_{ij}T^r}{R_i T^r} \)

Definition at line 351 of file thermodynamics.hpp.

◆ t3_

Real Thermodynamics::t3_[1+NVAPOR]
private

triple point temperature [K]

Definition at line 353 of file thermodynamics.hpp.

◆ p3_

Real Thermodynamics::p3_[1+NVAPOR]
private

triple point pressure [pa]

Definition at line 355 of file thermodynamics.hpp.

◆ latent_

Real Thermodynamics::latent_[1+3 *NVAPOR]
private

latent heat in J/kg \(L_i^r+\Delta c_{ij}T^r == \beta_{ij}\frac{R_d}{\epsilon_i}T^r\)

Definition at line 361 of file thermodynamics.hpp.

◆ delta_

Real Thermodynamics::delta_[1+3 *NVAPOR]
private

dimensionless differences in specific heat capacity \((c_{ij} - c_{p,i})/R_i\)

Definition at line 366 of file thermodynamics.hpp.

◆ cv_ratios_

Real Thermodynamics::cv_ratios_[1+3 *NVAPOR]
private

ratio of specific heat capacities at constant volume

Definition at line 369 of file thermodynamics.hpp.


The documentation for this class was generated from the following files: