Skip to content

Commit 90e7343

Browse files
JRChreimRasmitDevkotahenryleberrewilfonbasbryngelson
authored
Phase Change addition (#179)
Co-authored-by: RasmitDevkota <[email protected]> Co-authored-by: Rasmit Devkota <[email protected]> Co-authored-by: Henry LE BERRE <[email protected]> Co-authored-by: Ben Wilfong <[email protected]> Co-authored-by: Spencer Bryngelson <[email protected]>
1 parent 1fbdfa5 commit 90e7343

File tree

256 files changed

+5629
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+5629
-158
lines changed

docs/documentation/case.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ There are multiple sets of parameters that must be specified in the python input
7878
7. [(Optional) Acoustic Source Parameters](#7-acoustic-source)
7979
8. [(Optional) Ensemble-Averaged Bubble Model Parameters](#8-ensemble-averaged-bubble-model)
8080
9. [(Optional) Velocity Field Setup Parameters](#9-velocity-field-setup)
81+
10. [(Optional) Phase Change Parameters](#10-Phase-Change-Model)
8182

82-
Items 7, 8, and 9 are optional sets of parameters that activate the acoustic source model, ensemble-averaged bubble model, and initial velocity field setup, respectively.
83+
Items 7, 8, 9, and 10 are optional sets of parameters that activate the acoustic source model, ensemble-averaged bubble model, initial velocity field setup, and phase change, respectively.
8384
Definition of the parameters is described in the following subsections.
8485

8586
### 1. Runtime
@@ -276,20 +277,28 @@ See also `adv_alphan` in table [Simulation Algorithm Parameters](#5-simulation-a
276277
| `pi_inf` | Real | Stiffened-gas parameter $\Pi_\infty$ of fluid. |
277278
| `Re(1)` * | Real | Shear viscosity of fluid. |
278279
| `Re(2)` * | Real | Volume viscosity of fluid. |
280+
| `cv` ** | Real | Sffened-gas parameter $c_v$ of fluid. |
281+
| `qv` ** | Real | Stiffened-gas parameter $q$ of fluid. |
282+
| `qvp` ** | Real | Stiffened-gas parameter $q'$ of fluid. |
279283

280284
Fluid material's parameters. All parameters should be prepended with `fluid_pp(i)` where $i$ is the fluid index.
281285

282286
*: Parameters that work only with `model_eqns`=2.
283287

288+
**: Parameters that work only with `model_eqns`=3.
289+
284290
The table lists the fluid material's parameters.
285291
The parameters define material's property of compressible fluids that are used in simulation.
286292

287293
- `fluid_pp(i)%gamma` and `fluid_pp(i)%pi_inf` define $\Gamma$ and $\Pi$ as parameters of $i$-th fluid that are used in stiffened gas equation of state.
288294

289295
- `fluid_pp(i)%Re(1)` and `fluid_pp(i)%Re(2)` define the shear and volume viscosities of $i$-th fluid, respectively.
296+
290297
When these parameters are undefined, fluids are treated as inviscid.
291298
Details of implementation of viscosity in MFC can be found in [Coralic (2015)](references.md#Coralic15).
292299

300+
- `fluid_pp(i)%cv`, `fluid_pp(i)%qv`, and `fluid_pp(i)%qvp` define $c_v$, $q$, and $q'$ as parameters of $i$-th fluid that are used in stiffened gas equation of state.
301+
293302
### 5. Simulation Algorithm
294303

295304
| Parameter | Type | Description |
@@ -578,6 +587,21 @@ The parameters are optionally used to define initial velocity profiles and pertu
578587
- `instability_wave` activates the perturbation of initial velocity by instability waves obtained from linear stability analysis for a mixing layer with hyperbolic tangent mean streamwise velocity profile.
579588
This option only works for 2D and 3D cases, together with `vel_profile = TRUE`.
580589

590+
### 10. Phase Change Model
591+
| Parameter | Type | Description |
592+
| ---: | :----: | :--- |
593+
| `relax` | Logical | Activates Phase Change model |
594+
| `relax_model` | Integer | Phase change model: [5] pT-equilibrium; [6] pTg-equilibrium |
595+
| `palpha_eps` | Real | tolerance of the Newton Solver to activate pT-equilibrium |
596+
| `ptgalpha_eps` | Real | tolerance of the Newton Solver to activate pTg-equilibrium |
597+
598+
- `relax` Activates the Phase Change model.
599+
600+
- `relax_model` Specifies the phase change model to be used: [5] enables pT-equilibrium, while [6] activates pTg-equilibrium (if criteria are met).
601+
602+
- `palpha_eps` Specifies the tolerance used for the Newton Solvers used in the pT-equilibrium model.
603+
604+
- `ptgalpha_eps` Specifies the tolerance used for the Newton Solvers used in the pTg-equilibrium model.
581605

582606
## Enumerations
583607

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
#!/usr/bin/env python3
2+
import math, json
3+
4+
# Pressure
5+
p01 = 1.175435854855077e+05
6+
7+
# AIR
8+
#density
9+
rho0a1 = 1.077440586592175
10+
11+
# pi infinity
12+
pia = 0
13+
# qv
14+
qva = 0E0
15+
# qv'
16+
qvpa = 0E0
17+
# cv
18+
cva = 717.5
19+
# cp
20+
cpa = 1006
21+
# gamma
22+
gama = cpa / cva
23+
# Speed of sound
24+
c_a = math.sqrt( gama * ( p01 + pia ) / rho0a1 )
25+
26+
# liquid water
27+
# density
28+
rho0wl1 = 1.079065851351639e+03
29+
30+
# pi infty
31+
piwl = 1.0E+09
32+
# qv
33+
qvwl = -1167000
34+
# qv'
35+
qvpwl = 0.0E0
36+
# cv
37+
cvwl = 1816
38+
# cp
39+
cpwl = 4267
40+
# gamma
41+
gamwl = cpwl / cvwl
42+
# speed of sound
43+
c_wl = math.sqrt( gamwl * ( p01 + piwl ) / rho0wl1 )
44+
45+
# Vapor water
46+
# density
47+
rho0wv1 = 0.695395098952667
48+
49+
# pi infinity
50+
piwv = 0
51+
# qv
52+
qvwv = 2030000
53+
# qv'
54+
qvpwv = -23400
55+
# cv
56+
cvwv = 1040
57+
# cp
58+
cpwv = 1487
59+
# gamma
60+
gamwv = cpwv / cvwv
61+
# speed of sound
62+
c_wv = math.sqrt( gamwv * ( p01 + piwv ) / rho0wv1 )
63+
64+
# Mach number of the shocked region - this should agree with Min, if everything is correct
65+
Ms = 2.0
66+
67+
ss = Ms * c_a
68+
69+
vel = 2.0E+0
70+
71+
# domain boundaries
72+
xb = 0.0
73+
xe = 1.0
74+
75+
# CFL
76+
cfl = 0.40
77+
78+
# Number of elements into the x direction
79+
Nx = 200
80+
81+
dx = ( xe - xb ) / Nx
82+
dt = cfl * dx / ss
83+
84+
# save frequency = SF + 1 (because the initial state, 0.dat, is also saved)
85+
SF = 200
86+
87+
# making Nt divisible by SF
88+
tendA = ( xe - xb ) / ss * 0.25
89+
90+
# 1 - ensure NtA is sufficient to go a little beyond tendA
91+
NtA = int( tendA//dt + 1 )
92+
93+
# Array of saves. it is the same as Nt/Sf = t_step_save
94+
AS = int( NtA // SF + 1 )
95+
96+
# Nt = total number of steps. Ensure Nt > NtA (so the total tendA is covered)
97+
Nt = AS * SF
98+
99+
tend = Nt * dt
100+
101+
# patch properties: aFN in which F is the Fluid and N is the patch number
102+
awl1 = 0.849964400537437
103+
104+
awv1 = 0.029353906292532
105+
106+
aa1 = 1 - awl1 - awv1
107+
108+
# Configuring case dictionary ==================================================
109+
print(json.dumps({
110+
# Logistics ================================================
111+
'run_time_info': 'T',
112+
# ==========================================================
113+
# Computational Domain Parameters ==========================
114+
'x_domain%beg' : xb,
115+
'x_domain%end' : xe,
116+
'm' : Nx,
117+
'n' : 0,
118+
'p' : 0,
119+
'dt' : dt,
120+
't_step_start' : 0,
121+
't_step_stop' : Nt,
122+
't_step_save' : AS,
123+
# ==========================================================
124+
# Simulation Algorithm Parameters ==========================
125+
'num_patches' : 2,
126+
'model_eqns' : 3,
127+
'num_fluids' : 3,
128+
'adv_alphan' : 'T',
129+
'mpp_lim' : 'T',
130+
'mixture_err' : 'T',
131+
'relax' : 'T',
132+
'relax_model' : 6,
133+
'palpha_eps' : 1.0E-2,
134+
'ptgalpha_eps' : 1.0E-2,
135+
'time_stepper' : 3,
136+
'weno_order' : 3,
137+
'weno_eps' : 1.0E-16,
138+
'mapped_weno' : 'T',
139+
'null_weights' : 'F',
140+
'mp_weno' : 'F',
141+
'riemann_solver' : 2,
142+
'wave_speeds' : 1,
143+
'avg_state' : 2,
144+
'bc_x%beg' : -3,
145+
'bc_x%end' : -3,
146+
# ==========================================================
147+
# Formatted Database Files Structure Parameters ============
148+
'format' : 1,
149+
'precision' : 2,
150+
'prim_vars_wrt':'T',
151+
'parallel_io' :'T',
152+
# ==========================================================
153+
# Patch 1 - Shocked Stated ====================================
154+
'patch_icpp(1)%geometry' : 1,
155+
'patch_icpp(1)%x_centroid' : ( xe + xb ) * 1 / 4,
156+
'patch_icpp(1)%length_x' : ( xe - xb ) * 1 / 2,
157+
'patch_icpp(1)%vel(1)' : -vel,
158+
'patch_icpp(1)%pres' : p01,
159+
'patch_icpp(1)%alpha_rho(1)' : awl1 * rho0wl1,
160+
'patch_icpp(1)%alpha_rho(2)' : awv1 * rho0wv1,
161+
'patch_icpp(1)%alpha_rho(3)' : aa1 * rho0a1,
162+
'patch_icpp(1)%alpha(1)' : awl1,
163+
'patch_icpp(1)%alpha(2)' : awv1,
164+
'patch_icpp(1)%alpha(3)' : aa1,
165+
# ==========================================================
166+
# Patch 2 R ================================================
167+
'patch_icpp(2)%geometry' : 1,
168+
'patch_icpp(2)%x_centroid' : ( xe + xb ) * 3 / 4,
169+
'patch_icpp(2)%length_x' : ( xe - xb ) * 1 / 2,
170+
'patch_icpp(2)%vel(1)' : vel,
171+
'patch_icpp(2)%pres' : p01,
172+
'patch_icpp(2)%alpha_rho(1)' : awl1 * rho0wl1,
173+
'patch_icpp(2)%alpha_rho(2)' : awv1 * rho0wv1,
174+
'patch_icpp(2)%alpha_rho(3)' : aa1 * rho0a1,
175+
'patch_icpp(2)%alpha(1)' : awl1,
176+
'patch_icpp(2)%alpha(2)' : awv1,
177+
'patch_icpp(2)%alpha(3)' : aa1,
178+
# ==========================================================
179+
# Fluids Physical Parameters ===============================
180+
'fluid_pp(1)%gamma' : 1.0E+00 / ( gamwl - 1 ),
181+
'fluid_pp(1)%pi_inf' : gamwl * piwl / ( gamwl - 1 ),
182+
'fluid_pp(1)%cv' : cvwl,
183+
'fluid_pp(1)%qv' : qvwl,
184+
'fluid_pp(1)%qvp' : qvpwl,
185+
'fluid_pp(2)%gamma' : 1.0E+00 / ( gamwv - 1 ),
186+
'fluid_pp(2)%pi_inf' : gamwv * piwv / ( gamwv - 1 ),
187+
'fluid_pp(2)%cv' : cvwv,
188+
'fluid_pp(2)%qv' : qvwv,
189+
'fluid_pp(2)%qvp' : qvpwv,
190+
'fluid_pp(3)%gamma' : 1.0E+00 / ( gama - 1 ),
191+
'fluid_pp(3)%pi_inf' : gama * pia / ( gama - 1 ),
192+
'fluid_pp(3)%cv' : cva,
193+
'fluid_pp(3)%qv' : qva,
194+
'fluid_pp(3)%qvp' : qvpa,
195+
# ==========================================================
196+
}))

0 commit comments

Comments
 (0)