Skip to content

Commit 2233240

Browse files
author
Anand
committed
2D acoustic pulse with subsonic pressure outflow
1 parent f461885 commit 2233240

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

examples/2D_acoustic_pulse/case.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import math
2+
import json
3+
4+
# Numerical setup
5+
Nx = 99
6+
Ny = 99
7+
dx = 8./(1.*(Nx+1))
8+
9+
alf_st = 0.4
10+
11+
p_inf = 101325
12+
rho_inf = 1
13+
gam = 1.4
14+
15+
c = math.sqrt(gam*(p_inf) / rho_inf)
16+
cfl = 0.3
17+
mydt = cfl * dx / c
18+
Tfinal = 80*1 / c
19+
Nt = int(Tfinal/mydt)
20+
21+
# Configuring case dictionary
22+
print(json.dumps({
23+
# Logistics ================================================================
24+
'run_time_info' : 'T',
25+
# ==========================================================================
26+
27+
# Computational Domain Parameters ==========================================
28+
'x_domain%beg' : -4,
29+
'x_domain%end' : 4,
30+
'y_domain%beg' : -4,
31+
'y_domain%end' : 4,
32+
'm' : Nx,
33+
'n' : Ny,
34+
'p' : 0,
35+
'dt' : mydt,
36+
't_step_start' : 0,
37+
't_step_stop' : Nt,
38+
't_step_save' : int(Nt/100),
39+
# ==========================================================================
40+
41+
# Simulation Algorithm Parameters ==========================================
42+
'num_patches' : 2,
43+
'model_eqns' : 2,
44+
'alt_soundspeed' : 'F',
45+
'num_fluids' : 1,
46+
'mpp_lim' : 'F',
47+
'mixture_err' : 'F',
48+
'time_stepper' : 3,
49+
'weno_order' : 5,
50+
'weno_eps' : 1.E-16,
51+
'mapped_weno' : 'T',
52+
'null_weights' : 'F',
53+
'mp_weno' : 'F',
54+
'riemann_solver' : 2,
55+
'wave_speeds' : 1,
56+
'avg_state' : 2,
57+
'bc_x%beg' : -8,
58+
'bc_x%end' : -8,
59+
'bc_y%beg' : -8,
60+
'bc_y%end' : -8,
61+
# ==========================================================================
62+
63+
# Formatted Database Files Structure Parameters ============================
64+
'format' : 1,
65+
'precision' : 2,
66+
'prim_vars_wrt' :'T',
67+
'parallel_io' :'T',
68+
'omega_wrt(3)' :'T',
69+
'fd_order' : 2,
70+
# ==========================================================================
71+
72+
# Patch 1 ==================================================================
73+
'patch_icpp(1)%geometry' : 3,
74+
'patch_icpp(1)%x_centroid' : 0,
75+
'patch_icpp(1)%y_centroid' : 0,
76+
'patch_icpp(1)%length_x' : 8.,
77+
'patch_icpp(1)%length_y' : 8.,
78+
'patch_icpp(1)%vel(1)' : 0,
79+
'patch_icpp(1)%vel(2)' : 0,
80+
'patch_icpp(1)%pres' : p_inf,
81+
'patch_icpp(1)%alpha_rho(1)' : rho_inf,
82+
'patch_icpp(1)%alpha(1)' : 1.,
83+
# ==========================================================================
84+
85+
# Patch 2 ==================================================================
86+
'patch_icpp(2)%geometry' : 2,
87+
'patch_icpp(2)%x_centroid' : 0,
88+
'patch_icpp(2)%y_centroid' : 0,
89+
'patch_icpp(2)%radius' : 1.,
90+
'patch_icpp(2)%vel(1)' : 0,
91+
'patch_icpp(2)%vel(2)' : 0,
92+
'patch_icpp(2)%pres' : f"{p_inf}*(1 - 0.5*({gam} - 1)*({alf_st})**2*exp(0.5*(1 - sqrt(x**2 + y**2))))**({gam} / ({gam} - 1))",
93+
'patch_icpp(2)%alpha_rho(1)' : f"{rho_inf}*(1 - 0.5*({gam} - 1)*({alf_st})**2*exp(0.5*(1 - sqrt(x**2 + y**2))))**(1 / ({gam} - 1))",
94+
'patch_icpp(2)%alpha(1)' : 1.,
95+
'patch_icpp(2)%alter_patch(1)' : 'T',
96+
# ==========================================================================
97+
98+
# CBC Inflow / Outflow ========================================
99+
'bc_x%grcbc_in' : 'F',
100+
'bc_x%grcbc_out' : 'T',
101+
'bc_x%grcbc_vel_out' : 'F',
102+
'bc_x%pres_out' : p_inf,
103+
'bc_y%grcbc_in' : 'F',
104+
'bc_y%grcbc_out' : 'T',
105+
'bc_y%grcbc_vel_out' : 'F',
106+
'bc_y%pres_out' : p_inf,
107+
# # ========================================================================
108+
109+
# Fluids Physical Parameters ===============================================
110+
'fluid_pp(1)%gamma' : 1.E+00/(gam-1.E+00),
111+
'fluid_pp(1)%pi_inf' : 0.0,
112+
# ==========================================================================
113+
}))
114+
115+
# ==============================================================================

0 commit comments

Comments
 (0)