Skip to content

Commit 85c94fc

Browse files
committed
fixed test bugs and regression test stuff
1 parent a0c1542 commit 85c94fc

File tree

87 files changed

+1982
-1230
lines changed

Some content is hidden

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

87 files changed

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

0 commit comments

Comments
 (0)