BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_GM_HelmholtzTransport_Methane.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_GM_HelmholtzTransportMETHANE_HPP
13#define BELFEM_CL_GM_HelmholtzTransportMETHANE_HPP
14
16
17#include "typedefs.hpp"
18#include "cl_Gas.hpp"
19#include "cl_Vector.hpp"
20#include "cl_Bitset.hpp"
21
22#define BELFEM_METHANE_T 0
23#define BELFEM_METHANE_P 1
24#define BELFEM_METHANE_V 2
25#define BELFEM_METHANE_TAU 3
26#define BELFEM_METHANE_DELTA 4
27#define BELFEM_METHANE_MU0 5
28#define BELFEM_METHANE_MU 6
29#define BELFEM_METHANE_LAMBDA 7
30#define BELFEM_METHANE_NUMVALS 8
31namespace belfem
32{
33 namespace gasmodels
34 {
35//----------------------------------------------------------------------------
36
43 {
44 // critical data, bound to the EoS data object at runtime.
45 // Friend's own Table 1 values are Tc = 190.551 K, pc = 4.5992e6 Pa;
46 // running on the EoS critical point instead is deliberate, see
47 // init_constants()
48 const real mTcrit ;
49 const real mPcrit ;
50 const real mM ; // = 16.043e-3 ;
51 const real mVcrit ; // = 1.0 / ( mM * 10.139e3 ) ;
52
53 const real mR ; // = constant::Rm / mM ;
54 const real mZcrit ; // = mPcrit * mVcrit / ( mR * mTcrit );
55
56 // Table 8
57 Vector< real > mOmega ;
59
60 // Table 9
64
68
69 // intermolecular parameters
70 const real mEpsilonKb = 174.0;
71 const real mSigma = 0.36652e-9 ;
72
73 // constant for eta_0
74 real mConstEta0 ;
75
76 // constant for eta_ex
77 real mConstEtaEx ;
78
79
80 real mConstLambdaCr ;
81 real mConstExpLambdaCr ;
82
83 real mConstLambdaEx ;
84
87 mutable real mVals[ BELFEM_METHANE_NUMVALS ] = { 0.0 };
89
90//----------------------------------------------------------------------------
91 public:
92//----------------------------------------------------------------------------
93
95
97
98//----------------------------------------------------------------------------
99
100 real
101 mu( const real T, const real p ) const;
102
103//----------------------------------------------------------------------------
104
105 real
106 lambda( const real T, const real p ) const;
107
108//----------------------------------------------------------------------------
109 private:
110//----------------------------------------------------------------------------
111
112 void
113 init_tables();
114
115//----------------------------------------------------------------------------
116
117 void
118 init_constants();
119
120//----------------------------------------------------------------------------
121
122 real
123 eta_0() const;
124
125//----------------------------------------------------------------------------
126
127 real
128 eta_ex() const;
129
130//----------------------------------------------------------------------------
131
138 real
139 omega() const;
140
141//----------------------------------------------------------------------------
142
143 real
144 lambda_0() const;
145
146//----------------------------------------------------------------------------
147
152 real
153 lambda_cr( const real T, const real p ) const;
154
155//----------------------------------------------------------------------------
156
161 real
162 lambda_ex() const;
163
164//----------------------------------------------------------------------------
165
170 real
171 chi() const;
172
173//----------------------------------------------------------------------------
174
180 real
181 f() const;
182
183
184//----------------------------------------------------------------------------
185
186 void
187 update_Tp( const real T, const real p ) const;
188
189//----------------------------------------------------------------------------
190
191 bool
192 test( const index_t aIndex ) const ;
193
194//----------------------------------------------------------------------------
195
196 void
197 set( const index_t aIndex, const real aValue ) const ;
198
199//----------------------------------------------------------------------------
200
201 const real &
202 get( const index_t aIndex ) const ;
203
204//----------------------------------------------------------------------------
205 } ;
206
207//----------------------------------------------------------------------------
208
209 inline void
210 HelmholtzTransport_Methane::update_Tp( const real T, const real p ) const
211 {
212 BELFEM_ASSERT( T > 0, "Invalid temprerature" );
213 BELFEM_ASSERT( p > 0, "Invalid pressure" );
214 if( T != mVals[ BELFEM_METHANE_T ]
215 || p != mVals[ BELFEM_METHANE_P ] )
216 {
217 mBits.reset();
218
219 mVals[ BELFEM_METHANE_T ] = T ;
220 mVals[ BELFEM_METHANE_P ] = p ;
221 mVals[ BELFEM_METHANE_V ] = mEoS.v( T, p );
222
223 mVals[ BELFEM_METHANE_TAU ] = mTcrit / T ;
224 mVals[ BELFEM_METHANE_DELTA ] = mVcrit / mVals[ BELFEM_METHANE_V ] ;
225
226
227 mBits.set( BELFEM_METHANE_T );
228 mBits.set( BELFEM_METHANE_P );
229 mBits.set( BELFEM_METHANE_V );
230 mBits.set( BELFEM_METHANE_TAU );
231 mBits.set( BELFEM_METHANE_DELTA );
232 }
233 }
234
235//----------------------------------------------------------------------------
236
237 inline bool
238 HelmholtzTransport_Methane::test( const index_t aIndex ) const
239 {
241 "Invalid Methane transport state index: %u", ( unsigned int ) aIndex );
242
243 return mBits.test( aIndex );
244 }
245
246//----------------------------------------------------------------------------
247
248 inline void
249 HelmholtzTransport_Methane::set( const index_t aIndex, const real aValue ) const
250 {
252 "Invalid Methane transport state index: %u", ( unsigned int ) aIndex );
253
254 // set value
255 mVals[ aIndex ] = aValue;
256
257 // update flag
258 mBits.set( aIndex );
259 }
260
261//----------------------------------------------------------------------------
262
263 inline const real &
264 HelmholtzTransport_Methane::get( const index_t aIndex ) const
265 {
267 "Invalid Helmholtz state index: %u", ( unsigned int ) aIndex );
268
269 return mVals[ aIndex ];
270 }
271
272//----------------------------------------------------------------------------
273
274 }
275}
276
277#endif //BELFEM_CL_GM_HelmholtzTransportMETHANE_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
#define BELFEM_METHANE_V
Definition cl_GM_HelmholtzTransport_Methane.hpp:24
#define BELFEM_METHANE_TAU
Definition cl_GM_HelmholtzTransport_Methane.hpp:25
#define BELFEM_METHANE_DELTA
Definition cl_GM_HelmholtzTransport_Methane.hpp:26
#define BELFEM_METHANE_NUMVALS
Definition cl_GM_HelmholtzTransport_Methane.hpp:30
#define BELFEM_METHANE_P
Definition cl_GM_HelmholtzTransport_Methane.hpp:23
#define BELFEM_METHANE_T
Definition cl_GM_HelmholtzTransport_Methane.hpp:22
void reset(const index_t aIndex)
set a bit to false
Definition cl_Bitset.hpp:103
void set(const index_t aIndex)
set a bit to true
Definition cl_Bitset.hpp:92
bool test(const index_t aIndex) const
test if a bit is set
Definition cl_Bitset.hpp:138
The gas class that provides the fluid model.
Definition cl_Gas.hpp:81
real v(const real T, const real p) const
specific volume in m^3/kg
Definition cl_GM_Helmholtz.cpp:237
real lambda(const real T, const real p) const
Definition cl_GM_HelmholtzTransport_Methane.cpp:52
real mu(const real T, const real p) const
Definition cl_GM_HelmholtzTransport_Methane.cpp:38
HelmholtzTransport_Methane(Gas &aParent)
Definition cl_GM_HelmholtzTransport_Methane.cpp:22
HelmholtzTransport(Gas &aParent)
Definition cl_GM_HelmholtzTransport.cpp:35
Helmholtz & mEoS
Definition cl_GM_HelmholtzTransport.hpp:47
USER GUIDES:
Definition cl_Capacitor.cpp:16
uint32_t index_t
Definition typedefs.hpp:52
double real
Definition typedefs.hpp:36