Skip to content

Commit 8e916c6

Browse files
authored
Merge branch 'master' into bala_force_changes
2 parents 7c5baa9 + 598f5a5 commit 8e916c6

26 files changed

Lines changed: 1253 additions & 235 deletions

File tree

docs/documentation/case.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ The number has to be a positive integer.
267267
- `num_fluids` defines the total number of fluids defined in each of the patches.
268268
The number has to be a positive integer.
269269

270-
- `patch_icpp(j)%%geometry` defines the type of geometry of $j$-th patch by using an integer from 1 to 13.
270+
- `patch_icpp(j)%%geometry` defines the type of geometry of $j$-th patch by using an integer from 1 to 21.
271271
Definition of the patch type for each integer is listed in table [Patch Types](#patch-types).
272272

273273
- `[x,y,z]_centroid`, `length_[x,y,z]`, and/or `radius` are used to uniquely define the geometry of the patch with given type.
274-
Requisite combinations of the parameters for each type can be found in is listed in table [Patch types](#patch-types).
274+
Requisite combinations of the parameters for each type are listed in table [Patch types](#patch-types).
275275

276276
- `patch_icpp(j)%%alter_patch(i)` activates alternation of `patch(i)` with `patch(j)`.
277277
For instance, in a 2D simulation, when a cylindrical `patch(2)` is immersed in a rectangular `patch(1)`:
@@ -1087,8 +1087,8 @@ This boundary condition can be used for subsonic inflow (`bc_[x,y,z]%[beg,end]`
10871087
| 10 | Cylinder | 3 | Y | Requires `[x,y,z]_centroid`, `radius`, and `length_[x,y,z]`. |
10881088
| 11 | Sweep plane | 3 | Y | Not coordinate-aligned. Requires `x[y,z]_centroid` and `normal(i)`. |
10891089
| 12 | Ellipsoid | 3 | Y | Requires `[x,y,z]_centroid` and `radii(i)`. |
1090-
| 13 | N/A | N/A | N/A | No longer exists. Empty. |
1091-
| 14 | Spherical Harmonic | 3 | N | Requires `[x,y,z]_centroid`, `radius`, `epsilon`, `beta` |
1090+
| 13 | 2D modal (Fourier) | 2 | Y | Requires `x_centroid`, `y_centroid`, `radius`. Optional: `fourier_cos(n)`, `fourier_sin(n)` (n=1..10), `modal_clip_r_to_min`, `modal_r_min`, `modal_use_exp_form`. |
1091+
| 14 | 3D spherical harmonic | 3 | Y | Requires `x_centroid`, `y_centroid`, `z_centroid`, `radius`. Optional: `sph_har_coeff(l,m)` (l=0..5, m=-l..l). |
10921092
| 15 | N/A | N/A | N/A | No longer exists. Empty. |
10931093
| 16 | 1D bubble pulse | 1 | N | Requires `x_centroid`, `length_x` |
10941094
| 17 | Spiral | 2 | N | Requires `[x,y]_centroid` |
@@ -1102,6 +1102,19 @@ This includes types exclusive to one-, two-, and three-dimensional problems.
11021102
The patch type number (`#`) corresponds to the input value in `input.py` labeled `patch_icpp(j)%%geometry` where $j$ is the patch index.
11031103
Each patch requires a different set of parameters, which are also listed in this table.
11041104

1105+
**Geometry 13: 2D modal (Fourier):**
1106+
Boundary is at polar angle \f$\theta = \mathrm{atan2}(y - y_{\mathrm{centroid}}, x - x_{\mathrm{centroid}})\f$.
1107+
1108+
- **Additive form** (default, `modal_use_exp_form` false):
1109+
\f$R_{\mathrm{boundary}} = \mathrm{radius} + \sum_n \bigl[ \mathtt{fourier\_cos}(n)\cos(n\theta) + \mathtt{fourier\_sin}(n)\sin(n\theta) \bigr]\f$.
1110+
Coefficients are absolute: same units as `radius` (length).
1111+
If this formula gives \f$R_{\mathrm{boundary}} < 0\f$ at some \f$\theta\f$, it is clipped to zero.
1112+
With `modal_clip_r_to_min` true, if \f$R_{\mathrm{boundary}} <\f$ `modal_r_min` at some \f$\theta\f$, it is clipped to `modal_r_min`.
1113+
1114+
- **Exponential form** (`modal_use_exp_form` true):
1115+
\f$R_{\mathrm{boundary}} = \mathrm{radius} \times \exp\bigl( \sum_n [\ldots] \bigr)\f$.
1116+
Coefficients are relative (dimensionless); the sum scales the radius.
1117+
11051118
### Immersed Boundary Patch Types {#immersed-boundary-patch-types}
11061119

11071120
| # | Name | Dim. |
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/usr/bin/env python3
2+
"""Minimal 2D acoustic case with geometry 13 (2D modal Fourier shape). Additive form."""
3+
import math
4+
import json
5+
6+
Nx, Ny = 64, 64
7+
Lx, Ly = 8.0, 8.0
8+
dx = Lx / (Nx + 1)
9+
p_inf = 101325.0
10+
rho_inf = 1.0
11+
gam = 1.4
12+
# Patch 2: same pressure, higher sound speed (different gas) -> lower density
13+
c_ratio = 1.5
14+
rho2 = rho_inf / (c_ratio * c_ratio)
15+
c = math.sqrt(gam * p_inf / rho_inf)
16+
cfl = 0.3
17+
mydt = cfl * dx / c
18+
Tfinal = 10.0 / c
19+
Nt = int(Tfinal / mydt)
20+
21+
# Acoustic source (similar to 2D_acoustic_support5)
22+
t_cross = Lx / c # domain crossing time
23+
gauss_sigma_time = 0.03 * t_cross
24+
acoustic_delay = 0.15 * t_cross
25+
acoustic_loc_x = -3.5
26+
acoustic_loc_y = 0.0
27+
acoustic_aperture = 6.0
28+
acoustic_foc_length = 3.5
29+
30+
config = {
31+
"run_time_info": "T",
32+
"x_domain%beg": -4.0,
33+
"x_domain%end": 4.0,
34+
"y_domain%beg": -4.0,
35+
"y_domain%end": 4.0,
36+
"m": Nx,
37+
"n": Ny,
38+
"p": 0,
39+
"dt": mydt,
40+
"t_step_start": 0,
41+
"t_step_stop": Nt,
42+
"t_step_save": max(1, int(Nt / 10)),
43+
"num_patches": 2,
44+
"model_eqns": 2,
45+
"alt_soundspeed": "F",
46+
"num_fluids": 2,
47+
"mpp_lim": "F",
48+
"mixture_err": "F",
49+
"time_stepper": 3,
50+
"weno_order": 5,
51+
"weno_eps": 1.0e-16,
52+
"mapped_weno": "T",
53+
"null_weights": "F",
54+
"mp_weno": "F",
55+
"riemann_solver": 2,
56+
"wave_speeds": 1,
57+
"avg_state": 2,
58+
"bc_x%beg": -8,
59+
"bc_x%end": -8,
60+
"bc_y%beg": -8,
61+
"bc_y%end": -8,
62+
"format": 1,
63+
"precision": 2,
64+
"prim_vars_wrt": "T",
65+
"parallel_io": "T",
66+
"omega_wrt(3)": "T",
67+
"fd_order": 2,
68+
"patch_icpp(1)%geometry": 3,
69+
"patch_icpp(1)%x_centroid": 0.0,
70+
"patch_icpp(1)%y_centroid": 0.0,
71+
"patch_icpp(1)%length_x": 8.0,
72+
"patch_icpp(1)%length_y": 8.0,
73+
"patch_icpp(1)%vel(1)": 0.0,
74+
"patch_icpp(1)%vel(2)": 0.0,
75+
"patch_icpp(1)%pres": p_inf,
76+
"patch_icpp(1)%alpha_rho(1)": rho_inf,
77+
"patch_icpp(1)%alpha_rho(2)": 0.0,
78+
"patch_icpp(1)%alpha(1)": 1.0,
79+
"patch_icpp(1)%alpha(2)": 0.0,
80+
"patch_icpp(2)%geometry": 13,
81+
"patch_icpp(2)%x_centroid": 0.0,
82+
"patch_icpp(2)%y_centroid": 0.0,
83+
"patch_icpp(2)%radius": 1.0,
84+
"patch_icpp(2)%fourier_cos(1)": 0.2,
85+
"patch_icpp(2)%fourier_sin(1)": 0.1,
86+
"patch_icpp(2)%fourier_sin(3)": -0.3,
87+
"patch_icpp(2)%fourier_cos(5)": 0.5,
88+
"patch_icpp(2)%modal_clip_r_to_min": "T",
89+
"patch_icpp(2)%modal_r_min": 0.5,
90+
"patch_icpp(2)%vel(1)": 0.0,
91+
"patch_icpp(2)%vel(2)": 0.0,
92+
"patch_icpp(2)%pres": p_inf,
93+
"patch_icpp(2)%alpha_rho(1)": 0.0,
94+
"patch_icpp(2)%alpha_rho(2)": rho2,
95+
"patch_icpp(2)%alpha(1)": 0.0,
96+
"patch_icpp(2)%alpha(2)": 1.0,
97+
"patch_icpp(2)%alter_patch(1)": "T",
98+
"bc_x%grcbc_in": "F",
99+
"bc_x%grcbc_out": "T",
100+
"bc_x%grcbc_vel_out": "F",
101+
"bc_x%pres_out": p_inf,
102+
"bc_y%grcbc_in": "F",
103+
"bc_y%grcbc_out": "T",
104+
"bc_y%grcbc_vel_out": "F",
105+
"bc_y%pres_out": p_inf,
106+
"fluid_pp(1)%gamma": 1.0 / (gam - 1.0),
107+
"fluid_pp(1)%pi_inf": 0.0,
108+
"fluid_pp(2)%gamma": 1.0 / (gam - 1.0),
109+
"fluid_pp(2)%pi_inf": 0.0,
110+
# Acoustic source (similar to 2D_acoustic_support5)
111+
"acoustic_source": "T",
112+
"num_source": 1,
113+
"acoustic(1)%support": 5,
114+
"acoustic(1)%loc(1)": acoustic_loc_x,
115+
"acoustic(1)%loc(2)": acoustic_loc_y,
116+
"acoustic(1)%pulse": 2,
117+
"acoustic(1)%npulse": 1,
118+
"acoustic(1)%mag": 1.0,
119+
"acoustic(1)%gauss_sigma_time": gauss_sigma_time,
120+
"acoustic(1)%foc_length": acoustic_foc_length,
121+
"acoustic(1)%aperture": acoustic_aperture,
122+
"acoustic(1)%delay": acoustic_delay,
123+
}
124+
print(json.dumps(config))
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#!/usr/bin/env python3
2+
"""Minimal 2D acoustic case with geometry 13 in exponential form (modal_use_exp_form)."""
3+
import math
4+
import json
5+
6+
Nx, Ny = 64, 64
7+
Lx = 8.0
8+
dx = Lx / (Nx + 1)
9+
p_inf = 101325.0
10+
rho_inf = 1.0
11+
gam = 1.4
12+
# Patch 2: same pressure, higher sound speed (different gas) -> lower density
13+
c_ratio = 1.5
14+
rho2 = rho_inf / (c_ratio * c_ratio)
15+
c = math.sqrt(gam * p_inf / rho_inf)
16+
cfl = 0.3
17+
mydt = cfl * dx / c
18+
Tfinal = 10.0 / c
19+
Nt = int(Tfinal / mydt)
20+
21+
# Acoustic source (similar to 2D_acoustic_support5)
22+
t_cross = Lx / c # domain crossing time
23+
gauss_sigma_time = 0.03 * t_cross
24+
acoustic_delay = 0.15 * t_cross
25+
acoustic_loc_x = -3.5
26+
acoustic_loc_y = 0.0
27+
acoustic_aperture = 6.0
28+
acoustic_foc_length = 3.5
29+
30+
print(
31+
json.dumps(
32+
{
33+
"run_time_info": "T",
34+
"x_domain%beg": -4.0,
35+
"x_domain%end": 4.0,
36+
"y_domain%beg": -4.0,
37+
"y_domain%end": 4.0,
38+
"m": Nx,
39+
"n": Ny,
40+
"p": 0,
41+
"dt": mydt,
42+
"t_step_start": 0,
43+
"t_step_stop": Nt,
44+
"t_step_save": max(1, int(Nt / 10)),
45+
"num_patches": 2,
46+
"model_eqns": 2,
47+
"alt_soundspeed": "F",
48+
"num_fluids": 2,
49+
"mpp_lim": "F",
50+
"mixture_err": "F",
51+
"time_stepper": 3,
52+
"weno_order": 5,
53+
"weno_eps": 1.0e-16,
54+
"mapped_weno": "T",
55+
"null_weights": "F",
56+
"mp_weno": "F",
57+
"riemann_solver": 2,
58+
"wave_speeds": 1,
59+
"avg_state": 2,
60+
"bc_x%beg": -8,
61+
"bc_x%end": -8,
62+
"bc_y%beg": -8,
63+
"bc_y%end": -8,
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+
"patch_icpp(1)%geometry": 3,
71+
"patch_icpp(1)%x_centroid": 0.0,
72+
"patch_icpp(1)%y_centroid": 0.0,
73+
"patch_icpp(1)%length_x": Lx,
74+
"patch_icpp(1)%length_y": Lx,
75+
"patch_icpp(1)%vel(1)": 0.0,
76+
"patch_icpp(1)%vel(2)": 0.0,
77+
"patch_icpp(1)%pres": p_inf,
78+
"patch_icpp(1)%alpha_rho(1)": rho_inf,
79+
"patch_icpp(1)%alpha_rho(2)": 0.0,
80+
"patch_icpp(1)%alpha(1)": 1.0,
81+
"patch_icpp(1)%alpha(2)": 0.0,
82+
"patch_icpp(2)%geometry": 13,
83+
"patch_icpp(2)%x_centroid": 0.0,
84+
"patch_icpp(2)%y_centroid": 0.0,
85+
"patch_icpp(2)%radius": 1.0,
86+
"patch_icpp(2)%modal_use_exp_form": "T",
87+
"patch_icpp(2)%fourier_cos(1)": -0.3,
88+
"patch_icpp(2)%fourier_sin(1)": 0.1,
89+
"patch_icpp(2)%fourier_sin(3)": -0.4,
90+
"patch_icpp(2)%fourier_cos(5)": 0.2,
91+
"patch_icpp(2)%fourier_sin(5)": 0.05,
92+
"patch_icpp(2)%vel(1)": 0.0,
93+
"patch_icpp(2)%vel(2)": 0.0,
94+
"patch_icpp(2)%pres": p_inf,
95+
"patch_icpp(2)%alpha_rho(1)": 0.0,
96+
"patch_icpp(2)%alpha_rho(2)": rho2,
97+
"patch_icpp(2)%alpha(1)": 0.0,
98+
"patch_icpp(2)%alpha(2)": 1.0,
99+
"patch_icpp(2)%alter_patch(1)": "T",
100+
"bc_x%grcbc_in": "F",
101+
"bc_x%grcbc_out": "T",
102+
"bc_x%grcbc_vel_out": "F",
103+
"bc_x%pres_out": p_inf,
104+
"bc_y%grcbc_in": "F",
105+
"bc_y%grcbc_out": "T",
106+
"bc_y%grcbc_vel_out": "F",
107+
"bc_y%pres_out": p_inf,
108+
"fluid_pp(1)%gamma": 1.0 / (gam - 1.0),
109+
"fluid_pp(1)%pi_inf": 0.0,
110+
"fluid_pp(2)%gamma": 1.0 / (gam - 1.0),
111+
"fluid_pp(2)%pi_inf": 0.0,
112+
# Acoustic source (similar to 2D_acoustic_support5)
113+
"acoustic_source": "T",
114+
"num_source": 1,
115+
"acoustic(1)%support": 5,
116+
"acoustic(1)%loc(1)": acoustic_loc_x,
117+
"acoustic(1)%loc(2)": acoustic_loc_y,
118+
"acoustic(1)%pulse": 2,
119+
"acoustic(1)%npulse": 1,
120+
"acoustic(1)%mag": 1.0,
121+
"acoustic(1)%gauss_sigma_time": gauss_sigma_time,
122+
"acoustic(1)%foc_length": acoustic_foc_length,
123+
"acoustic(1)%aperture": acoustic_aperture,
124+
"acoustic(1)%delay": acoustic_delay,
125+
}
126+
)
127+
)

0 commit comments

Comments
 (0)