Cantera  2.0
vcs_species_thermo.h
1 
2 /*
3  * Copyright (2005) Sandia Corporation. Under the terms of
4  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
5  * U.S. Government retains certain rights in this software.
6  */
7 
8 #ifndef VCS_SPECIES_THERMO_H
9 #define VCS_SPECIES_THERMO_H
10 
11 //#include <vector>
12 #include <cstdlib>
13 
14 namespace VCSnonideal
15 {
16 
17 class vcs_VolPhase;
18 
19 /*****************************************************************************/
20 /*****************************************************************************/
21 /*****************************************************************************/
22 /*
23  * Models for the species standard state Naught temperature
24  * dependence
25  */
26 #define VCS_SS0_NOTHANDLED -1
27 #define VCS_SS0_CONSTANT 0
28 //#define VCS_SS0_NASA_POLY 1
29 #define VCS_SS0_CONSTANT_CP 2
30 
31 
32 /*
33  * Models for the species standard state extra pressure dependence
34  *
35  */
36 #define VCS_SSSTAR_NOTHANDLED -1
37 #define VCS_SSSTAR_CONSTANT 0
38 #define VCS_SSSTAR_IDEAL_GAS 1
39 
40 /*
41  * Identifies the thermo model for the species
42  * This structure is shared by volumetric and surface species. However,
43  * each will have its own types of thermodynamic models. These
44  * quantities all have appropriate units. The units are specified by
45  * VCS_UnitsFormat.
46  */
47 class VCS_SPECIES_THERMO
48 {
49  /*
50  * All objects are public for ease of development
51  */
52 public:
53  /**
54  * Index of the phase that this species belongs to.
55  */
56  size_t IndexPhase;
57 
58  /**
59  * Index of this species in the current phase.
60  */
61  size_t IndexSpeciesPhase;
62 
63  /**
64  * Pointer to the owning phase object.
65  */
66  vcs_VolPhase* OwningPhase;
67 
68  /**
69  * Integer representing the models for the species standard state
70  * Naught temperature dependence. They are listed above and start
71  * with VCS_SS0_...
72  */
73  int SS0_Model;
74 
75  /**
76  * Internal storage of the last calculation of the reference
77  * naught Gibbs free energy at SS0_TSave.
78  * (always in units of Kelvin)
79  */
80  double SS0_feSave;
81 
82  /**
83  * Internal storage of the last temperature used in the
84  * calculation of the reference naught Gibbs free energy.
85  * units = kelvin
86  */
87  double SS0_TSave;
88 
89  /**
90  * Base temperature used in the VCS_SS0_CONSTANT_CP
91  * model
92  */
93  double SS0_T0;
94 
95  /**
96  * Base enthalpy used in the VCS_SS0_CONSTANT_CP
97  * model
98  */
99  double SS0_H0;
100 
101  /**
102  * Base entropy used in the VCS_SS0_CONSTANT_CP
103  * model
104  */
105  double SS0_S0;
106 
107  /**
108  * Base heat capacity used in the VCS_SS0_CONSTANT_CP
109  * model
110  */
111  double SS0_Cp0;
112 
113  /**
114  * Value of the pressure for the reference state.
115  * defaults to 1.01325E5 = 1 atm
116  */
117  double SS0_Pref;
118  /**
119  * Pointer to a list of parameters that is malloced for
120  * complicated reference state calculation.
121  */
122  void* SS0_Params;
123  /**
124  * Integer value representing the star state model.
125  */
126  int SSStar_Model;
127 
128  /**
129  * Pointer to a list of parameters that is malloced for
130  * complicated reference star state calculation.
131  */
132  void* SSStar_Params;
133 
134  /**
135  * Integer value representing the activity coefficient model
136  * These are defined in vcs_VolPhase.h and start with
137  * VCS_AC_...
138  */
139  int Activity_Coeff_Model;
140 
141  /**
142  * Pointer to a list of parameters that is malloced for
143  * activity coefficient models.
144  */
145  void* Activity_Coeff_Params;
146 
147  /**
148  * Models for the standard state volume of each species
149  */
150  int SSStar_Vol_Model;
151 
152  /**
153  * Pointer to a list of parameters that is malloced for
154  * volume models
155  */
156  void* SSStar_Vol_Params;
157 
158  /**
159  * parameter that is used int eh VCS_SSVOL_CONSTANT model.
160  */
161  double SSStar_Vol0;
162 
163  /**
164  * If true, this object will call Cantera to do its member
165  * calculations.
166  */
167  bool UseCanteraCalls;
168 
169  int m_VCS_UnitsFormat;
170  /*
171  * constructor and destructor
172  */
173  VCS_SPECIES_THERMO(size_t indexPhase, size_t indexSpeciesPhase);
174  virtual ~VCS_SPECIES_THERMO();
175 
176  /*
177  * Copy constructor and assignment operator
178  */
179  VCS_SPECIES_THERMO(const VCS_SPECIES_THERMO& b);
180  VCS_SPECIES_THERMO& operator=(const VCS_SPECIES_THERMO& b);
181 
182  /*
183  * Duplication function for inherited classes.
184  */
185  virtual VCS_SPECIES_THERMO* duplMyselfAsVCS_SPECIES_THERMO();
186 
187  /**
188  * This function calculates the standard state Gibbs free energy
189  * for species, kspec, at the temperature TKelvin and pressure, Pres.
190  *
191  *
192  * Input
193  * TKelvin = Temperature in Kelvin
194  * pres = pressure is given in units specified by if__ variable.
195  *
196  *
197  * Output
198  * return value = standard state free energy in units of Kelvin.
199  */
200  virtual double GStar_R_calc(size_t kspec, double TKelvin, double pres);
201 
202  /**
203  *
204  * G0_calc:
205  *
206  * This function calculates the standard state Gibbs free energy
207  * for species, kspec, at the temperature TKelvin
208  *
209  * Input
210  *
211  *
212  * Output
213  * return value = standard state free energy in Kelvin.
214  */
215  virtual double G0_R_calc(size_t kspec, double TKelvin);
216 
217  /**
218  * cpc_ts_VStar_calc:
219  *
220  * This function calculates the standard state molar volume
221  * for species, kspec, at the temperature TKelvin and pressure, Pres,
222  *
223  *
224  * Input
225  *
226  *
227  * Output
228  * return value = standard state volume in cm**3 per mol.
229  * (if__=3) m**3 / kmol
230  */
231  virtual double VolStar_calc(size_t kglob, double TKelvin, double Pres);
232 
233  /**
234  * This function evaluates the activity coefficient
235  * for species, kspec
236  *
237  * Input
238  * kspec -> integer value of the species in the global
239  * species list within VCS_SOLVE. Phase and local species id
240  * can be looked up within object.
241  *
242  * Note, T, P and mole fractions are obtained from the
243  * single private instance of VCS_SOLVE
244  *
245  *
246  *
247  * Output
248  * return value = activity coefficient for species kspec
249  */
250  virtual double eval_ac(size_t kspec);
251 
252  /**
253  * Get the pointer to the vcs_VolPhase object for this species.
254  */
255 
256 };
257 
258 /* Externals for vcs_species_thermo.c */
259 
260 //extern double vcs_Gxs_phase_calc(vcs_VolPhase *, double *);
261 //extern double vcs_Gxs_calc(int iphase);
262 
263 }
264 
265 #endif