Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ The number has to be a positive integer.
- `num_fluids` defines the total number of fluids defined in each of the patches.
The number has to be a positive integer.

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

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

- `patch_icpp(j)%%alter_patch(i)` activates alternation of `patch(i)` with `patch(j)`.
For instance, in a 2D simulation, when a cylindrical `patch(2)` is immersed in a rectangular `patch(1)`:
Expand Down Expand Up @@ -1087,8 +1087,8 @@ This boundary condition can be used for subsonic inflow (`bc_[x,y,z]%[beg,end]`
| 10 | Cylinder | 3 | Y | Requires `[x,y,z]_centroid`, `radius`, and `length_[x,y,z]`. |
| 11 | Sweep plane | 3 | Y | Not coordinate-aligned. Requires `x[y,z]_centroid` and `normal(i)`. |
| 12 | Ellipsoid | 3 | Y | Requires `[x,y,z]_centroid` and `radii(i)`. |
| 13 | N/A | N/A | N/A | No longer exists. Empty. |
| 14 | Spherical Harmonic | 3 | N | Requires `[x,y,z]_centroid`, `radius`, `epsilon`, `beta` |
| 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`. |
| 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). |
| 15 | N/A | N/A | N/A | No longer exists. Empty. |
| 16 | 1D bubble pulse | 1 | N | Requires `x_centroid`, `length_x` |
| 17 | Spiral | 2 | N | Requires `[x,y]_centroid` |
Expand All @@ -1102,6 +1102,19 @@ This includes types exclusive to one-, two-, and three-dimensional problems.
The patch type number (`#`) corresponds to the input value in `input.py` labeled `patch_icpp(j)%%geometry` where $j$ is the patch index.
Each patch requires a different set of parameters, which are also listed in this table.

**Geometry 13: 2D modal (Fourier):**
Boundary is at polar angle \f$\theta = \mathrm{atan2}(y - y_{\mathrm{centroid}}, x - x_{\mathrm{centroid}})\f$.

- **Additive form** (default, `modal_use_exp_form` false):
\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$.
Coefficients are absolute: same units as `radius` (length).
If this formula gives \f$R_{\mathrm{boundary}} < 0\f$ at some \f$\theta\f$, it is clipped to zero.
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`.

- **Exponential form** (`modal_use_exp_form` true):
\f$R_{\mathrm{boundary}} = \mathrm{radius} \times \exp\bigl( \sum_n [\ldots] \bigr)\f$.
Coefficients are relative (dimensionless); the sum scales the radius.

### Immersed Boundary Patch Types {#immersed-boundary-patch-types}

| # | Name | Dim. |
Expand Down
124 changes: 124 additions & 0 deletions examples/2D_patch_modal_shape/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/usr/bin/env python3
"""Minimal 2D acoustic case with geometry 13 (2D modal Fourier shape). Additive form."""
import math
import json

Nx, Ny = 64, 64
Lx, Ly = 8.0, 8.0
dx = Lx / (Nx + 1)
p_inf = 101325.0
rho_inf = 1.0
gam = 1.4
# Patch 2: same pressure, higher sound speed (different gas) -> lower density
c_ratio = 1.5
rho2 = rho_inf / (c_ratio * c_ratio)
c = math.sqrt(gam * p_inf / rho_inf)
cfl = 0.3
mydt = cfl * dx / c
Tfinal = 10.0 / c
Nt = int(Tfinal / mydt)

# Acoustic source (similar to 2D_acoustic_support5)
t_cross = Lx / c # domain crossing time
gauss_sigma_time = 0.03 * t_cross
acoustic_delay = 0.15 * t_cross
acoustic_loc_x = -3.5
acoustic_loc_y = 0.0
acoustic_aperture = 6.0
acoustic_foc_length = 3.5

config = {
"run_time_info": "T",
"x_domain%beg": -4.0,
"x_domain%end": 4.0,
"y_domain%beg": -4.0,
"y_domain%end": 4.0,
"m": Nx,
"n": Ny,
"p": 0,
"dt": mydt,
"t_step_start": 0,
"t_step_stop": Nt,
"t_step_save": max(1, int(Nt / 10)),
"num_patches": 2,
"model_eqns": 2,
"alt_soundspeed": "F",
"num_fluids": 2,
"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": -8,
"bc_x%end": -8,
"bc_y%beg": -8,
"bc_y%end": -8,
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "T",
"omega_wrt(3)": "T",
"fd_order": 2,
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%x_centroid": 0.0,
"patch_icpp(1)%y_centroid": 0.0,
"patch_icpp(1)%length_x": 8.0,
"patch_icpp(1)%length_y": 8.0,
"patch_icpp(1)%vel(1)": 0.0,
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%pres": p_inf,
"patch_icpp(1)%alpha_rho(1)": rho_inf,
"patch_icpp(1)%alpha_rho(2)": 0.0,
"patch_icpp(1)%alpha(1)": 1.0,
"patch_icpp(1)%alpha(2)": 0.0,
"patch_icpp(2)%geometry": 13,
"patch_icpp(2)%x_centroid": 0.0,
"patch_icpp(2)%y_centroid": 0.0,
"patch_icpp(2)%radius": 1.0,
"patch_icpp(2)%fourier_cos(1)": 0.2,
"patch_icpp(2)%fourier_sin(1)": 0.1,
"patch_icpp(2)%fourier_sin(3)": -0.3,
"patch_icpp(2)%fourier_cos(5)": 0.5,
"patch_icpp(2)%modal_clip_r_to_min": "T",
"patch_icpp(2)%modal_r_min": 0.5,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%vel(2)": 0.0,
"patch_icpp(2)%pres": p_inf,
"patch_icpp(2)%alpha_rho(1)": 0.0,
"patch_icpp(2)%alpha_rho(2)": rho2,
"patch_icpp(2)%alpha(1)": 0.0,
"patch_icpp(2)%alpha(2)": 1.0,
"patch_icpp(2)%alter_patch(1)": "T",
"bc_x%grcbc_in": "F",
"bc_x%grcbc_out": "T",
"bc_x%grcbc_vel_out": "F",
"bc_x%pres_out": p_inf,
"bc_y%grcbc_in": "F",
"bc_y%grcbc_out": "T",
"bc_y%grcbc_vel_out": "F",
"bc_y%pres_out": p_inf,
"fluid_pp(1)%gamma": 1.0 / (gam - 1.0),
"fluid_pp(1)%pi_inf": 0.0,
"fluid_pp(2)%gamma": 1.0 / (gam - 1.0),
"fluid_pp(2)%pi_inf": 0.0,
# Acoustic source (similar to 2D_acoustic_support5)
"acoustic_source": "T",
"num_source": 1,
"acoustic(1)%support": 5,
"acoustic(1)%loc(1)": acoustic_loc_x,
"acoustic(1)%loc(2)": acoustic_loc_y,
"acoustic(1)%pulse": 2,
"acoustic(1)%npulse": 1,
"acoustic(1)%mag": 1.0,
"acoustic(1)%gauss_sigma_time": gauss_sigma_time,
"acoustic(1)%foc_length": acoustic_foc_length,
"acoustic(1)%aperture": acoustic_aperture,
"acoustic(1)%delay": acoustic_delay,
}
print(json.dumps(config))
127 changes: 127 additions & 0 deletions examples/2D_patch_modal_shape_exp/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/usr/bin/env python3
"""Minimal 2D acoustic case with geometry 13 in exponential form (modal_use_exp_form)."""
import math
import json

Nx, Ny = 64, 64
Lx = 8.0
dx = Lx / (Nx + 1)
p_inf = 101325.0
rho_inf = 1.0
gam = 1.4
# Patch 2: same pressure, higher sound speed (different gas) -> lower density
c_ratio = 1.5
rho2 = rho_inf / (c_ratio * c_ratio)
c = math.sqrt(gam * p_inf / rho_inf)
cfl = 0.3
mydt = cfl * dx / c
Tfinal = 10.0 / c
Nt = int(Tfinal / mydt)

# Acoustic source (similar to 2D_acoustic_support5)
t_cross = Lx / c # domain crossing time
gauss_sigma_time = 0.03 * t_cross
acoustic_delay = 0.15 * t_cross
acoustic_loc_x = -3.5
acoustic_loc_y = 0.0
acoustic_aperture = 6.0
acoustic_foc_length = 3.5

print(
json.dumps(
{
"run_time_info": "T",
"x_domain%beg": -4.0,
"x_domain%end": 4.0,
"y_domain%beg": -4.0,
"y_domain%end": 4.0,
"m": Nx,
"n": Ny,
"p": 0,
"dt": mydt,
"t_step_start": 0,
"t_step_stop": Nt,
"t_step_save": max(1, int(Nt / 10)),
"num_patches": 2,
"model_eqns": 2,
"alt_soundspeed": "F",
"num_fluids": 2,
"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": -8,
"bc_x%end": -8,
"bc_y%beg": -8,
"bc_y%end": -8,
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "T",
"omega_wrt(3)": "T",
"fd_order": 2,
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%x_centroid": 0.0,
"patch_icpp(1)%y_centroid": 0.0,
"patch_icpp(1)%length_x": Lx,
"patch_icpp(1)%length_y": Lx,
"patch_icpp(1)%vel(1)": 0.0,
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%pres": p_inf,
"patch_icpp(1)%alpha_rho(1)": rho_inf,
"patch_icpp(1)%alpha_rho(2)": 0.0,
"patch_icpp(1)%alpha(1)": 1.0,
"patch_icpp(1)%alpha(2)": 0.0,
"patch_icpp(2)%geometry": 13,
"patch_icpp(2)%x_centroid": 0.0,
"patch_icpp(2)%y_centroid": 0.0,
"patch_icpp(2)%radius": 1.0,
"patch_icpp(2)%modal_use_exp_form": "T",
"patch_icpp(2)%fourier_cos(1)": -0.3,
"patch_icpp(2)%fourier_sin(1)": 0.1,
"patch_icpp(2)%fourier_sin(3)": -0.4,
"patch_icpp(2)%fourier_cos(5)": 0.2,
"patch_icpp(2)%fourier_sin(5)": 0.05,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%vel(2)": 0.0,
"patch_icpp(2)%pres": p_inf,
"patch_icpp(2)%alpha_rho(1)": 0.0,
"patch_icpp(2)%alpha_rho(2)": rho2,
"patch_icpp(2)%alpha(1)": 0.0,
"patch_icpp(2)%alpha(2)": 1.0,
"patch_icpp(2)%alter_patch(1)": "T",
"bc_x%grcbc_in": "F",
"bc_x%grcbc_out": "T",
"bc_x%grcbc_vel_out": "F",
"bc_x%pres_out": p_inf,
"bc_y%grcbc_in": "F",
"bc_y%grcbc_out": "T",
"bc_y%grcbc_vel_out": "F",
"bc_y%pres_out": p_inf,
"fluid_pp(1)%gamma": 1.0 / (gam - 1.0),
"fluid_pp(1)%pi_inf": 0.0,
"fluid_pp(2)%gamma": 1.0 / (gam - 1.0),
"fluid_pp(2)%pi_inf": 0.0,
# Acoustic source (similar to 2D_acoustic_support5)
"acoustic_source": "T",
"num_source": 1,
"acoustic(1)%support": 5,
"acoustic(1)%loc(1)": acoustic_loc_x,
"acoustic(1)%loc(2)": acoustic_loc_y,
"acoustic(1)%pulse": 2,
"acoustic(1)%npulse": 1,
"acoustic(1)%mag": 1.0,
"acoustic(1)%gauss_sigma_time": gauss_sigma_time,
"acoustic(1)%foc_length": acoustic_foc_length,
"acoustic(1)%aperture": acoustic_aperture,
"acoustic(1)%delay": acoustic_delay,
}
)
)
Loading
Loading