BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_GT_GasData.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_CL_GT_GASDATA_HPP
13#define BELFEM_CL_GT_GASDATA_HPP
14
15#include "typedefs.hpp"
16#include "cl_Map.hpp"
17#include "cl_Vector.hpp"
18
19namespace belfem
20{
21 namespace gasmodels
22 {
23 class Helmholtz;
24 }
25
26 namespace gastables
27 {
28
29 class RefGas;
30 class InputData;
31 class InputAlpha;
32
33//------------------------------------------------------------------------------
34
57 class GasData
58 {
59 // the name of the gas as chemical symbol
60 string mLabel = "untitled";
61
62 // the name of the gas as written word
63 string mName = "untitled";
64
65 // the cas number of this gas
66 string mCasNumber = "none";
67
68 // specific gas constant in J/(kg*K)
70
71 // the molar mass in kg/mol;
73
74 // critical temperature in K
75 real mTcrit = BELFEM_QUIET_NAN;
76
77 // critical pressure in Pascal
78 real mPcrit= BELFEM_QUIET_NAN;
79
80 // critical density in kg / m^3
81 real mRhocrit= BELFEM_QUIET_NAN;
82
83 // real gas factor
84 real mZcrit= BELFEM_QUIET_NAN;
85
86 // acentric factor
87 real mAcentric = BELFEM_QUIET_NAN;
88
89 // dipole moment
90 real mDipole = BELFEM_QUIET_NAN;
91
92 // coeffs for SRK EoS
93 Vector< real > mCoeffsSRK;
94
95 // coeffs for PR EOS
96 Vector< real > mCoeffsPR;
97
98 // flag telling if data is taken from Mahmoodi and Sedig
99 // 10.1016/j.fluid.2016.12.015
100 bool mCubicFlag = false;
101
102 // cell with elements this gas
103 Cell< string > mElements;
104
105 // map containing the composition
106 Map< string, real > mComposition;
107
108 // formation enthalpy at 298.15 K
110
111 // enthalpy at 298.15 K
112 real mHref = BELFEM_QUIET_NAN;
113
114 // entropy at 298.15 K and 1 bar ( calculated from spline )
115 real mSref = BELFEM_QUIET_NAN;
116
117 friend RefGas;
118 friend InputData;
119 friend InputAlpha;
120 friend class gasmodels::Helmholtz ;
121
122//------------------------------------------------------------------------------
123 public:
124//------------------------------------------------------------------------------
125
126 GasData() = default;
127
128 ~GasData() = default;
129
130//------------------------------------------------------------------------------
131
132 inline bool
133 has_crit() const;
134
135//------------------------------------------------------------------------------
136
137 inline bool
138 has_cubic() const;
139
140//------------------------------------------------------------------------------
141
142 inline const string &
143 label() const;
144
145//------------------------------------------------------------------------------
146
147 inline const string &
148 name() const;
149//------------------------------------------------------------------------------
150
151 inline const string &
152 cas() const;
153
154//------------------------------------------------------------------------------
155
156 inline const real &
157 R() const;
158
159//------------------------------------------------------------------------------
160
161 inline const real &
162 M() const;
163
164//------------------------------------------------------------------------------
165
166 inline const real &
167 acentric() const;
168
169//------------------------------------------------------------------------------
170
171 inline const real &
172 dipole() const;
173
174//------------------------------------------------------------------------------
175
176 inline const real &
177 Hf() const;
178
179//------------------------------------------------------------------------------
180
181 inline const real &
182 Href() const;
183
184//------------------------------------------------------------------------------
185
186 inline const real &
187 Sref() const;
188
189//------------------------------------------------------------------------------
190
191 // cell with elements this gas
192 inline const Cell< string > &
193 elements() const;
194
195//------------------------------------------------------------------------------
196
197 // map containing the composition
198 inline const Map< string, real > &
199 composition() const;
200
201//------------------------------------------------------------------------------
202
203 inline real
204 component_multiplicity( const string & aLabel ) const;
205
206//------------------------------------------------------------------------------
207
208 inline const real &
209 T_crit() const;
210
211//------------------------------------------------------------------------------
212
213 inline const real &
214 p_crit() const;
215
216//------------------------------------------------------------------------------
217
218 inline const real &
219 rho_crit() const;
220
221//------------------------------------------------------------------------------
222
223 inline const real &
224 Z_crit() const;
225
226
227//------------------------------------------------------------------------------
228
229 inline const Vector< real > &
230 srk() const;
231
232//------------------------------------------------------------------------------
233
234 inline const Vector< real > &
235 pr() const;
236
237//------------------------------------------------------------------------------
238 protected:
239//------------------------------------------------------------------------------
240
241 void
242 set_label( const string & aLabel );
243
244//------------------------------------------------------------------------------
245
246 void
247 set_name( const string & aName );
248
249//------------------------------------------------------------------------------
250
251 void
252 set_cas_number( const string & aCasNumber );
253
254//------------------------------------------------------------------------------
255
256 void
257 set_molar_mass( const real & aM );
258
259//------------------------------------------------------------------------------
260
261 void
262 set_t_crit( const real aTcrit );
263
264//------------------------------------------------------------------------------
265
266 void
267 set_p_crit( const real aPcrit );
268
269//------------------------------------------------------------------------------
270
271 void
272 set_rho_crit( const real & aRhocrit );
273
274//------------------------------------------------------------------------------
275
276 void
277 set_z_crit( const real & aZcrit );
278
279//------------------------------------------------------------------------------
280
281 void
282 set_acentric_factor( const real & aOmega );
283
284//------------------------------------------------------------------------------
285
286 void
287 set_dipole_moment( const real & aDipole );
288
289//------------------------------------------------------------------------------
290
291 void
292 set_formation_enthalpy( const real & aHf );
293
294//------------------------------------------------------------------------------
295
296 void
297 set_reference_enthalpy( const real & aHref );
298
299//------------------------------------------------------------------------------
300
301 void
302 set_reference_entropy( const real & aSref );
303
304//------------------------------------------------------------------------------
305
306 inline Vector< real > &
307 srk();
308
309//------------------------------------------------------------------------------
310
311 inline Vector< real > &
312 pr();
313
314//------------------------------------------------------------------------------
315
316 inline void
318
319//------------------------------------------------------------------------------
320 };
321
322//------------------------------------------------------------------------------
323
324 bool
326 {
327
328 return ( ! std::isnan( mTcrit ) )
329 && ( ! std::isnan( mPcrit ) )
330 && ( ! std::isnan( mZcrit ) )
331 && ( ! std::isnan( mAcentric ) )
332 && ( ! std::isnan( mDipole ) );
333 }
334
335//------------------------------------------------------------------------------
336
337 bool
339 {
340 return mCubicFlag;
341 }
342
343//------------------------------------------------------------------------------
344
345 const string &
347 {
348 return mLabel;
349 }
350
351//------------------------------------------------------------------------------
352
353 const string &
355 {
356 return mName;
357 }
358
359//------------------------------------------------------------------------------
360
361 const string &
363 {
364 return mCasNumber;
365 }
366
367//------------------------------------------------------------------------------
368
369 const real &
371 {
372 return mR;
373 }
374
375//------------------------------------------------------------------------------
376
377 const real &
379 {
380 return mM;
381 }
382
383//------------------------------------------------------------------------------
384
385 inline const real &
387 {
388 return mAcentric;
389 }
390
391//------------------------------------------------------------------------------
392
393 inline const real &
395 {
396 return mDipole;
397 }
398
399//------------------------------------------------------------------------------
400
401 inline const real &
403 {
404 return mHf;
405 }
406
407//------------------------------------------------------------------------------
408
409 inline const real &
411 {
412 return mHref;
413 }
414
415//------------------------------------------------------------------------------
416
417 inline const real &
419 {
420 return mSref;
421 }
422
423//------------------------------------------------------------------------------
424
425 // cell with elements this gas
426 const Cell< string > &
428 {
429 return mElements;
430 }
431
432//------------------------------------------------------------------------------
433
434 // map containing the composition
435 const Map< string, real > &
437 {
438 return mComposition;
439 }
440
441//------------------------------------------------------------------------------
442
443 real
444 GasData::component_multiplicity( const string & aLabel ) const
445 {
446 // test if parameter exists
447 if ( mComposition.key_exists( aLabel ) )
448 {
449 return mComposition( aLabel );
450 }
451 else
452 {
453 return 0.0;
454 }
455 }
456
457//------------------------------------------------------------------------------
458
459 const real &
461 {
462 return mTcrit;
463 }
464
465//------------------------------------------------------------------------------
466
467 const real &
469 {
470 return mPcrit;
471 }
472
473//------------------------------------------------------------------------------
474
475 const real &
477 {
478 return mRhocrit;
479 }
480
481//------------------------------------------------------------------------------
482
483 const real &
485 {
486 return mZcrit;
487 }
488
489//------------------------------------------------------------------------------
490
493 {
494 return mCoeffsSRK;
495 }
496
497 const Vector< real > &
499 {
500 return mCoeffsSRK;
501 }
502
503//------------------------------------------------------------------------------
504
507 {
508 return mCoeffsPR;
509 }
510
511 const Vector< real > &
513 {
514 return mCoeffsPR;
515 }
516
517//------------------------------------------------------------------------------
518
519 void
521 {
522 mCubicFlag = true;
523 }
524
525//------------------------------------------------------------------------------
526
527 } /* namespace gastables */
528} /* namespace belfem */
529
530#endif //BELFEM_CL_GT_GASDATA_HPP
a model for the helmholtz energy, specifically user for cryogenic fluids
Definition cl_GM_Helmholtz.hpp:60
bool has_cubic() const
Definition cl_GT_GasData.hpp:338
const real & T_crit() const
Definition cl_GT_GasData.hpp:460
const real & p_crit() const
Definition cl_GT_GasData.hpp:468
const real & Href() const
Definition cl_GT_GasData.hpp:410
const real & Hf() const
Definition cl_GT_GasData.hpp:402
void set_name(const string &aName)
Definition cl_GT_GasData.cpp:31
const real & rho_crit() const
Definition cl_GT_GasData.hpp:476
void set_dipole_moment(const real &aDipole)
Definition cl_GT_GasData.cpp:110
const string & cas() const
Definition cl_GT_GasData.hpp:362
void set_cubic_flag()
Definition cl_GT_GasData.hpp:520
const Map< string, real > & composition() const
Definition cl_GT_GasData.hpp:436
const string & label() const
Definition cl_GT_GasData.hpp:346
void set_acentric_factor(const real &aOmega)
Definition cl_GT_GasData.cpp:102
const real & Sref() const
Definition cl_GT_GasData.hpp:418
void set_cas_number(const string &aCasNumber)
Definition cl_GT_GasData.cpp:39
void set_label(const string &aLabel)
Definition cl_GT_GasData.cpp:23
void set_molar_mass(const real &aM)
Definition cl_GT_GasData.cpp:47
bool has_crit() const
Definition cl_GT_GasData.hpp:325
const real & Z_crit() const
Definition cl_GT_GasData.hpp:484
void set_formation_enthalpy(const real &aHf)
Definition cl_GT_GasData.cpp:118
const real & M() const
Definition cl_GT_GasData.hpp:378
const real & R() const
Definition cl_GT_GasData.hpp:370
const Vector< real > & srk() const
Definition cl_GT_GasData.hpp:498
void set_t_crit(const real aTcrit)
Definition cl_GT_GasData.cpp:56
void set_z_crit(const real &aZcrit)
Definition cl_GT_GasData.cpp:87
const real & acentric() const
Definition cl_GT_GasData.hpp:386
void set_rho_crit(const real &aRhocrit)
Definition cl_GT_GasData.cpp:72
const Vector< real > & pr() const
Definition cl_GT_GasData.hpp:512
const real & dipole() const
Definition cl_GT_GasData.hpp:394
void set_reference_entropy(const real &aSref)
Definition cl_GT_GasData.cpp:134
void set_p_crit(const real aPcrit)
Definition cl_GT_GasData.cpp:64
real component_multiplicity(const string &aLabel) const
Definition cl_GT_GasData.hpp:444
const string & name() const
Definition cl_GT_GasData.hpp:354
const Cell< string > & elements() const
Definition cl_GT_GasData.hpp:427
void set_reference_enthalpy(const real &aHref)
Definition cl_GT_GasData.cpp:126
Reader for cubicalpha.inp, the fitted alpha function coefficients of Mahmoodi and Sedigh ( doi 10....
Definition cl_GT_InputAlpha.hpp:46
Reader for gasdata.inp, the table of critical point and molecular data.
Definition cl_GT_InputData.hpp:40
A single chemical species with its caloric and transport properties.
Definition cl_GT_RefGas.hpp:76
Definition cl_Gas.hpp:42
Definition cl_Gas.hpp:33
USER GUIDES:
Definition cl_Capacitor.cpp:16
double real
Definition typedefs.hpp:36
#define BELFEM_QUIET_NAN
Definition typedefs.hpp:87