Cantera  2.4.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 http://www.cantera.org/license.txt for license and copyright information.
9 
10 #include "cantera/base/ctml.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 doublereal PDSS_IdealGas::intEnergy_mole() const
32 {
33  return (m_h0_RT - 1.0) * GasConstant * m_temp;
34 }
35 
36 doublereal PDSS_IdealGas::cv_mole() const
37 {
38  return cp_mole() - GasConstant;
39 }
40 
41 doublereal PDSS_IdealGas::pressure() const
42 {
43  throw CanteraError("PDSS_IdealGas::pressure()", "unimplemented");
44 }
45 
46 void PDSS_IdealGas::setPressure(doublereal p)
47 {
48  m_sss_R = m_s0_R - log(m_pres/m_p0);
49  m_gss_RT = m_hss_RT - m_sss_R;
50  m_Vss = GasConstant * m_temp / m_pres;
51 }
52 
53 void PDSS_IdealGas::setTemperature(doublereal temp)
54 {
55  m_temp = temp;
56  m_spthermo->updatePropertiesTemp(temp, &m_cp0_R, &m_h0_RT, &m_s0_R);
57  m_g0_RT = m_h0_RT - m_s0_R;
58  m_V0 = GasConstant * m_temp / m_p0;
59  m_hss_RT = m_h0_RT;
60  m_cpss_R = m_cp0_R;
61  m_sss_R = m_s0_R - log(m_pres/m_p0);
62  m_gss_RT = m_hss_RT - m_sss_R;
63  m_Vss = GasConstant * m_temp / m_pres;
64 }
65 
66 void PDSS_IdealGas::setState_TP(doublereal temp, doublereal pres)
67 {
68  m_pres = pres;
69  setTemperature(temp);
70 }
71 
72 void PDSS_IdealGas::setState_TR(doublereal temp, doublereal rho)
73 {
74  m_pres = GasConstant * temp * rho / m_mw;
75  setTemperature(temp);
76 }
77 
78 }
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
STL namespace.
Declarations for the class PDSS_IdealGas (pressure dependent standard state) which handles calculatio...
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8