12#ifndef BELFEM_CL_GM_HELMHOLTZ_HPP
13#define BELFEM_CL_GM_HELMHOLTZ_HPP
22#define BELFEM_HELMHOLTZ_T 0
23#define BELFEM_HELMHOLTZ_P 1
24#define BELFEM_HELMHOLTZ_V 2
25#define BELFEM_HELMHOLTZ_TAU 3
26#define BELFEM_HELMHOLTZ_DELTA 4
27#define BELFEM_HELMHOLTZ_PHI0 5
28#define BELFEM_HELMHOLTZ_PHI0_T 6
29#define BELFEM_HELMHOLTZ_PHI0_TT 7
30#define BELFEM_HELMHOLTZ_PHIR 8
31#define BELFEM_HELMHOLTZ_PHIR_T 9
32#define BELFEM_HELMHOLTZ_PHIR_D 10
33#define BELFEM_HELMHOLTZ_PHIR_TT 11
34#define BELFEM_HELMHOLTZ_PHIR_DD 12
35#define BELFEM_HELMHOLTZ_PHIR_DT 13
36#define BELFEM_HELMHOLTZ_DPDV 14
37#define BELFEM_HELMHOLTZ_DPDT 15
38#define BELFEM_HELMHOLTZ_DVDT 16
39#define BELFEM_HELMHOLTZ_NUMVALS 17
381 test(
const index_t aIndex )
const ;
389 get(
const index_t aIndex )
const ;
397 set(
const index_t aIndex,
const real aValue )
const ;
540 const uint tN = n < 0 ? -n : n ;
549 return n < 0 ? 1.0 / tValue : tValue ;
591 Helmholtz::test(
const index_t aIndex )
const
594 "Invalid Helmholtz state index: %u", (
unsigned int ) aIndex );
596 return mHelmholtzBits.
test( aIndex );
602 Helmholtz::get(
const index_t aIndex )
const
605 "Invalid Helmholtz state index: %u", (
unsigned int ) aIndex );
607 return mHelmholtzVals[ aIndex ];
613 Helmholtz::set(
const index_t aIndex,
const real aValue )
const
616 "Invalid Helmholtz state index %u", (
unsigned int ) aIndex );
619 mHelmholtzVals[ aIndex ] = aValue;
622 mHelmholtzBits.
set( aIndex );
635 mHelmholtzBits.reset();
661 const real tV = this->
v(
T,
p );
663 mHelmholtzBits.reset();
689 return (
mNvap( 0 ) * std::pow( tTheta,
mKvap( 0 ) )
692 +
mNvap( 3 ) * std::pow( tTheta,
mKvap( 3 ) ) )
704 return (
mKvap( 0 ) *
mNvap( 0 ) * std::pow( tTheta,
mKvap( 0 ) - 1.0 )
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
#define BELFEM_HELMHOLTZ_P
Definition cl_GM_Helmholtz.hpp:23
#define BELFEM_HELMHOLTZ_TAU
Definition cl_GM_Helmholtz.hpp:25
#define BELFEM_HELMHOLTZ_V
Definition cl_GM_Helmholtz.hpp:24
#define BELFEM_HELMHOLTZ_DELTA
Definition cl_GM_Helmholtz.hpp:26
#define BELFEM_HELMHOLTZ_T
Definition cl_GM_Helmholtz.hpp:22
#define BELFEM_HELMHOLTZ_NUMVALS
Definition cl_GM_Helmholtz.hpp:39
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
cubic equation of state
Definition cl_GM_EoS_Cubic.hpp:38
EoS(Gas &aParent)
Definition cl_GM_EoS.cpp:22
const real & T_crit() const
critical temperature
Definition cl_GM_Helmholtz.hpp:575
const real & v_crit() const
critical volume
Definition cl_GM_Helmholtz.hpp:583
real beta(const real T, const real p) const
isochoric stress coefficient
Definition cl_GM_Helmholtz.cpp:216
void init_Tvap_poly()
Definition cl_GM_Helmholtz.cpp:119
void set_critical_point_in_data_object()
Definition cl_GM_Helmholtz.cpp:67
real s(const real T, const real p) const
Definition cl_GM_Helmholtz.cpp:371
real cp(const real T, const real p) const
Definition cl_GM_Helmholtz.cpp:392
real mPmax
Definition cl_GM_Helmholtz.hpp:138
Helmholtz(Gas &aParent, const string &aLabel)
Definition cl_GM_Helmholtz.cpp:25
real alpha(const real T, const real p) const
thermal expansion coefficient
Definition cl_GM_Helmholtz.cpp:207
void set_reference_point()
Definition cl_GM_Helmholtz.cpp:44
virtual real compute_phir_d() const
Definition cl_GM_Helmholtz.cpp:596
virtual real compute_phir() const
Definition cl_GM_Helmholtz.cpp:561
void eval_critical_point(real &T, real &p, real &v) const
return the critical point data
Definition cl_GM_Helmholtz.cpp:110
real mS0
Definition cl_GM_Helmholtz.hpp:87
real hvap(const real T, const real p) const
vaporization enthalpy in J/kg
Definition cl_GM_Helmholtz.cpp:692
virtual real compute_phi0_tt() const
Definition cl_GM_Helmholtz.cpp:584
virtual real p_vap(const real T) const
Definition cl_GM_Helmholtz.cpp:656
Vector< real > mTvap
Definition cl_GM_Helmholtz.hpp:78
Vector< real > mVliq
initial solution for inversion of pvap
Definition cl_GM_Helmholtz.hpp:81
virtual real dpvap_dT(const real T, const real aPvap, const real aPiVap) const
Definition cl_GM_Helmholtz.cpp:710
bool is_liquid(const real T, const real p) const
Definition cl_GM_Helmholtz.cpp:720
void remix()
this function remixes the cubic help gas
Definition cl_GM_Helmholtz.cpp:102
real p(const real T, const real v) const
pressure in Pa
Definition cl_GM_Helmholtz.cpp:148
virtual real psi_vap(const real T) const
Definition cl_GM_Helmholtz.hpp:700
real phi(const real T, const real v) const
the main energy function, where phi = f / ( R * T )
Definition cl_GM_Helmholtz.cpp:138
real u(const real T, const real p) const
Definition cl_GM_Helmholtz.cpp:350
real mTtriple
triple point in K
Definition cl_GM_Helmholtz.hpp:131
void delete_cubic_eos()
Definition cl_GM_Helmholtz.cpp:36
real mPcrit
critical pressure in Pa
Definition cl_GM_Helmholtz.hpp:122
real T(const real p, const real v) const
temperature in K
Definition cl_GM_Helmholtz.cpp:300
EoS_Cubic * mCubicEoS
Definition cl_GM_Helmholtz.hpp:74
real mU0
Definition cl_GM_Helmholtz.hpp:90
const real & T_min() const
minumum temperature for gas model ( triple point )
Definition cl_GM_Helmholtz.hpp:559
real kappa(const real T, const real p) const
isothermal compressibility coefficient
Definition cl_GM_Helmholtz.cpp:227
real mTmax
maximum temperature of gas model in K
Definition cl_GM_Helmholtz.hpp:134
const real & mTau
Definition cl_GM_Helmholtz.hpp:115
void update_Tv(const real T, const real v) const
reset all state variales
Definition cl_GM_Helmholtz.hpp:628
const real & phir_dd() const
Definition cl_GM_Helmholtz.cpp:502
const real & phir_t() const
Definition cl_GM_Helmholtz.cpp:514
const real & phi0() const
Definition cl_GM_Helmholtz.cpp:435
real dvdT(const real T, const real v) const
Definition cl_GM_Helmholtz.cpp:193
virtual ~Helmholtz()=default
Vector< real > mNvap
Definition cl_GM_Helmholtz.hpp:76
static real ipow(real x, uint n)
integer power by binary exponentiation, for the coefficient tables of the residual functions.
Definition cl_GM_Helmholtz.hpp:512
const real & T_max() const
maximum temperature for gas model
Definition cl_GM_Helmholtz.hpp:567
virtual real compute_phir_t() const
Definition cl_GM_Helmholtz.cpp:620
virtual real T_vap(const real p) const
Definition cl_GM_Helmholtz.cpp:664
const real & phir_tt() const
Definition cl_GM_Helmholtz.cpp:526
real dpdT(const real T, const real v) const
Definition cl_GM_Helmholtz.cpp:176
void update_Tp(const real T, const real p) const
Definition cl_GM_Helmholtz.hpp:652
real cv(const real T, const real p) const
Definition cl_GM_Helmholtz.cpp:383
virtual real compute_phir_tt() const
Definition cl_GM_Helmholtz.cpp:632
real mTcrit
critical temperature in K
Definition cl_GM_Helmholtz.hpp:119
static real hpow(const real x, const real sqrt_x, const int n)
x^( n / 2 ) for a signed half integer exponent given as n = 2j.
Definition cl_GM_Helmholtz.hpp:538
virtual real pi_vap(const real T) const
Definition cl_GM_Helmholtz.hpp:685
const real & mDelta
Definition cl_GM_Helmholtz.hpp:116
Vector< real > mKvap
Definition cl_GM_Helmholtz.hpp:77
real h(const real T, const real p) const
Definition cl_GM_Helmholtz.cpp:360
const real & phi0_t() const
Definition cl_GM_Helmholtz.cpp:450
real dsdT(const real T, const real p) const
Definition cl_GM_Helmholtz.cpp:417
real dsdp(const real T, const real p) const
Definition cl_GM_Helmholtz.cpp:425
real mH0
Definition cl_GM_Helmholtz.hpp:84
const real & phir_d() const
Definition cl_GM_Helmholtz.cpp:490
const real & phir_dt() const
Definition cl_GM_Helmholtz.cpp:538
const real & phir() const
the main energy function, real gas contribution
Definition cl_GM_Helmholtz.cpp:478
virtual real compute_phi0_t() const
Definition cl_GM_Helmholtz.cpp:572
const real & phi0_tt() const
Definition cl_GM_Helmholtz.cpp:464
real mRhocrit
critical density in kg/m^3
Definition cl_GM_Helmholtz.hpp:125
virtual real compute_phi0() const
Definition cl_GM_Helmholtz.cpp:550
const string mLabel
Definition cl_GM_Helmholtz.hpp:71
friend void deriv_test(Helmholtz &, Vector< real > &aR2)
virtual real compute_phir_dt() const
Definition cl_GM_Helmholtz.cpp:644
virtual real compute_phir_dd() const
Definition cl_GM_Helmholtz.cpp:608
real dpdv(const real T, const real v) const
Definition cl_GM_Helmholtz.cpp:158
real mVcrit
critical specific volume in m^3/kg
Definition cl_GM_Helmholtz.hpp:128
real v(const real T, const real p) const
specific volume in m^3/kg
Definition cl_GM_Helmholtz.cpp:237
real w(const real T, const real p) const
speed of sound in m/s ( helmholtz only )
Definition cl_GM_Helmholtz.cpp:404
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
#define BELFEM_REAL_MAX
Definition typedefs.hpp:81
#define BELFEM_QUIET_NAN
Definition typedefs.hpp:87