BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_Gas.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_GAS_HPP
13#define BELFEM_CL_GAS_HPP
14
15#include "typedefs.hpp"
16#include "commtools.hpp"
17#include "cl_Vector.hpp"
18#include "cl_Matrix.hpp"
19#include "cl_Cell.hpp"
20#include "cl_Map.hpp"
21#include "cl_SpMatrix.hpp"
22#include "cl_Spline.hpp"
23
24#include "cl_GM_Statevals.hpp"
25#include "cl_GT_GasData.hpp"
26#include "cl_GM_EoS.hpp"
27#include "en_GM_GasModel.hpp"
28#include "en_Helmholtz.hpp"
29
30namespace belfem
31{
32 namespace gastables
33 {
34 class RefGas;
35
36 class RefGasFactory;
37 }
38
39//------------------------------------------------------------------------------
40
41 namespace gasmodels
42 {
43 class Statevals;
44 class EoS;
45 class HelmholtzTransport ;
46 }
47
48//------------------------------------------------------------------------------
80 class Gas
81 {
82 protected:
83
86
90
93
96
99
102
105
108
111
115
117
121
124
125
129
132
135
138
141
144
145 // Work matrices for viscosity and conductivity calculation of
146 // mixtures. mutable: written by the const cea_mu / cea_lambda
152
153 // work matrix and vectors for equilibrium. NOT mutable: the RAND
154 // solver changes the composition, so it is not a const path
160
162
163 // Work matrices for gibbs
166
167 // critical temperature
169
170 // critical pressure
172
173 // critical volume
175
176 // constant for Stiel Thodos Equation
178
179 // constant for Lucas Equation
180 real mXi = 0.0;
181
183 bool mLiquidFlag = false;
184
186 gasmodels::EoS * mEoS = nullptr;
187
190
193 ( Gas::*mFunctionCp )
194 ( const real T, const real p ) const ;
195
198 ( Gas::*mFunctiondCpdT )
199 ( const real T, const real p ) const ;
200
203 ( Gas::*mFunctionCv )
204 ( const real T, const real p ) const ;
205
208 ( Gas::*mFunctionGamma )
209 ( const real T, const real p ) const ;
210
213 ( Gas::*mFunctionC )
214 ( const real T, const real p ) const ;
215
218 ( Gas::*mFunctionH )
219 ( const real T, const real p ) const ;
220
223 ( Gas::*mFunctionDHDP )
224 ( const real T, const real p ) const ;
225
228 ( Gas::*mFunctionS )
229 ( const real T, const real p ) const ;
230
233 ( Gas::*mFunctionDSDT )
234 ( const real T, const real p ) const ;
235
238 ( Gas::*mFunctionDSDP )
239 ( const real T, const real p ) const ;
240
243 ( Gas::*mFunctionMU )
244 ( const real T, const real p ) const ;
245
248 ( Gas::*mFunctionLAMBDA )
249 ( const real T, const real p ) const ;
250
251 // support term for entropy
253
258
262
263//------------------------------------------------------------------------------
264 public:
265//------------------------------------------------------------------------------
266
270 Gas();
271
272//------------------------------------------------------------------------------
273
277 Gas( const string & aLabel, const GasModel aGasModel=GasModel::IDGAS );
278
279//------------------------------------------------------------------------------
280
284 Gas( const HelmholtzModel aHelmholtzModel );
285
286//------------------------------------------------------------------------------
287
294 Gas(
295 const Cell<string> & aSpecies,
296 const Vector<real> & aMolarFractions,
297 const GasModel aGasModel=GasModel::IDGAS );
298
299//------------------------------------------------------------------------------
300
301 virtual ~Gas();
302
303//------------------------------------------------------------------------------
304
305 // owns the component RefGas objects and the EoS
306 Gas( const Gas & ) = delete;
307 Gas & operator=( const Gas & ) = delete;
308
309//------------------------------------------------------------------------------
310
311 const uint &
312 number_of_components() const;
313
314//------------------------------------------------------------------------------
315
316 virtual void
317 remix( const Vector<real> & aMolarFractions,
318 bool aRemixHeat=true,
319 bool aRemixTransport=true );
320
321//------------------------------------------------------------------------------
322
323 virtual void
324 remix_mass( const Vector<real> & aMassFractions,
325 bool aRemixHeat=true,
326 bool aRemixTransport=true );
327
328//------------------------------------------------------------------------------
329
330 // reset to mixture at initialization
331 virtual void
333
334//------------------------------------------------------------------------------
335
350 virtual real
351 M( const real T, const real p ) const ;
352
353//------------------------------------------------------------------------------
354
355 virtual real
356 R( const real T, const real p ) const ;
357
359
360//------------------------------------------------------------------------------
361
366 statevals();
367
368//------------------------------------------------------------------------------
369
374 data( const index_t aIndex );
375
376//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
377
381 const gastables::GasData *
382 data( const index_t aIndex ) const;
383
384//------------------------------------------------------------------------------
385
390 eos();
391
392//------------------------------------------------------------------------------
393
394 bool
395 is_idgas() const;
396
397//------------------------------------------------------------------------------
398
402 const Vector< real > &
403 molar_fractions() const;
404
405//------------------------------------------------------------------------------
406
410 const Vector< real > &
411 mass_fractions() const;
412
413//------------------------------------------------------------------------------
414
418 const real &
419 molar_fraction( const uint aIndex ) const;
420
421//------------------------------------------------------------------------------
422
426 const real &
427 mass_fraction( const uint aIndex ) const;
428
429//------------------------------------------------------------------------------
430
435 elements();
436
437//------------------------------------------------------------------------------
438
443 components();
444//------------------------------------------------------------------------------
445
450 component( const index_t aIndex );
451
452//------------------------------------------------------------------------------
453
458 const Matrix< real > &
459 formation_table() const ;
460
461//------------------------------------------------------------------------------
462
467 bool
468 is_liquid() const;
469
470//------------------------------------------------------------------------------
474 void
475 set_liquid_flag( const bool aFlag );
476
477//------------------------------------------------------------------------------
478// Thermodynamic States
479//------------------------------------------------------------------------------
480
481 real
482 p( const real T, const real v ) const ;
483
484//------------------------------------------------------------------------------
485
486 real
487 v( const real T, const real p ) const ;
488
489//------------------------------------------------------------------------------
490
491 real
492 rho( const real T, const real p ) const ;
493
494//------------------------------------------------------------------------------
495
496 real
497 T( const real p, const real v ) const ;
498
499//------------------------------------------------------------------------------
500// Caloric Properties
501//------------------------------------------------------------------------------
502
503 virtual real
504 cp( const real T, const real p ) const ;
505
506 virtual real
507 cv( const real T, const real p ) const ;
508
509 virtual real
510 gamma( const real T, const real p ) const ;
511
512 virtual real
513 c( const real T, const real p ) const ;
514
515 virtual real
516 u( const real T, const real p ) const ;
517
518 virtual real
519 h( const real T, const real p ) const ;
520
521 virtual real
522 s( const real T, const real p ) const ;
523
524 virtual real
525 dsdT( const real T, const real p ) const ;
526
527 virtual real
528 dsdp( const real T, const real p ) const ;
529
530 virtual real
531 dcpdT( const real T, const real p ) const ;
532
533 // dissociation enthalpy ( only for tablegas at this time )
534 virtual real
535 hd( const real T, const real p ) const ;
536
537//------------------------------------------------------------------------------
538// Transport Properties
539//------------------------------------------------------------------------------
540
544 real
545 mu( const real T, const real p ) const ;
546
550 real
551 lambda( const real T, const real p ) const ;
552
556 real
557 Pr( const real T, const real p ) const ;
558
559//------------------------------------------------------------------------------
560// Thermodynamic Coefficients
561//------------------------------------------------------------------------------
562
568 real
569 alpha( const real T, const real p ) const ;
570
571//------------------------------------------------------------------------------
577 real
578 beta( const real T, const real p ) const ;
579
580//------------------------------------------------------------------------------
581
587 real
588 kappa( const real T, const real p ) const ;
589
590//------------------------------------------------------------------------------
591// CHEMISTRY
592// -----------------------------------------------------------------------------
593
597 void
598 Gibbs( const real T, Vector< real > & aGibbs ) const ;
599
603 void
604 Hf( const real T, Vector< real > & aHf ) const ;
605
609 void
610 dGibbsdT( const real T, Vector< real > & aGibbs ) const ;
611
615 void
617 const real T,
618 const real p,
619 const bool aRemixHeat=true,
620 const bool aRemixTransport=true );
621
622 void
623 compute_equilibrium( const real T, const real p, Vector< real > & aX );
624
625//------------------------------------------------------------------------------
626// State relevant methods
627// -----------------------------------------------------------------------------
628
629 real
630 T_from_h( const real & h, const real p ) const ;
631
632// -----------------------------------------------------------------------------
636 real
637 isen_T( const real T0, const real p0, const real p1 ) const ;
638
639// -----------------------------------------------------------------------------
640
644 real
645 isen_p( const real T0, const real p0, const real T1 ) const ;
646
647// -----------------------------------------------------------------------------
648
652 void
653 total( const real T, const real p, const real & u,
654 real & aTt, real & aPt ) const ;
655
656// -----------------------------------------------------------------------------
657
667 void
668 expand( const real & A1,
669 const real T1,
670 const real p1,
671 const real & u1,
672 const real & A2,
673 real & T2,
674 real & p2,
675 real & u2 ) const ;
676
677// -----------------------------------------------------------------------------
678
686 void
687 compress( const real & A1,
688 const real T1,
689 const real p1,
690 const real & u1,
691 const real & A2,
692 real & T2,
693 real & p2,
694 real & u2 ) const ;
695
696// -----------------------------------------------------------------------------
697
723 real
724 prandtl_meyer( const real T1,
725 const real p1,
726 const real & u1,
727 const real & alpha,
728 real & T2,
729 real & p2,
730 real & u2 ) const ;
731
732// -----------------------------------------------------------------------------
733
738 void
739 shock( const real T1, const real p1, const real & u1,
740 real & T2, real & p2, real & u2 ) const ;
741
742// -----------------------------------------------------------------------------
743
747 void
748 shock( const real T1, const real p1, const real & u1, const real & alpha,
749 real & T2, real & p2, real & u2, real & beta ) const ;
750
751//------------------------------------------------------------------------------
752// Component Volume and Departure Functions
753//------------------------------------------------------------------------------
754
781
782 real
783 v( const uint aIndex, const real T, const real p ) const ;
784
788 real
789 h( const uint aIndex, const real T, const real p ) const ;
790
791 real
792 cp( const uint aIndex, const real T, const real p ) const ;
793
794 real
795 dcpdT( const uint aIndex, const real T, const real p ) const ;
796
798
799//------------------------------------------------------------------------------
800// Print composition
801//------------------------------------------------------------------------------
802
803 void
804 print() const ;
805
806//------------------------------------------------------------------------------
807// Special access
808//------------------------------------------------------------------------------
809
814 Spline &
815 heat_spline() ;
816
817 const Spline &
818 heat_spline() const ;
819
824 Spline &
826
827 const Spline &
828 viscosity_spline() const ;
829
834 Spline &
836
837 const Spline &
838 conductivity_spline() const ;
839
843 const GasModel &
844 gas_model() const;
845
849 const HelmholtzModel &
850 helmholtz_model() const;
851
852//------------------------------------------------------------------------------
853
854 // enthalpy derivative to pressure ( needed for total temperature )
855 virtual real
856 dhdp( const real T, const real p ) const ;
857
858//------------------------------------------------------------------------------
859 private:
860//------------------------------------------------------------------------------
861
862 void
863 create_eos( const GasModel & aGasModel );
864
865//------------------------------------------------------------------------------
866
867 void
868 initialize(
869 const Cell<string> & aSpecies,
870 const Vector<real> & aMolarFractions,
871 const GasModel aGasModel );
872
873//------------------------------------------------------------------------------
874
875 void
876 check_thermo_exists();
877
878//------------------------------------------------------------------------------
879
880 void
881 remix_R( const Vector<real> & aMolarFractions );
882
883//------------------------------------------------------------------------------
884
885 void
886 remix_heat();
887
888//------------------------------------------------------------------------------
889
890 void
891 remix_critical_point();
892
893//------------------------------------------------------------------------------
894
895 void
896 remix_transport();
897
898//------------------------------------------------------------------------------
899
900 void
901 create_reference_gases(
902 gastables::RefGasFactory & aFactory,
903 const Cell<string> & aLables );
904
905//------------------------------------------------------------------------------
906
907 string
908 element_to_molecule( const string & aElement ) const;
909
910//------------------------------------------------------------------------------
911
912 string
913 reference_element( const string & aElement ) const ;
914
915//------------------------------------------------------------------------------
916
917 void
918 create_viscosity_table( gastables::RefGasFactory & aFactory );
919
920//------------------------------------------------------------------------------
921
922 void
923 create_mass_properties( const Vector<real> & aMolarFractions );
924
925//------------------------------------------------------------------------------
926
927 void
928 evaluate_viscosity_interaction( const real T ) const ;
929
930//------------------------------------------------------------------------------
931
932 void
933 evaluate_conductivity_interaction( const real T ) const ;
934
935//------------------------------------------------------------------------------
936
937 real
938 idgas_cp( const real T, const real p ) const ;
939
940 real
941 idgas_dcpdT( const real T, const real p ) const ;
942
943 real
944 idgas_cv( const real T, const real p ) const ;
945
946 real
947 idgas_gamma( const real T, const real p ) const ;
948
949 real
950 idgas_c( const real T, const real p ) const ;
951
952 real
953 idgas_h( const real T, const real p ) const ;
954
955 real
956 idgas_s( const real T, const real p ) const ;
957
958 real
959 idgas_dsdT( const real T, const real p ) const ;
960
961 real
962 idgas_dsdp( const real T, const real p ) const ;
963
964 real
965 idgas_mu( const real T, const real p ) const ;
966
967 real
968 idgas_lambda( const real T, const real p ) const ;
969
970//------------------------------------------------------------------------------
971
972 real
973 realgas_cp( const real T, const real p ) const ;
974
975 real
976 realgas_dcpdT( const real T, const real p ) const ;
977
978 real
979 realgas_cv( const real T, const real p ) const ;
980
981 real
982 realgas_gamma( const real T, const real p ) const ;
983
984 real
985 realgas_c( const real T, const real p ) const ;
986
987 real
988 realgas_h( const real T, const real p ) const ;
989
990 real
991 realgas_s( const real T, const real p ) const ;
992
993 real
994 realgas_dsdT( const real T, const real p ) const ;
995
996 real
997 realgas_dsdp( const real T, const real p ) const ;
998
999 real
1000 realgas_mu( const real T, const real p ) const ;
1001
1002 real
1003 realgas_lambda( const real T, const real p ) const ;
1004
1005//------------------------------------------------------------------------------
1006
1007 real
1008 helmholtz_cp( const real T, const real p ) const ;
1009
1010 real
1011 helmholtz_dcpdT( const real T, const real p ) const ;
1012
1013 real
1014 helmholtz_cv( const real T, const real p ) const ;
1015
1016 real
1017 helmholtz_gamma( const real T, const real p ) const ;
1018
1019 real
1020 helmholtz_c( const real T, const real p ) const ;
1021
1022 real
1023 helmholtz_h( const real T, const real p ) const ;
1024
1025 real
1026 helmholtz_s( const real T, const real p ) const ;
1027
1028 real
1029 helmholtz_dsdT( const real T, const real p ) const ;
1030
1031 real
1032 helmholtz_dsdp( const real T, const real p ) const ;
1033
1034 real
1035 helmholtz_mu( const real T, const real p ) const ;
1036
1037 real
1038 helmholtz_lambda( const real T, const real p ) const ;
1039
1040//------------------------------------------------------------------------------
1041
1042 // from cea, Eq. 5.3
1043 real
1044 cea_mu( const real T ) const ;
1045
1046//------------------------------------------------------------------------------
1047
1048 // from cea, Eq. 5.4
1049 real
1050 cea_lambda( const real T ) const ;
1051
1052//------------------------------------------------------------------------------
1053
1054 real
1055 lambda_dep( const real T, const real p ) const ;
1056
1057//------------------------------------------------------------------------------
1058
1059 real
1060 mu_dep( const real & mu, const real T, const real p ) const ;
1061
1062//------------------------------------------------------------------------------
1063
1064 // link all caloric and transport functions to splines
1065 void
1066 link_to_idgas_property_functions();
1067
1068//------------------------------------------------------------------------------
1069
1070 // link all caloric and transport functions to splines
1071 // plus departure functions of underlying gas
1072 void
1073 link_to_realgas_property_functions();
1074
1075//------------------------------------------------------------------------------
1076
1077 // use the property functions from the equation of state
1078 void
1079 link_to_helmholtz_property_functions();
1080
1081//------------------------------------------------------------------------------
1082
1083 // create the table needed for formation enthalpy
1084 void
1085 create_formation_table();
1086
1087//------------------------------------------------------------------------------
1088
1096 real
1097 prandtl_meyer_angle(
1098 const real T,
1099 const real p,
1100 const real & u ) const ;
1101
1102//------------------------------------------------------------------------------
1103
1104 // special subroutine needed for shock
1105 real
1106 shock_beta_simple( const real T1,
1107 const real p1,
1108 const real & u1,
1109 const real & alpha,
1110 real & T2,
1111 real & p2,
1112 real & u2,
1113 const real & beta ) const ;
1114
1115//------------------------------------------------------------------------------
1116
1117 // special subroutine needed for shock
1118 real
1119 shock_beta( const real T1,
1120 const real p1,
1121 const real & u1,
1122 const real & alpha,
1123 real & T2,
1124 real & p2,
1125 real & u2,
1126 const real & beta ) const ;
1127
1128//------------------------------------------------------------------------------
1129
1130 // just return zero for idgas
1131 real
1132 dhdp_idgas( const real T, const real p ) const ;
1133
1134//------------------------------------------------------------------------------
1135
1136 // workaround if eos does that via departure function
1137 real
1138 dhdp_eos_departure( const real T, const real p ) const ;
1139
1140//------------------------------------------------------------------------------
1141
1142 // workaround if eos dies not support it
1143 real
1144 dhdp_differential_quotient( const real T, const real p ) const ;
1145
1146//------------------------------------------------------------------------------
1147
1148 void
1149 update_mixture_entropy();
1150
1151//------------------------------------------------------------------------------
1152
1156 real
1157 area_mach( const real Ma, const real k ) const ;
1158
1159//------------------------------------------------------------------------------
1160
1166 void
1167 area_guess( const real T1,
1168 const real p1,
1169 const real Ma1,
1170 const real & A1,
1171 const real & A2,
1172 const bool aSupersonic,
1173 real & T2,
1174 real & p2,
1175 real & u2 ) const ;
1176
1177//------------------------------------------------------------------------------
1178
1183 void
1184 isentropic_duct( const real & aMass,
1185 const real & aEntropy,
1186 const real & aEnergy,
1187 const real & A2,
1188 real & T2,
1189 real & p2,
1190 real & u2 ) const ;
1191
1192//------------------------------------------------------------------------------
1193
1194 index_t
1195 spline_col( const real T ) const ;
1196
1197//------------------------------------------------------------------------------
1198 };
1199
1200//------------------------------------------------------------------------------
1201
1202 inline bool
1204 {
1205 return mGasModel == GasModel::IDGAS ;
1206 }
1207
1208//------------------------------------------------------------------------------
1209
1210 inline const Vector< real > &
1212 {
1213 return mMolarFractions;
1214 }
1215
1216//------------------------------------------------------------------------------
1217
1218 inline const Vector< real > &
1220 {
1221 return mMassFractions;
1222 }
1223
1224//------------------------------------------------------------------------------
1225
1226
1227 inline const real &
1228 Gas::molar_fraction( const uint aIndex ) const
1229 {
1230 return mMolarFractions( aIndex );
1231 }
1232
1233//------------------------------------------------------------------------------
1234
1235 inline const real &
1236 Gas::mass_fraction( const uint aIndex ) const
1237 {
1238 return mMassFractions( aIndex );
1239 }
1240
1241//------------------------------------------------------------------------------
1242
1245 {
1246 return mElements ;
1247 }
1248
1249//------------------------------------------------------------------------------
1250
1253 {
1254 return mComponents ;
1255 }
1256
1257//------------------------------------------------------------------------------
1258
1259 inline gastables::RefGas *&
1260 Gas::component( const index_t aIndex )
1261 {
1262 return mComponents( aIndex );
1263 }
1264
1265//------------------------------------------------------------------------------
1266
1267 inline const Matrix< real > &
1269 {
1270 return mFormationTable ;
1271 }
1272
1273//------------------------------------------------------------------------------
1274
1275 inline gasmodels::EoS *
1277 {
1278 return mEoS;
1279 }
1280
1281//------------------------------------------------------------------------------
1282
1283 inline const uint &
1285 {
1286 return mNumberOfComponents;
1287 }
1288
1289//------------------------------------------------------------------------------
1290
1291 inline gasmodels::Statevals &
1293 {
1294 return mStatevals;
1295 }
1296
1297//------------------------------------------------------------------------------
1298
1299 inline bool
1301 {
1302 return mLiquidFlag;
1303 }
1304
1305//------------------------------------------------------------------------------
1306
1307 inline void
1308 Gas::set_liquid_flag( const bool aFlag )
1309 {
1310 mLiquidFlag = aFlag ;
1311 }
1312
1313//------------------------------------------------------------------------------
1314
1315 inline real
1316 Gas::alpha( const real T, const real p ) const
1317 {
1318 return mEoS->alpha( T, p );
1319 }
1320
1321//------------------------------------------------------------------------------
1322
1323 inline real
1324 Gas::beta( const real T, const real p ) const
1325 {
1326 return mEoS->beta( T, p );
1327 }
1328
1329//------------------------------------------------------------------------------
1330
1331 inline real
1332 Gas::kappa( const real T, const real p ) const
1333 {
1334 return mEoS->kappa( T, p );
1335 }
1336
1337//------------------------------------------------------------------------------
1338
1339 inline Spline &
1341 {
1342 return mHeatSpline ;
1343 }
1344
1345//------------------------------------------------------------------------------
1346
1347 inline const Spline &
1349 {
1350 return mHeatSpline ;
1351 }
1352
1353//------------------------------------------------------------------------------
1354
1355 inline Spline &
1357 {
1358 return mViscositySpline ;
1359 }
1360
1361//------------------------------------------------------------------------------
1362
1363 inline const Spline &
1365 {
1366 return mViscositySpline ;
1367 }
1368
1369//------------------------------------------------------------------------------
1370
1371 inline Spline &
1373 {
1374 return mConductivitySpline;
1375 }
1376
1377//------------------------------------------------------------------------------
1378
1379 inline const Spline &
1381 {
1382 return mConductivitySpline;
1383 }
1384
1385//------------------------------------------------------------------------------
1386
1387 inline const GasModel &
1389 {
1390 return mGasModel ;
1391 }
1392
1393//------------------------------------------------------------------------------
1394
1395 inline const HelmholtzModel &
1397 {
1398 return mHelmholzModel ;
1399 }
1400
1401//------------------------------------------------------------------------------
1402
1403 inline real
1404 Gas::dhdp_idgas( const real T, const real p ) const
1405 {
1406 return 0 ;
1407 }
1408
1409//------------------------------------------------------------------------------
1410
1411 // workaround if eos does that via departure function
1412 inline real
1413 Gas::dhdp_eos_departure( const real T, const real p ) const
1414 {
1415 return mEoS->dhdepdp( T, p );
1416 }
1417
1418//------------------------------------------------------------------------------
1419
1420 // workaround if eos does not support it
1421 inline real
1422 Gas::dhdp_differential_quotient( const real T, const real p ) const
1423 {
1424 return ( mEoS->h( T, 1.01 * p ) - mEoS->h( T, 0.99 * p ) ) /
1425 ( 0.02 * p ) ;
1426 }
1427
1428//------------------------------------------------------------------------------
1429
1441 inline index_t
1442 Gas::spline_col( const real T ) const
1443 {
1448 "Gas splines do not share a grid, the cached column cannot be reused" );
1449
1450 if ( T != mLastSplineT )
1451 {
1452 mLastSplineT = T ;
1454 }
1455 return mLastSplineCol ;
1456 }
1457
1458//------------------------------------------------------------------------------
1459}
1460#endif //BELFEM_CL_GAS_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
#define BELFEM_STATEVAL_M
Definition cl_GM_Statevals.hpp:21
#define BELFEM_STATEVAL_R
Definition cl_GM_Statevals.hpp:22
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
virtual real dsdp(const real T, const real p) const
Definition cl_Gas.cpp:1740
void remix_to_equilibrium(const real T, const real p, const bool aRemixHeat=true, const bool aRemixTransport=true)
remix to equilibrium
Definition cl_Gas.cpp:2129
virtual real c(const real T, const real p) const
Definition cl_Gas.cpp:1659
real lambda(const real T, const real p) const
thermal conductivity in W/(m*K)
Definition cl_Gas.cpp:1772
real(Gas::*) mFunctionLAMBDA(const real T, const real p) const
pointer to Lambda function
Definition cl_Gas.hpp:249
virtual real h(const real T, const real p) const
Definition cl_Gas.cpp:1692
gasmodels::EoS * eos()
expose state equation of a refgas
Definition cl_Gas.hpp:1276
virtual real cv(const real T, const real p) const
Definition cl_Gas.cpp:1627
SpMatrix mHelpMatrix
help matrix for remixing
Definition cl_Gas.hpp:123
Vector< real > mWorkVector
Definition cl_Gas.hpp:148
real(Gas::*) mFunctionC(const real T, const real p) const
pointer to c function
Definition cl_Gas.hpp:214
real kappa(const real T, const real p) const
isothermal compressibility coefficient
Definition cl_Gas.hpp:1332
const real & molar_fraction(const uint aIndex) const
return one single milar fraction
Definition cl_Gas.hpp:1228
const Matrix< real > & formation_table() const
expose the formation table, telling which component is built from which element
Definition cl_Gas.hpp:1268
Vector< real > mWorkVectorRAND0
Definition cl_Gas.hpp:155
const HelmholtzModel & helmholtz_model() const
which Helmholtz model this gas uses, if any
Definition cl_Gas.hpp:1396
real rho(const real T, const real p) const
Definition cl_Gas.cpp:1562
Cell< gastables::RefGas * > & components()
expose the component container
Definition cl_Gas.hpp:1252
void Hf(const real T, Vector< real > &aHf) const
return the molar formation enthalpy for each component
Definition cl_Gas.cpp:1833
Vector< real > mFormationWork
Definition cl_Gas.hpp:165
gasmodels::Statevals mStatevals
Definition cl_Gas.hpp:89
Cell< gastables::RefGas * > mViscosityInteractionRefgas
Interaction polynomials for viscosity.
Definition cl_Gas.hpp:140
real mVcrit
Definition cl_Gas.hpp:174
gasmodels::Statevals & statevals()
expose statevals object
Definition cl_Gas.hpp:1292
real mXi
Definition cl_Gas.hpp:180
Vector< real > mMassFractions
y or zeta
Definition cl_Gas.hpp:95
Matrix< real > mWorkMatrixRAND
Definition cl_Gas.hpp:158
Vector< real > mFlowResidual
Definition cl_Gas.hpp:256
Vector< real > mMolarFractions
x or chi
Definition cl_Gas.hpp:92
real(Gas::*) mFunctionDHDP(const real T, const real p) const
pointer to dhdp function
Definition cl_Gas.hpp:224
virtual real hd(const real T, const real p) const
Definition cl_Gas.cpp:1603
Matrix< uint > mViscosityInteractionTable
table telling if interaction parameter exists
Definition cl_Gas.hpp:143
void set_liquid_flag(const bool aFlag)
set the liquid flag.
Definition cl_Gas.hpp:1308
virtual real gamma(const real T, const real p) const
Definition cl_Gas.cpp:1643
real mWorkTemperature
Definition cl_Gas.hpp:161
real T(const real p, const real v) const
Definition cl_Gas.cpp:1570
void compute_equilibrium(const real T, const real p, Vector< real > &aX)
Definition cl_Gas.cpp:1939
virtual real dhdp(const real T, const real p) const
Definition cl_Gas.cpp:3955
Vector< real > mWorkVectorRAND1
Definition cl_Gas.hpp:156
Matrix< real > mFlowJacobian
scratch for the duct solvers, sized in initialize()
Definition cl_Gas.hpp:255
const real & mM
Molar Mass in kg/Mol.
Definition cl_Gas.hpp:104
Vector< real > mGaussWeights
Definition cl_Gas.hpp:261
Vector< real > mMolarFractions0
molar fractions at initialization
Definition cl_Gas.hpp:98
gasmodels::HelmholtzTransport * mTransport
special class, only needed if this is a helmholtz eos
Definition cl_Gas.hpp:189
Gas & operator=(const Gas &)=delete
Vector< real > mGaussPoints
Gauss rule for prandtl_meyer, allocated on first call.
Definition cl_Gas.hpp:260
Cell< string > mElementNames
Definition cl_Gas.hpp:116
Matrix< real > mWorkMatrix
Definition cl_Gas.hpp:147
gasmodels::EoS * mEoS
the equation of state
Definition cl_Gas.hpp:186
virtual void reset_mixture()
Definition cl_Gas.cpp:719
void total(const real T, const real p, const real &u, real &aTt, real &aPt) const
calculate the total state
Definition cl_Gas.cpp:2382
Spline mHeatSpline
Definition cl_Gas.hpp:126
real Pr(const real T, const real p) const
Prandtl Number.
Definition cl_Gas.cpp:1788
virtual real dsdT(const real T, const real p) const
Definition cl_Gas.cpp:1724
const Vector< real > & molar_fractions() const
expose the molar fractions
Definition cl_Gas.hpp:1211
virtual real M(const real T, const real p) const
Definition cl_Gas.cpp:736
Spline & viscosity_spline()
expose viscosity spline
Definition cl_Gas.hpp:1356
const real & mass_fraction(const uint aIndex) const
return one single mass fraction
Definition cl_Gas.hpp:1236
real isen_p(const real T0, const real p0, const real T1) const
get an isentropic pressure
Definition cl_Gas.cpp:2352
virtual real R(const real T, const real p) const
Definition cl_Gas.cpp:727
Cell< gastables::RefGas * > mComponents
Components of the mixgas.
Definition cl_Gas.hpp:110
const real & mR
Gas constant in J/(kg*K).
Definition cl_Gas.hpp:107
real p(const real T, const real v) const
Definition cl_Gas.cpp:1528
virtual void remix_mass(const Vector< real > &aMassFractions, bool aRemixHeat=true, bool aRemixTransport=true)
Definition cl_Gas.cpp:658
bool is_idgas() const
Definition cl_Gas.hpp:1203
real mMixtureEntropy
Definition cl_Gas.hpp:252
bool mLiquidFlag
liquid flag, written by Helmholtz::v() and read by EoS_Cubic::v()
Definition cl_Gas.hpp:183
Gas()
default constructor, creates air as idgas
Definition cl_Gas.cpp:46
gastables::GasData * data(const index_t aIndex)
expose the data object of a refgas
Definition cl_Gas.cpp:3840
real mu(const real T, const real p) const
dynamic viscosity in Pa*s
Definition cl_Gas.cpp:1756
bool is_liquid() const
test if the last evaluated state is liquid.
Definition cl_Gas.hpp:1300
uint mNumberOfComponents
size of components vector
Definition cl_Gas.hpp:85
gastables::RefGas *& component(const index_t aIndex)
expose one component
Definition cl_Gas.hpp:1260
const GasModel & gas_model() const
returns what gas model is used
Definition cl_Gas.hpp:1388
Spline mConductivitySpline
Definition cl_Gas.hpp:128
real(Gas::*) mFunctionH(const real T, const real p) const
pointer to h function
Definition cl_Gas.hpp:219
real mGamma
Definition cl_Gas.hpp:177
GasModel mGasModel
gasmodel type
Definition cl_Gas.hpp:134
void print() const
Definition cl_Gas.cpp:3766
const Vector< real > & mass_fractions() const
expose the mass fractions
Definition cl_Gas.hpp:1219
Cell< gastables::RefGas * > mExtra
Definition cl_Gas.hpp:120
real beta(const real T, const real p) const
isochoric stress coefficient
Definition cl_Gas.hpp:1324
real(Gas::*) mFunctionCv(const real T, const real p) const
pointer to cv function
Definition cl_Gas.hpp:204
void Gibbs(const real T, Vector< real > &aGibbs) const
return the molar Gibbs potential at reference pressure
Definition cl_Gas.cpp:1858
Vector< real > mWorkVector2
Definition cl_Gas.hpp:149
real prandtl_meyer(const real T1, const real p1, const real &u1, const real &alpha, real &T2, real &p2, real &u2) const
Prandtl-Meyer turn of a supersonic stream around a corner, for a thermally perfect ideal gas.
Definition cl_Gas.cpp:3373
Vector< int_t > mPivotRAND
Definition cl_Gas.hpp:159
Spline mViscositySpline
Definition cl_Gas.hpp:127
void shock(const real T1, const real p1, const real &u1, real &T2, real &p2, real &u2) const
perpendicular shock
Definition cl_Gas.cpp:3469
real(Gas::*) mFunctionDSDT(const real T, const real p) const
pointer to dsdT function
Definition cl_Gas.hpp:234
Vector< real > mMolarMasses
molar masses of components
Definition cl_Gas.hpp:101
void dGibbsdT(const real T, Vector< real > &aGibbs) const
return the temperature derivative of gibs potentia at reference pressure
Definition cl_Gas.cpp:1900
real alpha(const real T, const real p) const
thermal expansion coefficient
Definition cl_Gas.hpp:1316
virtual void remix(const Vector< real > &aMolarFractions, bool aRemixHeat=true, bool aRemixTransport=true)
Definition cl_Gas.cpp:627
virtual real cp(const real T, const real p) const
Definition cl_Gas.cpp:1586
virtual real dcpdT(const real T, const real p) const
Definition cl_Gas.cpp:1611
index_t mLastSplineCol
Definition cl_Gas.hpp:131
Matrix< real > mFormationTable
Definition cl_Gas.hpp:164
virtual real s(const real T, const real p) const
Definition cl_Gas.cpp:1708
real(Gas::*) mFunctionGamma(const real T, const real p) const
pointer to gamma function
Definition cl_Gas.hpp:209
real mTcrit
Definition cl_Gas.hpp:168
Vector< real > mWorkVectorRAND2
Definition cl_Gas.hpp:157
void compress(const real &A1, const real T1, const real p1, const real &u1, const real &A2, real &T2, real &p2, real &u2) const
compression of a gas into a narrowing duct, A2 <= A1
Definition cl_Gas.cpp:2819
real(Gas::*) mFunctionS(const real T, const real p) const
pointer to s function
Definition cl_Gas.hpp:229
Spline & conductivity_spline()
expose conductivity spline
Definition cl_Gas.hpp:1372
const uint & number_of_components() const
Definition cl_Gas.hpp:1284
real isen_T(const real T0, const real p0, const real p1) const
get an isentropic temperature
Definition cl_Gas.cpp:2312
Vector< real > mWorkMu
Definition cl_Gas.hpp:150
Vector< real > mWorkLambda
Definition cl_Gas.hpp:151
real(Gas::*) mFunctionMU(const real T, const real p) const
pointer to Mu function
Definition cl_Gas.hpp:244
real(Gas::*) mFunctiondCpdT(const real T, const real p) const
pointer to dcpdT function
Definition cl_Gas.hpp:199
virtual real u(const real T, const real p) const
Definition cl_Gas.cpp:1675
real T_from_h(const real &h, const real p) const
Definition cl_Gas.cpp:2221
Vector< int_t > mFlowPivot
Definition cl_Gas.hpp:257
real(Gas::*) mFunctionCp(const real T, const real p) const
pointer to cp function
Definition cl_Gas.hpp:194
Spline & heat_spline()
expose heat spline
Definition cl_Gas.hpp:1340
void expand(const real &A1, const real T1, const real p1, const real &u1, const real &A2, real &T2, real &p2, real &u2) const
expansion of a gas into a widening duct, A2 >= A1
Definition cl_Gas.cpp:2646
real(Gas::*) mFunctionDSDP(const real T, const real p) const
pointer to dsdp function
Definition cl_Gas.hpp:239
Gas(const Gas &)=delete
Cell< gastables::RefGas * > & elements()
expose the element container
Definition cl_Gas.hpp:1244
Cell< gastables::RefGas * > mElements
Definition cl_Gas.hpp:114
real v(const real T, const real p) const
Definition cl_Gas.cpp:1546
real mLastSplineT
Definition cl_Gas.hpp:130
real mPcrit
Definition cl_Gas.hpp:171
HelmholtzModel mHelmholzModel
helmholz type, if used
Definition cl_Gas.hpp:137
Dense column-major matrix.
Definition cl_BZ_Matrix.hpp:28
Sparse matrix in CSR or CSC format.
Definition cl_SpMatrix.hpp:52
Cubic spline on a uniform grid, C2, with natural, parabolic or clamped boundary conditions.
Definition cl_Spline.hpp:45
index_t find_col(const real aX) const
Definition cl_Spline.hpp:443
real x_min() const
Definition cl_Spline.hpp:403
real x_max() const
Definition cl_Spline.hpp:411
Column vector.
Definition cl_BZ_Vector.hpp:41
virtual class for equation of state
Definition cl_GM_EoS.hpp:34
virtual real alpha(const real T, const real p) const
thermal expansion coefficient
Definition cl_GM_EoS.cpp:42
virtual real beta(const real T, const real p) const
isochoric stress coefficient
Definition cl_GM_EoS.cpp:51
virtual real dhdepdp(const real T, const real p) const
Definition cl_GM_EoS.cpp:216
virtual real h(const real T, const real p) const
Definition cl_GM_EoS.cpp:77
virtual real kappa(const real T, const real p) const
isothermal compressibility coefficient
Definition cl_GM_EoS.cpp:60
Base class for the transport properties of a Helmholtz fluid.
Definition cl_GM_HelmholtzTransport.hpp:42
The per state property cache of a Gas.
Definition cl_GM_Statevals.hpp:87
const real & get(const index_t aIndex) const
get a value of the state
Definition cl_GM_Statevals.hpp:232
The per species property record: the scalar data that describe a gas but do not depend on the state.
Definition cl_GT_GasData.hpp:58
Builds RefGas objects from the shipped data tables.
Definition cl_GT_RefGasFactory.hpp:59
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
HelmholtzModel
Definition en_Helmholtz.hpp:18
@ UNDEFINED
Definition en_Helmholtz.hpp:25
@ T
Definition cl_Material.hpp:122
unsigned int uint
Definition typedefs.hpp:30
uint32_t index_t
Definition typedefs.hpp:52
double real
Definition typedefs.hpp:36
GasModel
Definition en_GM_GasModel.hpp:18
@ IDGAS
Definition en_GM_GasModel.hpp:19
@ UNDEFINED
Definition en_GM_GasModel.hpp:23
#define BELFEM_UINT_MAX
Definition typedefs.hpp:80
#define BELFEM_REAL_MAX
Definition typedefs.hpp:81
#define BELFEM_QUIET_NAN
Definition typedefs.hpp:87