Cantera 2.6.0

PDSS_IdealGas.cpp
Go to the documentation of this file.
1/**
2 * @file PDSS_IdealGas.cpp
3 * Implementation of a pressure dependent standard state
4 * virtual function.
5 */
6
7// This file is part of Cantera. See License.txt in the top-level directory or
8// at https://cantera.org/license.txt for license and copyright information.
9
10#include "cantera/base/ctml.h"
11#include "cantera/thermo/PDSS_IdealGas.h"
12#include "cantera/thermo/VPStandardStateTP.h"
13
14 using namespace std;
15
16 namespace Cantera
17{
18
19 PDSS_IdealGas::PDSS_IdealGas()
20{
21}
22
23 void PDSS_IdealGas::initThermo()
24{
25 PDSS::initThermo();
26 m_p0 = m_spthermo->refPressure();
27 m_minTemp = m_spthermo->minTemp();
28 m_maxTemp = m_spthermo->maxTemp();
29}
30
31 void PDSS_IdealGas::getParameters(AnyMap &eosNode) const
32{
33 PDSS::getParameters(eosNode);
34 eosNode["model"] = "ideal-gas";
35}
36
37doublereal PDSS_IdealGas::intEnergy_mole() const
38{
39 return (m_h0_RT - 1.0) * GasConstant * m_temp;
40}
41
42doublereal PDSS_IdealGas::cv_mole() const
43{
44 return cp_mole() - GasConstant;
45}
46
47doublereal PDSS_IdealGas::pressure() const
48{
49 throw NotImplementedError("PDSS_IdealGas::pressure");
50}
51
52 void PDSS_IdealGas::setPressure(doublereal p)
53{
54 m_sss_R = m_s0_R - log(m_pres/m_p0);
55 m_gss_RT = m_hss_RT - m_sss_R;
56 m_Vss = GasConstant * m_temp / m_pres;
57}
58
59 void PDSS_IdealGas::setTemperature(doublereal temp)
60{
61 m_temp = temp;
62 m_spthermo->updatePropertiesTemp(temp, &m_cp0_R, &m_h0_RT, &m_s0_R);
63 m_g0_RT = m_h0_RT - m_s0_R;
64 m_V0 = GasConstant * m_temp / m_p0;
65 m_hss_RT = m_h0_RT;
66 m_cpss_R = m_cp0_R;
67 m_sss_R = m_s0_R - log(m_pres/m_p0);
68 m_gss_RT = m_hss_RT - m_sss_R;
69 m_Vss = GasConstant * m_temp / m_pres;
70}
71
72 void PDSS_IdealGas::setState_TP(doublereal temp, doublereal pres)
73{
74 m_pres = pres;
75 setTemperature(temp);
76}
77
78 void PDSS_IdealGas::setState_TR(doublereal temp, doublereal rho)
79{
80 m_pres = GasConstant * temp * rho / m_mw;
81 setTemperature(temp);
82}
83
84}
PDSS_IdealGas.h
Declarations for the class PDSS_IdealGas (pressure dependent standard state) which handles calculatio...
VPStandardStateTP.h
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Cantera::NotImplementedError
An error indicating that an unimplemented function has been called.
Definition: ctexceptions.h:187
Cantera::PDSS_IdealGas::getParameters
virtual void getParameters(AnyMap &eosNode) const
Store the parameters needed to reconstruct a copy of this PDSS object.
Definition: PDSS_IdealGas.cpp:31
Cantera::PDSS_IdealGas::pressure
virtual doublereal pressure() const
Returns the pressure (Pa)
Definition: PDSS_IdealGas.cpp:47
Cantera::PDSS_IdealGas::setPressure
virtual void setPressure(doublereal pres)
Sets the pressure in the object.
Definition: PDSS_IdealGas.cpp:52
Cantera::PDSS_IdealGas::setState_TP
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Definition: PDSS_IdealGas.cpp:72
Cantera::PDSS_IdealGas::cv_mole
virtual doublereal cv_mole() const
Return the molar const volume heat capacity in units of J kmol-1 K-1.
Definition: PDSS_IdealGas.cpp:42
Cantera::PDSS_IdealGas::setTemperature
virtual void setTemperature(doublereal temp)
Set the internal temperature.
Definition: PDSS_IdealGas.cpp:59
Cantera::PDSS_IdealGas::initThermo
virtual void initThermo()
Initialization routine.
Definition: PDSS_IdealGas.cpp:23
Cantera::PDSS_IdealGas::PDSS_IdealGas
PDSS_IdealGas()
Default Constructor.
Definition: PDSS_IdealGas.cpp:19
Cantera::PDSS_IdealGas::setState_TR
virtual void setState_TR(doublereal temp, doublereal rho)
Set the internal temperature and density.
Definition: PDSS_IdealGas.cpp:78
Cantera::PDSS_IdealGas::intEnergy_mole
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
Definition: PDSS_IdealGas.cpp:37
Cantera::PDSS_Nondimensional::m_sss_R
double m_sss_R
Standard state entropy divided by R.
Definition: PDSS.h:522
Cantera::PDSS_Nondimensional::cp_mole
virtual doublereal cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition: PDSS.cpp:262
Cantera::PDSS_Nondimensional::m_cpss_R
double m_cpss_R
Standard state heat capacity divided by R.
Definition: PDSS.h:521
Cantera::PDSS_Nondimensional::m_h0_RT
double m_h0_RT
Reference state enthalpy divided by RT.
Definition: PDSS.h:515
Cantera::PDSS_Nondimensional::m_g0_RT
double m_g0_RT
Reference state Gibbs free energy divided by RT.
Definition: PDSS.h:518
Cantera::PDSS_Nondimensional::m_s0_R
double m_s0_R
Reference state entropy divided by R.
Definition: PDSS.h:517
Cantera::PDSS_Nondimensional::m_gss_RT
double m_gss_RT
Standard state Gibbs free energy divided by RT.
Definition: PDSS.h:523
Cantera::PDSS_Nondimensional::m_cp0_R
double m_cp0_R
Reference state heat capacity divided by R.
Definition: PDSS.h:516
Cantera::PDSS_Nondimensional::m_Vss
double m_Vss
Standard State molar volume (m^3/kmol)
Definition: PDSS.h:524
Cantera::PDSS_Nondimensional::m_hss_RT
double m_hss_RT
Standard state enthalpy divided by RT.
Definition: PDSS.h:520
Cantera::PDSS_Nondimensional::m_V0
double m_V0
Reference state molar volume (m^3/kmol)
Definition: PDSS.h:519
Cantera::PDSS::initThermo
virtual void initThermo()
Initialization routine.
Definition: PDSS.h:415
Cantera::PDSS::m_pres
doublereal m_pres
State of the system - pressure.
Definition: PDSS.h:458
Cantera::PDSS::m_spthermo
shared_ptr< SpeciesThermoInterpType > m_spthermo
Pointer to the species thermodynamic property manager.
Definition: PDSS.h:478
Cantera::PDSS::m_temp
doublereal m_temp
Current temperature used by the PDSS object.
Definition: PDSS.h:455
Cantera::PDSS::m_maxTemp
doublereal m_maxTemp
Maximum temperature.
Definition: PDSS.h:467
Cantera::PDSS::m_p0
doublereal m_p0
Reference state pressure of the species.
Definition: PDSS.h:461
Cantera::PDSS::m_mw
doublereal m_mw
Molecular Weight of the species.
Definition: PDSS.h:470
Cantera::PDSS::getParameters
virtual void getParameters(AnyMap &eosNode) const
Store the parameters needed to reconstruct a copy of this PDSS object.
Definition: PDSS.h:424
Cantera::PDSS::m_minTemp
doublereal m_minTemp
Minimum temperature.
Definition: PDSS.h:464
ctml.h
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:113