Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
NASG.h
Go to the documentation of this file.
1/** @file NASG.h
2 */
3/**
4# The Noble-Abel Stiffened-Gas (NASG) Equation Of State
5
6This EOS is typically used in combination with the [two-phase
7compressible solver with thermal effects](/src/compressible/thermal.h).
8
9The general form of the NASG EOS ([Le Métayer & Saurel, 2016](#metayer2016)) is
10\f[
11\rho_i e_i = \frac{p_i + \Gamma_i \Pi_i}{\Gamma_i - 1}(1 - \rho_i b_i) + \rho_i q_i
12\f]
13with \f$\rho_i\f$, \f$e_i\f$ and \f$p_i\f$ the densities, internal energies and
14pressures of each phase.
15
16These are the coefficients of the NASG EOS for each phase. */
17
18double gamma1 = 1.4 [0], gamma2 = 1.4 [0], PI1 = 0., PI2 = 0.;
19double b1 = 0., b2 = 0.;
20double q1 = 0., q2 = 0.;
21double cv1 = 0., cv2 = 0.;
22
23/**
24## Sound speed
25
26In mixture cells, this function returns the maximum between the speeds
27in both phases. */
28
30{
31 double fc = clamp (f[],0.,1.);
32 double c2speed1 = 0., c2speed2 = 0.;
33
34 double Ek = 0.;
35 for (int _d = 0; _d < dimension; _d++)
36 Ek += sq(q.x[]);
37 Ek /= 2.*(frho1[] + frho2[]);
38
39 if (fc > 0.00001) {
40 double fe1 = fE1[] - fc*Ek;
41 double p = fe1/fc*(gamma1 - 1.) - gamma1*PI1;
42 c2speed1 = fc*gamma1*(p + PI1)/frho1[];
43 }
44
45 if (fc < 0.99999) {
46 double fe2 = fE2[] - (1. - fc)*Ek;
47 double p = fe2/(1. - fc)*(gamma2 - 1.) - gamma2*PI2;
48 c2speed2 = (1. - fc)*gamma2*(p + PI2)/frho2[];
49 }
50
51 return sqrt (max (c2speed1, c2speed2));
52}
53
54/**
55## Average pressure */
56
57#define PIGAMMA double invgammaavg = (fc - frho1[]*b1)/(gamma1 - 1.) + \
58 (1. - fc - frho2[]*b2)/(gamma2 - 1.), \
59 PIGAMMAavg = (fc - frho1[]*b1)*PI1*gamma1/(gamma1 - 1.) + frho1[]*q1 + \
60 (1. - fc - frho2[]*b2)*PI2*gamma2/(gamma2 - 1.) + frho2[]*q2
61
63{
64 double fc = clamp (f[],0.,1.);
65 PIGAMMA;
66 double Ek = 0.;
67 for (int _d = 0; _d < dimension; _d++)
68 Ek += sq(q.x[]);
69 Ek /= 2.*(frho1[] + frho2[]);
70 return (fE1[] + fE2[] - Ek - PIGAMMAavg)/invgammaavg;
71}
72
73/**
74## Bulk compressibility of the mixture
75
76i.e. \f$\rho c^2\f$. */
77
79{
80 double fc = clamp (f[],0.,1.);
81 // Arithmetic mean of the mixture compressibility
82 double rhoc2v1 = fc ? gamma1*(p[] + PI1)/(1. - frho1[]*b1/fc) : 1.;
83 double rhoc2v2 = (1. - fc) ? gamma2*(p[] + PI2)/(1. - frho2[]*b2/(1. - fc)) : 1.;
84 return fc*rhoc2v1 + (1. - fc)*rhoc2v2;
85}
86
87/**
88## Internal energy */
89
90double internal_energy (Point point, double fc)
91{
92 PIGAMMA;
93 return p[]*invgammaavg + PIGAMMAavg;
94}
95
96/**
97## Average temperature */
98
100{
101 double fc = clamp (f[],0.,1.);
102 double rhocpmcvavg = (cp1 - cv1)*frho1[] + (cp2 - cv2)*frho2[];
103 double const1 = (fc - frho1[]*b1) + (1. - fc - frho2[]*b2);
104 double const2 = (fc - frho1[]*b1)*PI1 + (1. - fc - frho2[]*b2)*PI2;
105 return (const1*p + const2)/rhocpmcvavg;
106}
107
108/**
109## Thermal expansion coefficient */
110
112{
113 double fc = clamp (f[],0.,1.);
114 return (1. - fc)*(gamma2 - 1.)*cv2/((gamma2 - 1.)*cv2*Ts[] + b2*(ps[] + PI2));
115}
116
117/**
118# See also
119
120* [The Mie-Gruneisen Equation Of State](Mie-Gruneisen.h)
121
122# References
123
124~~~bib
125@article{metayer2016,
126 title={The {N}oble--{A}bel stiffened-gas equation of state},
127 author={Le M{\'e}tayer, Olivier and Saurel, Richard},
128 journal={Physics of Fluids},
129 volume={28},
130 number={4},
131 year={2016},
132 publisher={AIP Publishing}
133}
134~~~
135*/
double gamma2
Definition NASG.h:18
double b2
Definition NASG.h:19
double sound_speed(Point point)
These functions are provided by the Equation Of State.
Definition NASG.h:29
double cv2
Definition NASG.h:21
double b1
Definition NASG.h:19
double thermal_expansion(Point point)
Definition NASG.h:111
double average_temperature(Point point, double p)
These functions are provided by the Equation Of State.
Definition NASG.h:99
double bulk_compressibility(Point point)
Definition NASG.h:78
double gamma1
Definition NASG.h:18
double PI1
Definition NASG.h:18
double q2
Definition NASG.h:20
#define PIGAMMA
Definition NASG.h:57
double PI2
Definition NASG.h:18
double cv1
Definition NASG.h:21
double average_pressure(Point point)
Definition NASG.h:62
double q1
Definition NASG.h:20
double internal_energy(Point point, double fc)
Definition NASG.h:90
vector q[]
The primitive variables are the momentum , pressure , density , (face) specific volume ,...
Definition all-mach.h:44
scalar ps[]
The equation of state is defined by the pressure field ps and .
Definition all-mach.h:57
#define dimension
Definition bitree.h:3
int x
Definition common.h:76
static number sq(number x)
Definition common.h:11
static number clamp(number x, number a, number b)
Definition common.h:15
scalar frho2[]
Definition two-phase.h:57
scalar frho1[]
Definition two-phase.h:57
scalar f[]
The primary fields are:
Definition two-phase.h:56
scalar fE2[]
Definition two-phase.h:57
scalar fE1[]
Definition two-phase.h:57
#define p
Definition tree.h:320
Point point
Definition conserving.h:86
size_t max
Definition mtrace.h:8
Definition linear.h:21
scalar x
Definition common.h:47
scalar Ts[]
Definition thermal.h:117
double cp2
Definition thermal.h:66
double cp1
Definition thermal.h:66