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 dzORdlnp, int len, Adiabat method, Real userp) const
 
template<typename T1 , typename T2 >
void PrimitiveToChemical (T1 c, T2 const w) const
 Change mass mixing ratio to molar mixing ratio. More...
 
template<typename T1 , typename T2 >
void ChemicalToPrimitive (T1 w, T2 const c) const
 Change molar mixing ratio to mass mixing ratio. More...
 
template<typename T1 , typename T2 >
void ConservedToChemical (T1 c, T2 const u) const
 Change density to molar mixing ratio. More...
 
template<typename T1 , typename T2 >
void ChemicalToConserved (T1 u, T2 const c) const
 Change molar mixing ratio to density. More...
 
template<typename T >
Real GetGamma (T w) const
 polytropic index \(\gamma=c_p/c_v\) More...
 
template<typename T >
Real RovRd (T w) const
 
template<typename T >
Real GetTemp (T w) const
 Temperature. More...
 
template<typename T >
Real GetPres (T u) const
 
template<typename T >
Real GetChi (T w) const
 
template<typename T >
Real GetMeanCp (T w) const
 
template<typename T >
Real GetMeanCv (T w) const
 
template<typename T >
Real GetMeanMolecularWeight (T w) const
 
template<typename T >
void SaturationSurplus (Real dv[], T v, VariableType vtype) const
 

Public Attributes

MeshBlockpmy_block
 

Static Public Attributes

static Real const Rgas = 8.314462
 
static Real const kBoltz = 1.38065E-23
 
static Real const kBoltz_cgs = 1.38065E-16
 

Private Attributes

Real ftol_
 
int max_iter_
 
Real Rd_
 scratch array for storing variables 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 34 of file thermodynamics.hpp.

Constructor & Destructor Documentation

◆ Thermodynamics()

Thermodynamics::Thermodynamics ( MeshBlock pmb,
ParameterInput pin 
)

Definition at line 84 of file thermodynamics.cpp.

◆ ~Thermodynamics()

Thermodynamics::~Thermodynamics ( )
inline

Definition at line 45 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 50 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 58 of file thermodynamics.hpp.

◆ GetCv()

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 69 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 78 of file thermodynamics.hpp.

◆ GetCp()

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 89 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 103 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 111 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 125 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 138 of file thermodynamics.hpp.

◆ ConstructAtmosphere()

void Thermodynamics::ConstructAtmosphere ( Real **  w,
Real  Ts,
Real  Ps,
Real  grav,
Real  dzORdlnp,
int  len,
Adiabat  method,
Real  userp 
) const

Construct an 1d atmosphere

Parameters
methodchoose from [reversible, pseudo, dry, isothermal]

Definition at line 19 of file construct_atmosphere.cpp.

◆ PrimitiveToChemical()

template<typename T1 , typename T2 >
void Thermodynamics::PrimitiveToChemical ( T1  c,
T2 const  w 
) const
inline

Change mass mixing ratio to molar mixing ratio.

Definition at line 151 of file thermodynamics.hpp.

◆ ChemicalToPrimitive()

template<typename T1 , typename T2 >
void Thermodynamics::ChemicalToPrimitive ( T1  w,
T2 const  c 
) const
inline

Change molar mixing ratio to mass mixing ratio.

Definition at line 174 of file thermodynamics.hpp.

◆ ConservedToChemical()

template<typename T1 , typename T2 >
void Thermodynamics::ConservedToChemical ( T1  c,
T2 const  u 
) const
inline

Change density to molar mixing ratio.

Definition at line 195 of file thermodynamics.hpp.

◆ ChemicalToConserved()

template<typename T1 , typename T2 >
void Thermodynamics::ChemicalToConserved ( T1  u,
T2 const  c 
) const
inline

Change molar mixing ratio to density.

Definition at line 219 of file thermodynamics.hpp.

◆ GetGamma()

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

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

Definition at line 241 of file thermodynamics.hpp.

◆ RovRd()

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

Definition at line 252 of file thermodynamics.hpp.

◆ GetTemp()

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

Temperature.

Definition at line 261 of file thermodynamics.hpp.

◆ GetPres()

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

Definition at line 266 of file thermodynamics.hpp.

◆ GetChi()

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

Definition at line 279 of file thermodynamics.hpp.

◆ GetMeanCp()

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

Definition at line 292 of file thermodynamics.hpp.

◆ GetMeanCv()

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

Definition at line 303 of file thermodynamics.hpp.

◆ GetMeanMolecularWeight()

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

Definition at line 314 of file thermodynamics.hpp.

◆ SaturationSurplus()

template<typename T >
void Thermodynamics::SaturationSurplus ( Real  dv[],
v,
VariableType  vtype 
) const
inline

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

Definition at line 326 of file thermodynamics.hpp.

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 20 of file thermodynamics.cpp.

Member Data Documentation

◆ Rgas

Real const Thermodynamics::Rgas = 8.314462
static

Definition at line 38 of file thermodynamics.hpp.

◆ kBoltz

Real const Thermodynamics::kBoltz = 1.38065E-23
static

Definition at line 39 of file thermodynamics.hpp.

◆ kBoltz_cgs

Real const Thermodynamics::kBoltz_cgs = 1.38065E-16
static

Definition at line 40 of file thermodynamics.hpp.

◆ pmy_block

MeshBlock* Thermodynamics::pmy_block

pointer to MeshBlock

Definition at line 41 of file thermodynamics.hpp.

◆ ftol_

Real Thermodynamics::ftol_
private

Definition at line 351 of file thermodynamics.hpp.

◆ max_iter_

int Thermodynamics::max_iter_
private

Definition at line 352 of file thermodynamics.hpp.

◆ Rd_

Real Thermodynamics::Rd_
private

scratch array for storing variables

scratch array for storing variables ideal gas constant of dry air in J/kg

Definition at line 362 of file thermodynamics.hpp.

◆ mu_ratios_

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

ratio of mean molecular weights

Definition at line 364 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 366 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 370 of file thermodynamics.hpp.

◆ t3_

Real Thermodynamics::t3_[1+NVAPOR]
private

triple point temperature [K]

Definition at line 372 of file thermodynamics.hpp.

◆ p3_

Real Thermodynamics::p3_[1+NVAPOR]
private

triple point pressure [pa]

Definition at line 374 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 380 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 385 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 388 of file thermodynamics.hpp.


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