BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_GM_EoS_AlphaFunction.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_EOS_ALPHAFUNCTION_HPP
13#define BELFEM_CL_GM_EOS_ALPHAFUNCTION_HPP
14
15
16#include "typedefs.hpp"
17#include "cl_Vector.hpp"
18
19namespace belfem
20{
21 namespace gasmodels
22 {
23//----------------------------------------------------------------------------
24
29 {
30//----------------------------------------------------------------------------
31 protected:
32//----------------------------------------------------------------------------
33
35 const real mTcrit;
36
39
41 mutable real mT[ 3 ] = { 0.0 };
42
43 // constants to be used by the function
44 const real mC1;
45 const real mC2;
46 const real mC3;
47
51 mutable real mAlpha[ 3 ];
52
53 // help values
54 mutable real mWork[ 4 ];
55
56 // temperature with minimal alpha
59
60//----------------------------------------------------------------------------
61 public:
62//----------------------------------------------------------------------------
63
66
67//----------------------------------------------------------------------------
68
72 AlphaFunction( const real aTcrit, const Vector< real > & aCoeffs );
73
74//----------------------------------------------------------------------------
75
80 const real aTcrit,
81 const real & c1,
82 const real & c2,
83 const real & c3 );
84
85//----------------------------------------------------------------------------
86
87 virtual ~AlphaFunction() = default;
88
89//----------------------------------------------------------------------------
90
91
92 virtual real
93 alpha( const real T ) const;
94
95//----------------------------------------------------------------------------
96
97 virtual real
98 dalphadT( const real T ) const;
99
100//----------------------------------------------------------------------------
101
102 virtual real
103 d2alphadT2( const real T ) const;
104
105//----------------------------------------------------------------------------
106 protected:
107//----------------------------------------------------------------------------
108
109 virtual void
110 eval( const real T, const int aDeriv ) const;
111
112
113//----------------------------------------------------------------------------
114
115 void
116 find_minimum();
117
118//----------------------------------------------------------------------------
119 };
120
121//----------------------------------------------------------------------------
122
127 {
128//----------------------------------------------------------------------------
129 public:
130//----------------------------------------------------------------------------
131
133
134//----------------------------------------------------------------------------
135 real
136 alpha( const real T ) const;
137
138//----------------------------------------------------------------------------
139
140 real
141 dalphadT( const real T ) const;
142
143//----------------------------------------------------------------------------
144
145 real
146 d2alphadT2( const real T ) const;
147 };
148
149//----------------------------------------------------------------------------
150
151 /*
152 * The classic alpha function
153 *
154 */
156 {
157
158//----------------------------------------------------------------------------
159 public:
160//----------------------------------------------------------------------------
161
163 const real aTcrit,
164 const real & c1,
165 const real & c2 );
166
167//----------------------------------------------------------------------------
168 protected:
169//----------------------------------------------------------------------------
170
171 void
172 eval( const real T, const int aDeriv ) const;
173
174//----------------------------------------------------------------------------
175 };
176//----------------------------------------------------------------------------
177 /*
178 * Coquelet, Chapoy, Richon for SRK
179 * based on Mathias and Coepman, but cut off where dalpha/dT = 0
180 *
181 * 10.1023/B:IJOT.0000022331.46865.2f
182 * 10.1016/0378-3812(83)80084-3
183 */
185 {
186 mutable real mX[4];
187 mutable real mF[3];
188
189//----------------------------------------------------------------------------
190 public:
191//----------------------------------------------------------------------------
192
194 const real aTcrit,
195 const real & c1,
196 const real & c2,
197 const real & c3 );
198
199//----------------------------------------------------------------------------
200 protected:
201//----------------------------------------------------------------------------
202
203 void
204 eval( const real T, const int aDeriv ) const;
205
206 };
207
208//----------------------------------------------------------------------------
209
210 /*
211 * Coquelet, Chapoy, Richon for Peng Robinson
212 *
213 * 10.1023/B:IJOT.0000022331.46865.2f
214 *
215 */
217 {
218 // c1*( 1-T/Tcrit ) and derivatives
219 mutable real mF[2];
220
221 // 1 + c2*(1-sqrt(T/Tcrit))^2 + c3*(1-sqrt(T/Tcrit))^3
222 mutable real mG[3];
223
224//----------------------------------------------------------------------------
225 public:
226//----------------------------------------------------------------------------
227
229 const real aTcrit,
230 const real & c1,
231 const real & c2,
232 const real & c3 );
233
234//----------------------------------------------------------------------------
235 protected:
236//----------------------------------------------------------------------------
237
238 void
239 eval( const real T, const int aDeriv ) const;
240
241 };
242//----------------------------------------------------------------------------
243
251 {
252 // 0 : f ( help function )
253 // 1 : dfdT
254 // 2 : d2fdT
255 mutable real mF[ 3 ];
256
257 // sqrt( T / T_crit )
258 mutable real mX;
259
260 // 0 : Y ( help function )
261 // 1 : dYdT
262 // 2 : d2YdTh
263 mutable real mY[ 3 ];
264
265//----------------------------------------------------------------------------
266 public:
267//----------------------------------------------------------------------------
268
270 const real aTcrit,
271 const Vector< real > & aCoeffs );
272
273//----------------------------------------------------------------------------
274 protected:
275//----------------------------------------------------------------------------
276
277 void
278 eval( const real T, const int aDeriv ) const;
279
280//----------------------------------------------------------------------------
281 };
282//----------------------------------------------------------------------------
283 } /* namespace gasmodels */
284} /* namespace belfem */
285
286#endif //BELFEM_CL_GM_EOS_ALPHAFUNCTION_HPP
void eval(const real T, const int aDeriv) const
Definition cl_GM_EoS_AlphaFunction.cpp:367
AlphaFunction_CCR(const real aTcrit, const real &c1, const real &c2, const real &c3)
Definition cl_GM_EoS_AlphaFunction.cpp:352
void eval(const real T, const int aDeriv) const
Definition cl_GM_EoS_AlphaFunction.cpp:205
AlphaFunction_Classic(const real aTcrit, const real &c1, const real &c2)
Definition cl_GM_EoS_AlphaFunction.cpp:191
real alpha(const real T) const
Definition cl_GM_EoS_AlphaFunction.cpp:168
real d2alphadT2(const real T) const
Definition cl_GM_EoS_AlphaFunction.cpp:184
real dalphadT(const real T) const
Definition cl_GM_EoS_AlphaFunction.cpp:176
AlphaFunction_Empty()
Definition cl_GM_EoS_AlphaFunction.cpp:160
void eval(const real T, const int aDeriv) const
Definition cl_GM_EoS_AlphaFunction.cpp:263
AlphaFunction_MC(const real aTcrit, const real &c1, const real &c2, const real &c3)
Definition cl_GM_EoS_AlphaFunction.cpp:247
AlphaFunction_PM(const real aTcrit, const Vector< real > &aCoeffs)
Definition cl_GM_EoS_AlphaFunction.cpp:457
void eval(const real T, const int aDeriv) const
Definition cl_GM_EoS_AlphaFunction.cpp:466
real mAlphaMin
Definition cl_GM_EoS_AlphaFunction.hpp:58
const real mInvTcrit
inverse of critical temperature
Definition cl_GM_EoS_AlphaFunction.hpp:38
real mT[3]
last used T
Definition cl_GM_EoS_AlphaFunction.hpp:41
virtual real alpha(const real T) const
Definition cl_GM_EoS_AlphaFunction.cpp:65
real mTmin
Definition cl_GM_EoS_AlphaFunction.hpp:57
const real mTcrit
critical temperature
Definition cl_GM_EoS_AlphaFunction.hpp:35
virtual real d2alphadT2(const real T) const
Definition cl_GM_EoS_AlphaFunction.cpp:85
real mWork[4]
Definition cl_GM_EoS_AlphaFunction.hpp:54
AlphaFunction()
empty constructor
Definition cl_GM_EoS_AlphaFunction.cpp:22
const real mC2
Definition cl_GM_EoS_AlphaFunction.hpp:45
void find_minimum()
Definition cl_GM_EoS_AlphaFunction.cpp:103
real mAlpha[3]
Definition cl_GM_EoS_AlphaFunction.hpp:51
virtual ~AlphaFunction()=default
const real mC3
Definition cl_GM_EoS_AlphaFunction.hpp:46
virtual void eval(const real T, const int aDeriv) const
Definition cl_GM_EoS_AlphaFunction.cpp:95
virtual real dalphadT(const real T) const
Definition cl_GM_EoS_AlphaFunction.cpp:75
const real mC1
Definition cl_GM_EoS_AlphaFunction.hpp:44
Definition cl_Gas.hpp:42
USER GUIDES:
Definition cl_Capacitor.cpp:16
double real
Definition typedefs.hpp:36