-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathcase.py
More file actions
115 lines (109 loc) · 3.21 KB
/
case.py
File metadata and controls
115 lines (109 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import json
import math
# Parameters
epsilon = "5d0"
alpha = "1d0"
gamma = "1.4"
# Initial conditions
vel1_i = "0d0"
vel2_i = "0d0"
T_i = "1d0"
alpha_rho1_i = "1d0"
pres_i = "1d0"
# Perturbations
vel1 = f"{vel1_i} + (y - yc)*({epsilon}/(2d0*pi))*" + f"exp({alpha}*(1d0 - (x - xc)**2d0 - (y - yc)**2d0))"
vel2 = f"{vel2_i} - (x - xc)*({epsilon}/(2d0*pi))*" + f"exp({alpha}*(1d0 - (x - xc)**2d0 - (y - yc)**2d0))"
alpha_rho1 = (
f"{alpha_rho1_i}*(1d0 - ({alpha_rho1_i}/{pres_i})*({epsilon}/(2d0*pi))*"
+ f"({epsilon}/(8d0*{alpha}*({gamma} + 1d0)*pi))*"
+ f"exp(2d0*{alpha}*(1d0 - (x - xc)**2d0"
+ "- (y - yc)**2d0))"
+ f")**{gamma}"
)
pres = (
f"{pres_i}*(1d0 - ({alpha_rho1_i}/{pres_i})*({epsilon}/(2d0*pi))*"
+ f"({epsilon}/(8d0*{alpha}*({gamma} + 1d0)*pi))*"
+ f"exp(2d0*{alpha}*(1d0 - (x - xc)**2d0"
+ "- (y - yc)**2d0))"
+ f")**({gamma} + 1d0)"
)
# Numerical setup
Nx = 399
dx = 10.0 / (1.0 * (Nx + 1))
c = 1.4**0.5
C = 0.3
mydt = C * dx / c * 0.01
Nt = 1 / mydt
# Configuring case dictionary
print(
json.dumps(
{
# Logistics
"run_time_info": "T",
# Computational Domain Parameters
"x_domain%beg": -3,
"x_domain%end": 3,
"y_domain%beg": -3,
"y_domain%end": 3,
"stretch_x": "T",
"stretch_y": "T",
"loops_x": 2,
"loops_y": 2,
"a_x": 1.03,
"a_y": 1.03,
"x_stretch%beg": -1.5,
"y_stretch%beg": -1.5,
"x_stretch%end": 1.5,
"y_stretch%end": 1.5,
"m": Nx,
"n": Nx,
"p": 0,
"dt": mydt,
"t_step_start": 0,
"t_step_stop": 10,
"t_step_save": 1,
# Simulation Algorithm Parameters
"num_patches": 1,
"model_eqns": 3,
"alt_soundspeed": "F",
"num_fluids": 1,
"mpp_lim": "F",
"mixture_err": "F",
"time_stepper": 3,
"weno_order": 5,
"weno_eps": 1.0e-16,
"mapped_weno": "T",
"null_weights": "F",
"mp_weno": "F",
"riemann_solver": 2,
"wave_speeds": 1,
"avg_state": 2,
"bc_x%beg": -4,
"bc_x%end": -4,
"bc_y%beg": -4,
"bc_y%end": -4,
# Formatted Database Files Structure Parameters
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "F",
"omega_wrt(3)": "T",
"fd_order": 2,
# Patch 1
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%x_centroid": 0,
"patch_icpp(1)%y_centroid": 0,
"patch_icpp(1)%length_x": 10.0,
"patch_icpp(1)%length_y": 10.0,
"patch_icpp(1)%vel(1)": 0.0,
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%pres": 0.0,
"patch_icpp(1)%alpha_rho(1)": 0.0,
"patch_icpp(1)%hcid": 280,
"patch_icpp(1)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
"fluid_pp(1)%pi_inf": 0.0,
}
)
)