Skip to content

Commit a4ad261

Browse files
authored
One benchmark case (short) (#321)
1 parent 7d71dfa commit a4ad261

File tree

2 files changed

+293
-4
lines changed

2 files changed

+293
-4
lines changed

benchmarks/3D_shockdroplet/case.py

Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
#!/usr/bin/env python3
2+
3+
import math
4+
import json
5+
6+
# athmospheric pressure - Pa (used as reference value)
7+
patm = 101325
8+
9+
# Initial Droplet Diameter / Reference length - m
10+
D0 = 1.0E-3
11+
12+
# cavity to droplet ratio
13+
CtD = 0.06
14+
15+
# cavity relative eccentricity (distance between radii)
16+
ecc = 0.564
17+
18+
# initial shock distance from the y axis. Note that the droplet center is located at y = 0. Thus, the distance from the shock to
19+
# the droplet is about D0/8
20+
ISD = 5.0/8 * D0
21+
22+
## pre-shock properties - AIR
23+
24+
# pressure - Pa
25+
p0a = patm
26+
27+
# density - kg/m3
28+
rho0a = 1.204
29+
30+
# gamma
31+
gama = 1.40
32+
33+
# pi infinity - Pa
34+
pia = 0
35+
36+
# speed of sound - M/s
37+
c_a = math.sqrt( gama * ( p0a + pia ) / rho0a )
38+
39+
## Droplet - WATER
40+
41+
# surface tension - N / m
42+
st = 0.00E+0
43+
44+
# Delta Pressure - Pa
45+
DP = -st * 4 / D0
46+
47+
# initial pressure inside the droplet - Pa
48+
p0w = p0a - DP
49+
50+
# density - kg/m3
51+
rho0w = 1000
52+
53+
# gama
54+
gamw = 6.12
55+
56+
# pi infty - Pa
57+
piw = 3.43E+08
58+
59+
# speed of sound - m/s
60+
c_w = math.sqrt( gamw * ( p0w + piw ) / rho0w )
61+
62+
# Shock Mach number of interest. Note that the post-shock properties can be defined in terms of either
63+
# Min or psOp0a. Just comment/uncomment appropriatelly
64+
Min = 2.4
65+
66+
## Pos to pre shock ratios - AIR
67+
68+
# pressure
69+
psOp0a = ( Min ** 2 -1 ) * 2 * gama / ( gama + 1 ) + 1
70+
# psOp0a = 4.5
71+
72+
# density
73+
rhosOrho0a = ( 1 + ( gama + 1 ) / ( gama - 1) * psOp0a ) / ( ( gama + 1 ) / ( gama - 1) + psOp0a )
74+
75+
# Mach number of the shocked region - just a checker, as it must return "Min"
76+
Ms = math.sqrt( ( gama + 1. ) / ( 2. * gama ) * ( psOp0a - 1. ) * ( p0a / ( p0a + pia ) ) + 1. )
77+
78+
# shock speed of sound - m/s
79+
ss = Ms * c_a
80+
81+
## post-shock - AIR
82+
83+
# pressure - Pa
84+
ps = psOp0a * p0a
85+
86+
# density - kg / m3
87+
rhos = rhosOrho0a * rho0a
88+
89+
# post shock speed of sound - m/s
90+
c_s = math.sqrt( gama * (ps + pia) / rhos )
91+
92+
# velocity at the post shock - m/s
93+
vel = c_a/gama * (psOp0a - 1.) * p0a / ( p0a + pia ) / Ms
94+
95+
## Domain boundaries - m
96+
97+
# x direction
98+
xb = -8.4707 * D0
99+
xe = 9.6226 * D0
100+
101+
#xb = -10 * D0
102+
#xe = 10 * D0
103+
104+
# y direction
105+
yb = 0 * D0
106+
ye = 10 * D0
107+
108+
# y direction
109+
zb = 0 * D0
110+
ze = 10 * D0
111+
112+
# Stretching factor, to make sure the domaing is sufficiently large after the mesh stretch
113+
StF = 4.0
114+
115+
# number of elements into y direction
116+
Ny = 100
117+
118+
# number of elements into z direction
119+
Nz = 100
120+
121+
# number of elements into x direction
122+
Nx = Ny * 2
123+
124+
# grid delta x if mesh were uniform in x direction - m. Note that I do not need a measure for dy
125+
dx = ( xe - xb ) / Nx
126+
127+
# I calculating tend twice; first is an estimate, second is
128+
# the actual value used. This is because I am getting errors in the
129+
# post process part every time I approximate the actual Nt by an integer
130+
# number (think of a smarter way).
131+
132+
# dimensionless time
133+
ttilde = 1.92
134+
135+
# auxiliary simulation physical time - s. This is not YET the total simulation time, as it will be corrected so as to avoid
136+
# mismatches in simulation and post_process parts. Note that I wrote it this way so I have better control over the # of autosaves
137+
tendA = ttilde * D0 / vel
138+
139+
# "CFL" number that I use to control both temporal and spatial discretizations, such that the ratio dx/dt remains constant for a given
140+
# simulation
141+
cfl = 0.05
142+
143+
# time-step - s
144+
dt = cfl * dx/ ss
145+
146+
# Save Frequency. Note that the number of autosaves will be SF + 1, as th IC (0.dat) is also saved
147+
SF = 400
148+
149+
## making Nt divisible by SF
150+
# 1 - ensure NtA goes slightly beyond tendA
151+
NtA = int( tendA//dt + 1 )
152+
153+
# Array of saves. It is the same as Nt/Sf = t_step_save
154+
AS = int( NtA // SF + 1 )
155+
156+
# Nt = total number of steps. Note that Nt >= NtA (so at least tendA is completely simulated)
157+
Nt = AS * SF
158+
159+
# total simulation time - s. Note that tend >= tendA
160+
tend = Nt * dt
161+
162+
# Configuring case dictionary
163+
print(json.dumps({
164+
# Logistics ================================================
165+
'run_time_info' : 'T',
166+
# ==========================================================
167+
168+
# Computational Domain Parameters ==========================
169+
'x_domain%beg' : xb,
170+
'x_domain%end' : xe,
171+
'y_domain%beg' : yb,
172+
'y_domain%end' : ye,
173+
'z_domain%beg' : zb,
174+
'z_domain%end' : ze,
175+
'stretch_x' : 'T',
176+
'a_x' : 20,
177+
'x_a' : -1.2 * D0,
178+
'x_b' : 1.2 * D0,
179+
'stretch_y' : 'T',
180+
'a_y' : 20,
181+
'y_a' : -0.0 * D0,
182+
'y_b' : 1.2 * D0,
183+
'stretch_z' : 'T',
184+
'a_z' : 20,
185+
'z_a' : -0.0 * D0,
186+
'z_b' : 1.2 * D0,
187+
'm' : Nx,
188+
'n' : Ny,
189+
'p' : Nz,
190+
'cyl_coord' : 'F',
191+
'dt' : dt,
192+
't_step_start' : 0,
193+
't_step_stop' : 100,
194+
't_step_save' : 100,
195+
# ==========================================================
196+
197+
# Simulation Algorithm Parameters ==========================
198+
'num_patches' : 3,
199+
'model_eqns' : 2,
200+
'alt_soundspeed' : 'F',
201+
'num_fluids' : 2,
202+
'adv_alphan' : 'T',
203+
'mpp_lim' : 'T',
204+
'mixture_err' : 'T',
205+
'time_stepper' : 3,
206+
'weno_order' : 3,
207+
'weno_eps' : 1.0E-16,
208+
'weno_Re_flux' : 'F',
209+
'weno_avg' : 'F',
210+
'mapped_weno' : 'T',
211+
'riemann_solver' : 2,
212+
'wave_speeds' : 1,
213+
'avg_state' : 2,
214+
'bc_x%beg' : -6,
215+
'bc_x%end' : -6,
216+
'bc_y%beg' : -2,
217+
'bc_y%end' : -3,
218+
'bc_z%beg' : -2,
219+
'bc_z%end' : -3,
220+
# ==========================================================
221+
222+
# Formatted Database Files Structure Parameters ============
223+
'format' : 1,
224+
'precision' : 2,
225+
'prim_vars_wrt' :'T',
226+
'parallel_io' :'T',
227+
# ==========================================================
228+
# I will use 1 for WATER properties, and 2 for AIR properties
229+
# Patch 1: Background (AIR - 2) =============================
230+
'patch_icpp(1)%geometry' : 9,
231+
'patch_icpp(1)%x_centroid' : (xb+xe) / 2 * StF,
232+
'patch_icpp(1)%y_centroid' : (yb+ye) / 2 * StF,
233+
'patch_icpp(1)%z_centroid' : (yb+ye) / 2 * StF,
234+
'patch_icpp(1)%length_x' : (xe-xb) * StF,
235+
'patch_icpp(1)%length_y' : (ye-yb) * StF,
236+
'patch_icpp(1)%length_z' : (ze-zb) * StF,
237+
'patch_icpp(1)%vel(1)' : 0.0E+00,
238+
'patch_icpp(1)%vel(2)' : 0.0E+00,
239+
'patch_icpp(1)%vel(3)' : 0.0E+00,
240+
'patch_icpp(1)%pres' : p0a,
241+
'patch_icpp(1)%alpha_rho(1)' : 0.0E+00,
242+
'patch_icpp(1)%alpha_rho(2)' : rho0a,
243+
'patch_icpp(1)%alpha(1)' : 0.0E+00,
244+
'patch_icpp(1)%alpha(2)' : 1.0E+00,
245+
# ==========================================================
246+
247+
# Patch 2: Shocked state (AIR - 2) =========================
248+
'patch_icpp(2)%geometry' : 9,
249+
'patch_icpp(2)%alter_patch(1)' : 'T',
250+
'patch_icpp(2)%x_centroid' : -ISD - ( xe - xb ) / 2 * StF,
251+
'patch_icpp(2)%y_centroid' : ( yb + ye ) / 2 * StF,
252+
'patch_icpp(2)%z_centroid' : ( zb + ze ) / 2 * StF,
253+
'patch_icpp(2)%length_x' : ( xe - xb ) * StF,
254+
'patch_icpp(2)%length_y' : ( ye - yb ) * StF,
255+
'patch_icpp(2)%length_z' : ( ze - zb ) * StF,
256+
'patch_icpp(2)%vel(1)' : vel,
257+
'patch_icpp(2)%vel(2)' : 0.0E+00,
258+
'patch_icpp(2)%vel(3)' : 0.0E+00,
259+
'patch_icpp(2)%pres' : ps,
260+
'patch_icpp(2)%alpha_rho(1)' : 0.0E+00,
261+
'patch_icpp(2)%alpha_rho(2)' : rhos,
262+
'patch_icpp(2)%alpha(1)' : 0.0E+00,
263+
'patch_icpp(2)%alpha(2)' : 1.0E+00,
264+
# ==========================================================
265+
266+
# Patch 3: Droplet (WATER - 1) =============================
267+
'patch_icpp(3)%geometry' : 8,
268+
'patch_icpp(3)%x_centroid' : 0.0E+00,
269+
'patch_icpp(3)%y_centroid' : 0.0E+00,
270+
'patch_icpp(3)%z_centroid' : 0.0E+00,
271+
'patch_icpp(3)%radius' : D0/2,
272+
'patch_icpp(3)%alter_patch(1)' : 'T',
273+
'patch_icpp(3)%vel(1)' : 0.0E+00,
274+
'patch_icpp(3)%vel(2)' : 0.0E+00,
275+
'patch_icpp(3)%vel(3)' : 0.0E+00,
276+
'patch_icpp(3)%pres' : p0w,
277+
'patch_icpp(3)%alpha_rho(1)' : rho0w,
278+
'patch_icpp(3)%alpha_rho(2)' : 0.0E+00,
279+
'patch_icpp(3)%alpha(1)' : 1.0E+00,
280+
'patch_icpp(3)%alpha(2)' : 0.0E+00,
281+
# ==========================================================
282+
283+
284+
# Fluids Physical Parameters ===============================
285+
'fluid_pp(1)%gamma' : 1.0E+00/(gamw-1),
286+
'fluid_pp(1)%pi_inf' : gamw*piw/(gamw-1),
287+
'fluid_pp(2)%gamma' : 1.0E+00/(gama-1),
288+
'fluid_pp(2)%pi_inf' : gama*pia/(gama-1),
289+
# ==========================================================
290+
}))
291+
292+
# ==============================================================================

toolchain/bench.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
- slug: 3D_shockdroplet
2-
path: examples/3D_shockdroplet/case.py
3-
args: []
4-
- slug: 3D_turb_mixing
5-
path: examples/3D_turb_mixing/case.py
2+
path: benchmarks/3D_shockdroplet/case.py
63
args: []

0 commit comments

Comments
 (0)