BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_GM_EoS_Cubic.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_CUBIC_HPP
13#define BELFEM_CL_GM_EOS_CUBIC_HPP
14
15#include "typedefs.hpp"
16#include "cl_Spline.hpp"
17#include "cl_GM_EoS.hpp"
18#include "en_GM_GasModel.hpp"
19#include "cl_Matrix.hpp"
20
21namespace belfem
22{
23 namespace gasmodels
24 {
25 class AlphaFunction;
26
27//----------------------------------------------------------------------------
28
37 class EoS_Cubic : public EoS
38 {
39//----------------------------------------------------------------------------
40 private:
41//----------------------------------------------------------------------------
42 // equation constants
43 real mR1;
44 real mR2;
45 real mOmegaA;
46 real mOmegaB;
47
50
51 // values of alpha, recomputed by eval_a for the current T
52 mutable Vector< real > mA;
53 mutable Vector< real > mdAdT;
54 mutable Vector< real > md2AdT2;
55
56 // b, b*r1, b*r2 and b*( r2 - r1 ), mixed in remix()
58
59 // alpha functions
61
63 mutable Vector< real > mCubicTemperatures;
64 mutable Vector< real > mCubicStatevals;
65
67 mutable Vector< real > mWorkA;
68 mutable Vector< real > mWorkZ;
69
71 mutable real mDepartureV;
72 mutable real mDepartureValue; // log( ( v - b*r2)/(v-b*r1))
73
74 // splines for departure function at p = gPref
75 Cell< Matrix<real> > mDepartureCoefficients;
76
77 Spline mDepartureSpline;
78
79 // component wise properties
81 mutable index_t mComponentCol; // column for departure spline
82 mutable real mComponentT = BELFEM_QUIET_NAN;
83 mutable real mComponentP = BELFEM_QUIET_NAN;
84 mutable Vector< real > mComponentHDEP;
85 mutable Vector< real > mComponentCPDEP;
86 mutable Vector< real > mComponentV;
87
88//----------------------------------------------------------------------------
89 public:
90//----------------------------------------------------------------------------
91
92 EoS_Cubic( Gas & aParent, const GasModel aGasModel );
93
94//----------------------------------------------------------------------------
95
96 ~EoS_Cubic();
97
98//----------------------------------------------------------------------------
99
100 void
101 remix();
102
103//----------------------------------------------------------------------------
104// Thermodynamic State
105//----------------------------------------------------------------------------
106
107 real
108 p( const real T, const real v ) const;
109
110 real
111 v( const real T, const real p ) const;
112
113 real
114 T( const real p, const real v ) const;
115
116//----------------------------------------------------------------------------
117// State Derivatives
118//----------------------------------------------------------------------------
123 real
124 dpdT( const real T, const real v ) const;
125
126//----------------------------------------------------------------------------
127
133 real
134 d2pdT2( const real T, const real v ) const;
135
136//----------------------------------------------------------------------------
137
143 real
144 dpdv( const real T, const real v ) const;
145
146//----------------------------------------------------------------------------
152 real
153 d2pdv2( const real T, const real v ) const;
154
155//------------------------------------------------------------------------------
156// Thermodynamic Coefficients
157//------------------------------------------------------------------------------
158
168 real
169 alpha( const real T, const real p ) const;
170
171//------------------------------------------------------------------------------
172
182 real
183 beta( const real T, const real p ) const;
184
185//------------------------------------------------------------------------------
186
196 real
197 kappa( const real T, const real p ) const;
198
199//------------------------------------------------------------------------------
200// Departure Functions
201//------------------------------------------------------------------------------
202
207 real
208 hdep( const real T, const real p ) const;
209
210//------------------------------------------------------------------------------
211
212 real
213 cpdep( const real T, const real p ) const;
214
215//------------------------------------------------------------------------------
216
217 real
218 sdep( const real T, const real p ) const;
219
220//------------------------------------------------------------------------------
221
222 // pressure derivative of enthalpy departure
223 real
224 dhdepdp( const real T, const real p ) const;
225
226//------------------------------------------------------------------------------
227
228 // temperature derivative of entropy departure
229 real
230 dsdepdT( const real T, const real p ) const;
231
232//------------------------------------------------------------------------------
233
234 // pressure derivative of entropy departure
235 real
236 dsdepdp( const real T, const real p ) const;
237
238//------------------------------------------------------------------------------
239
240 real
241 hdep0( const real T ) const;
242
243//------------------------------------------------------------------------------
244
245 real
246 cpdep0( const real T ) const;
247
248//------------------------------------------------------------------------------
249
250 real
251 sdep0( const real T ) const;
252
253//------------------------------------------------------------------------------
254
255 // temperature derivative of entropy departure
256 real
257 dsdepdT0( const real T ) const;
258
259//------------------------------------------------------------------------------
260
261 void
262 eval_critical_point( real & T, real & p, real & v ) const;
263
264//------------------------------------------------------------------------------
265// Component Wise Specific Volume and Departure Functions
266//------------------------------------------------------------------------------
267
268 real
269 v( const uint aIndex, const real T, const real p ) const;
270
271//------------------------------------------------------------------------------
272
273 real
274 hdep( const uint aIndex, const real T, const real p ) const;
275
276//------------------------------------------------------------------------------
277
278 real
279 cpdep( const uint aIndex, const real T, const real p ) const;
280
281//------------------------------------------------------------------------------
282 private:
283//------------------------------------------------------------------------------
284// INITIALIZATION
285//------------------------------------------------------------------------------
286
287 void
288 init_srk();
289
290//------------------------------------------------------------------------------
291
292 void
293 init_pr();
294
295//------------------------------------------------------------------------------
296
297 void
298 init_common();
299
300//------------------------------------------------------------------------------
301
302 void
303 init_departure_splines();
304
305//------------------------------------------------------------------------------
306// A-FACTOR
307//------------------------------------------------------------------------------
308
315 void
316 eval_a( const real T, const int aDeriv ) const;
317
318//------------------------------------------------------------------------------
319
323 real
324 a( const real T ) const;
325
326//------------------------------------------------------------------------------
327
331 real
332 dadT( const real T ) const;
333
334//------------------------------------------------------------------------------
335
339 real
340 d2adT2( const real T ) const;
341
342//------------------------------------------------------------------------------
343
349 real
350 chi( const real v ) const;
351
352
353 real
354 dchidT( const real T, const real p, const real v ) const;
355
356 real
357 dchidp( const real T, const real p, const real v ) const;
358
359//------------------------------------------------------------------------------
360// component wise density etc
361//------------------------------------------------------------------------------
362
363 void
364 component_wise_parameters(
365 const uint aIndex,
366 const real T,
367 const real p,
368 real & v,
369 real & aHDEP,
370 real & aCPDEP ) const;
371
372//------------------------------------------------------------------------------
373
374 void
375 update_component_parameters(
376 const real T,
377 const real p ) const;
378
379 };
380
381//----------------------------------------------------------------------------
382 } /* namespace gasmodels */
383} /* namespace belfem */
384#endif //BELFEM_CL_GM_EOS_CUBIC_HPP
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
The gas class that provides the fluid model.
Definition cl_Gas.hpp:81
Cubic spline on a uniform grid, C2, with natural, parabolic or clamped boundary conditions.
Definition cl_Spline.hpp:45
The Alpha function is part of the Cubic gas model.
Definition cl_GM_EoS_AlphaFunction.hpp:29
real hdep0(const real T) const
Definition cl_GM_EoS_Cubic.cpp:411
real cpdep0(const real T) const
Definition cl_GM_EoS_Cubic.cpp:419
real dhdepdp(const real T, const real p) const
Definition cl_GM_EoS_Cubic.cpp:347
real dsdepdT0(const real T) const
Definition cl_GM_EoS_Cubic.cpp:436
real dpdv(const real T, const real v) const
Definition cl_GM_EoS_Cubic.cpp:234
real kappa(const real T, const real p) const
isothermal compressibility coefficient
Definition cl_GM_EoS_Cubic.cpp:288
real sdep0(const real T) const
Definition cl_GM_EoS_Cubic.cpp:427
real dpdT(const real T, const real v) const
Definition cl_GM_EoS_Cubic.cpp:216
real beta(const real T, const real p) const
isochoric stress coefficient
Definition cl_GM_EoS_Cubic.cpp:271
real dsdepdT(const real T, const real p) const
Definition cl_GM_EoS_Cubic.cpp:364
void remix()
call the remix function of the equation of state
Definition cl_GM_EoS_Cubic.cpp:69
real cpdep(const real T, const real p) const
Definition cl_GM_EoS_Cubic.cpp:320
real d2pdT2(const real T, const real v) const
Definition cl_GM_EoS_Cubic.cpp:225
real T(const real p, const real v) const
temperature in K
Definition cl_GM_EoS_Cubic.cpp:204
EoS_Cubic(Gas &aParent, const GasModel aGasModel)
Definition cl_GM_EoS_Cubic.cpp:30
real sdep(const real T, const real p) const
Definition cl_GM_EoS_Cubic.cpp:334
real dsdepdp(const real T, const real p) const
Definition cl_GM_EoS_Cubic.cpp:377
real hdep(const real T, const real p) const
enthalpy departure
Definition cl_GM_EoS_Cubic.cpp:309
real p(const real T, const real v) const
pressure in Pa
Definition cl_GM_EoS_Cubic.cpp:122
real alpha(const real T, const real p) const
thermal expansion coefficient
Definition cl_GM_EoS_Cubic.cpp:255
void eval_critical_point(real &T, real &p, real &v) const
Definition cl_GM_EoS_Cubic.cpp:798
real d2pdv2(const real T, const real v) const
Definition cl_GM_EoS_Cubic.cpp:244
real v(const real T, const real p) const
specific volume in m^3/kg
Definition cl_GM_EoS_Cubic.cpp:131
EoS(Gas &aParent)
Definition cl_GM_EoS.cpp:22
Definition cl_Gas.hpp:42
USER GUIDES:
Definition cl_Capacitor.cpp:16
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
#define BELFEM_QUIET_NAN
Definition typedefs.hpp:87