Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
Mie-Gruneisen.h
Go to the documentation of this file.
1/** @file Mie-Gruneisen.h
2 */
3/**
4# The Mie--Gruneisen Equation of State
5
6This EOS is typically used in combination with the
7[two-phase compressible solver](/src/compressible/two-phase.h).
8
9The general form of the
10[Mie--Gruneisen](https://en.wikipedia.org/wiki/Mie%E2%80%93Gr%C3%BCneisen_equation_of_state)
11EOS can be written
12\f[
13\rho_i e_i = \frac{p_i + \Gamma_i \Pi_i}{\Gamma_i - 1}
14\f]
15with \f$\rho_i\f$, \f$e_i\f$ and \f$p_i\f$ the densities, internal energies and
16pressures of each phase.
17
18These are the coefficients of the Mie-Gruneisen EOS for each phase. */
19
20double gamma1 = 1.4 [0], gamma2 = 1.4 [0], PI1 = 0., PI2 = 0.;
21
22/**
23## Sound speed
24
25In mixture cells, this function returns the maximum between the speeds
26in both phases. */
27
29{
30 double fc = clamp (f[],0.,1.);
31 double c2speed1 = 0., c2speed2 = 0.;
32
33 double Ek = 0.;
34 for (int _d = 0; _d < dimension; _d++)
35 Ek += sq(q.x[]);
36 Ek /= 2.*(frho1[] + frho2[]);
37
38 if (fc > 0.00001) {
39 double fe1 = fE1[] - fc*Ek;
40 double p = fe1/fc*(gamma1 - 1.) - gamma1*PI1;
41 c2speed1 = fc*gamma1*(p + PI1)/frho1[];
42 }
43
44 if (fc < 0.99999) {
45 double fe2 = fE2[] - (1. - fc)*Ek;
46 double p = fe2/(1. - fc)*(gamma2 - 1.) - gamma2*PI2;
47 c2speed2 = (1. - fc)*gamma2*(p + PI2)/frho2[];
48 }
49
50 return sqrt (max (c2speed1, c2speed2));
51}
52
53/**
54## Average pressure */
55
56#define PIGAMMA double invgammaavg = fc/(gamma1 - 1.) + (1. - fc)/(gamma2 - 1.), \
57 PIGAMMAavg = fc*PI1*gamma1/(gamma1 - 1.) + (1. - fc)*PI2*gamma2/(gamma2 - 1.)
58
60{
61 double fc = clamp (f[],0.,1.);
62 PIGAMMA;
63 double Ek = 0.;
64 for (int _d = 0; _d < dimension; _d++)
65 Ek += sq(q.x[]);
66 Ek /= 2.*(frho1[] + frho2[]);
67 return (fE1[] + fE2[] - Ek - PIGAMMAavg)/invgammaavg;
68}
69
70/**
71## Bulk compressibility of the mixture
72
73i.e. \f$\rho c^2\f$. */
74
76{
77 double fc = clamp (f[],0.,1.);
78 PIGAMMA;
79 return (p[]*(invgammaavg + 1.) + PIGAMMAavg)/invgammaavg;
80}
81
82/**
83## Internal energy */
84
85double internal_energy (Point point, double fc)
86{
87 PIGAMMA;
88 return p[]*invgammaavg + PIGAMMAavg;
89}
double gamma2
double sound_speed(Point point)
These functions are provided by the Equation Of State.
double bulk_compressibility(Point point)
double gamma1
double PI1
#define PIGAMMA
double PI2
double average_pressure(Point point)
double internal_energy(Point point, double fc)
vector q[]
The primitive variables are the momentum , pressure , density , (face) specific volume ,...
Definition all-mach.h:44
#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