Skip to content

Add hard coded patched for tests #942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bace49c
Added comments after digging through the toolchain to find the correc…
danieljvickers Jul 8, 2025
5c86cf7
Successfully added a single patch to the preprocessor. Decided to den…
danieljvickers Jul 8, 2025
36b147c
Actually fixed error. Need some better documentation to make it clear…
danieljvickers Jul 8, 2025
17d0442
Some small changes to the documentation to clarify issues I saw when …
danieljvickers Jul 9, 2025
2690009
All 1D example cases now work
danieljvickers Jul 9, 2025
f76e8cf
Added another case
danieljvickers Jul 10, 2025
0544597
Added the 2D_isentropic case:
danieljvickers Jul 10, 2025
523f103
Added the 2D_zero_circ_vortex case
danieljvickers Jul 11, 2025
54a21c1
Added two more cases
danieljvickers Jul 11, 2025
74accd8
Fixed errors with the shousher cases
danieljvickers Jul 11, 2025
48143e9
More resolved test cases
danieljvickers Jul 11, 2025
97a0ad8
Almost all patches work except for patches that require a 2D ciruclar…
danieljvickers Jul 11, 2025
409ce90
First patch has the rework so that different HC geometries do not nee…
danieljvickers Jul 13, 2025
425ca0e
Changes all of the shoucher cases to use the new geometry system
danieljvickers Jul 13, 2025
d897574
Updated all 1D cases
danieljvickers Jul 13, 2025
28e7312
Everything is compiling
danieljvickers Jul 14, 2025
26c112c
Added deprication statements. We should remove patch geometries 7, 13…
danieljvickers Jul 14, 2025
380721d
Everything works except for the 2D_Zero_Circ_vortex case. Removed ref…
danieljvickers Jul 14, 2025
a3273b7
Forgot to add a separate case for the 2D cases. Everything works now
danieljvickers Jul 14, 2025
9a80857
Merge branch 'MFlowCode:master' into add-hard-coded-patched-for-tests
danieljvickers Jul 14, 2025
45d40e8
Merged in upstream and formatted
danieljvickers Jul 14, 2025
1e76121
Did not intend to push this yaml file
danieljvickers Jul 14, 2025
62056ce
Removed double precision intrinsics in HCID 280
danieljvickers Jul 14, 2025
9b09313
Fixed spelling errors
danieljvickers Jul 14, 2025
8cb0a2c
Removed all of the old analytical patches and updated the PROHIBIT st…
danieljvickers Jul 14, 2025
dc49cda
spelling
danieljvickers Jul 14, 2025
942d19e
Removed segmentation error magic numbers:
danieljvickers Jul 14, 2025
7a516aa
Added the analytical examples for reference, but also updated the too…
danieljvickers Jul 14, 2025
44a4ee7
Ran the format code and linted to confirm it looks fine
danieljvickers Jul 14, 2025
f1526f8
Fixed one test case that was uninitialized
danieljvickers Jul 14, 2025
a998df9
Update src/pre_process/m_patches.fpp
danieljvickers Jul 15, 2025
df82956
Update src/pre_process/m_patches.fpp
danieljvickers Jul 15, 2025
03622a1
Merge branch 'master' into add-hard-coded-patched-for-tests
danieljvickers Jul 15, 2025
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
13 changes: 7 additions & 6 deletions docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,15 @@ end if
Some patch configurations are not adequately handled with the above analytic variable definitions.
In this case, a hard coded patch can be used.
Hard coded patches can be added by adding additional hard coded patch identifiers to `src/pre_process/include/1[2,3]dHardcodedIC.fpp`.
When using a hard coded patch, the `patch_icpp(patch_id)%%hcid` must be set to the hard-coded patch id.
For example, to add a 2D Hardcoded patch with an id of 200, one would add the following to `src/pre_process/include/2dHardcodedIC.fpp`

```f90
case(200)
! Primitive variables assignment
```

and use `patch_icpp(i)%%geometry = 7` and `patch_icpp(i)%%hcid = 200` in the input file.
and use `patch_icpp(i)%%hcid = 200` in the input file.
Additional variables can be declared in `Hardcoded1[2,3]DVariables` and used in `hardcoded1[2,3]D`.
As a convention, any hard coded patches that are part of the MFC master branch should be identified as 1[2,3]xx where the first digit indicates the number of dimensions.

Expand Down Expand Up @@ -313,7 +314,7 @@ These parameters should be prepended with `patch_ib(j)%` where $j$ is the patch
#### Parameter Descriptions

- `geometry` defines the type of geometry of a patch with an integer number.
Definitions for currently implemented patch types are list in table [Immersed Boundary Patch Type](#immersed-boundary-patch-types)
Definitions for currently implemented patch types are list in table [Patch Types](#patch-types).

- `x[y,z]_centroid` is the centroid location of the patch in the x[y,z]-direction

Expand Down Expand Up @@ -996,16 +997,16 @@ This boundary condition can be used for subsonic inflow (`bc_[x,y,z]%[beg,end]`
| 3 | Rectangle | 2 | N | Coordinate-aligned. Requires `[x,y]_centroid` and `length_[x,y]`. |
| 4 | Sweep line | 2 | Y | Not coordinate aligned. Requires `[x,y]_centroid` and `normal(i)`. |
| 5 | Ellipse | 2 | Y | Requires `[x,y]_centroid` and `radii(i)`. |
| 6 | N/A | 2 | N | No longer exists. Empty. |
| 7 | 2D Hardcoded | 2 | N | Assigns the primitive variables as analytical functions. |
| 6 | N/A | N/A | N/A | No longer exists. Empty. |
| 7 | N/A | N/A | N/A | No longer exists. Empty. |
| 8 | Sphere | 3 | Y | Requires `[x,y,z]_centroid` and `radius` |
| 9 | Cuboid | 3 | N | Coordinate-aligned. Requires `[x,y,z]_centroid` and `length_[x,y,z]`. |
| 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 | 3D Hardcoded | 3 | N | Assigns the primitive variables as analytical functions |
| 13 | N/A | N/A | N/A | No longer exists. Empty. |
| 14 | Spherical Harmonic | 3 | N | Requires `[x,y,z]_centroid`, `radius`, `epsilon`, `beta` |
| 15 | 1D Hardcoded | 1 | N | Assigns the primitive variables as analytical functions |
| 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` |
| 18 | 2D Varcircle | 2 | Y | Requires `[x,y]_centroid`, `radius`, and `thickness` |
Expand Down
74 changes: 74 additions & 0 deletions examples/1D_shuosher_analytical/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env python3
import math
import json

# Numerical setup
Nx = 1000
dx = 1.0 / (1.0 * (Nx + 1))

Tend, Nt = 1.8, 20000
mydt = Tend / (1.0 * Nt)

# Configuring case dictionary
print(
json.dumps(
{
# Logistics
"run_time_info": "T",
# Computational Domain Parameters
"x_domain%beg": -5.0,
"x_domain%end": 5.0,
"m": Nx,
"n": 0,
"p": 0,
"dt": mydt,
"t_step_start": 0,
"t_step_stop": int(Nt),
"t_step_save": int(math.ceil(Nt / 10.0)),
# Simulation Algorithm Parameters
"num_patches": 2,
"model_eqns": 2,
"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": -3,
"bc_x%end": -3,
# Formatted Database Files Structure Parameters
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "F",
# Background to cover whole domain with basic line patch
# Patch 1 Left (-5 < x < -4)
"patch_icpp(1)%geometry": 1,
"patch_icpp(1)%x_centroid": -4.5,
"patch_icpp(1)%length_x": 1.0,
"patch_icpp(1)%vel(1)": 2.629369,
"patch_icpp(1)%pres": 10.3333,
"patch_icpp(1)%alpha_rho(1)": 3.957143,
"patch_icpp(1)%alpha(1)": 1.0,
# One anlytic patch to take care of -4 < x < 5
# Patch 2 Analytic
"patch_icpp(2)%geometry": 1,
"patch_icpp(2)%x_centroid": 0.5,
"patch_icpp(2)%length_x": 9.0,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%pres": 1.0,
"patch_icpp(2)%alpha_rho(1)": "1 + 0.2*sin(5*x)",
"patch_icpp(2)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
"fluid_pp(1)%pi_inf": 0.0,
}
)
)
3 changes: 2 additions & 1 deletion examples/1D_shuosher_old/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"patch_icpp(2)%length_x": 9.0,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%pres": 1.0,
"patch_icpp(2)%alpha_rho(1)": "1 + 0.2*sin(5*x)",
"patch_icpp(2)%alpha_rho(1)": 0.0,
"patch_icpp(2)%hcid": 180,
"patch_icpp(2)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
Expand Down
3 changes: 2 additions & 1 deletion examples/1D_shuosher_teno5/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"patch_icpp(2)%length_x": 9.0,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%pres": 1.0,
"patch_icpp(2)%alpha_rho(1)": "1 + 0.2*sin(5*x)",
"patch_icpp(2)%alpha_rho(1)": 0,
"patch_icpp(2)%hcid": 180,
"patch_icpp(2)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
Expand Down
3 changes: 2 additions & 1 deletion examples/1D_shuosher_teno7/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"patch_icpp(2)%length_x": 9.0,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%pres": 1.0,
"patch_icpp(2)%alpha_rho(1)": "1 + 0.2*sin(5*x)",
"patch_icpp(2)%alpha_rho(1)": 0.0,
"patch_icpp(2)%hcid": 180,
"patch_icpp(2)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
Expand Down
3 changes: 2 additions & 1 deletion examples/1D_shuosher_wenojs5/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"patch_icpp(2)%length_x": 9.0,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%pres": 1.0,
"patch_icpp(2)%alpha_rho(1)": "1 + 0.2*sin(5*x)",
"patch_icpp(2)%alpha_rho(1)": 0,
"patch_icpp(2)%hcid": 180,
"patch_icpp(2)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
Expand Down
3 changes: 2 additions & 1 deletion examples/1D_shuosher_wenom5/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"patch_icpp(2)%length_x": 9.0,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%pres": 1.0,
"patch_icpp(2)%alpha_rho(1)": "1 + 0.2*sin(5*x)",
"patch_icpp(2)%alpha_rho(1)": 0,
"patch_icpp(2)%hcid": 180,
"patch_icpp(2)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
Expand Down
3 changes: 2 additions & 1 deletion examples/1D_shuosher_wenoz5/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"patch_icpp(2)%length_x": 9.0,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%pres": 1.0,
"patch_icpp(2)%alpha_rho(1)": "1 + 0.2*sin(5*x)",
"patch_icpp(2)%alpha_rho(1)": 0,
"patch_icpp(2)%hcid": 180,
"patch_icpp(2)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
Expand Down
3 changes: 2 additions & 1 deletion examples/1D_titarevtorro/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
"patch_icpp(2)%length_x": 9.5,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%pres": 1.0,
"patch_icpp(2)%alpha_rho(1)": "1 + 0.1*sin(20*x*pi)",
"patch_icpp(2)%alpha_rho(1)": 0.0,
"patch_icpp(2)%hcid": 181,
"patch_icpp(2)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
Expand Down
72 changes: 72 additions & 0 deletions examples/1D_titarevtorro_analytical/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env python3
import math
import json

# Numerical setup
Nx = 999
dx = 1.0 / (1.0 * (Nx + 1))

Tend, Nt = 5, 20000
mydt = Tend / (1.0 * Nt)

# Configuring case dictionary
print(
json.dumps(
{
# Logistics
"run_time_info": "T",
# Computational Domain Parameters
"x_domain%beg": -5.0,
"x_domain%end": 5.0,
"m": Nx,
"n": 0,
"p": 0,
"dt": mydt,
"t_step_start": 0,
"t_step_stop": int(Nt),
"t_step_save": int(math.ceil(Nt / 10.0)),
# Simulation Algorithm Parameters
"num_patches": 2,
"model_eqns": 2,
"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": -3,
"bc_x%end": -3,
# Formatted Database Files Structure Parameters
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "F",
# Patch 1 L (-5 < x < -4.5)
"patch_icpp(1)%geometry": 1,
"patch_icpp(1)%x_centroid": -4.75,
"patch_icpp(1)%length_x": 0.5,
"patch_icpp(1)%vel(1)": 0.523326,
"patch_icpp(1)%pres": 1.805,
"patch_icpp(1)%alpha_rho(1)": 1.515695,
"patch_icpp(1)%alpha(1)": 1.0,
# Patch 2 R (-4.5 < x < 5)
"patch_icpp(2)%geometry": 1,
"patch_icpp(2)%x_centroid": 0.25,
"patch_icpp(2)%length_x": 9.5,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%pres": 1.0,
"patch_icpp(2)%alpha_rho(1)": "1 + 0.1*sin(20*x*pi)",
"patch_icpp(2)%alpha(1)": 1.0,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1.0e00),
"fluid_pp(1)%pi_inf": 0.0,
}
)
)
2 changes: 1 addition & 1 deletion examples/2D_GreshoVortex/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"fd_order": 1,
"omega_wrt(3)": "T",
# Patch 1
"patch_icpp(1)%geometry": 7,
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%hcid": 203,
"patch_icpp(1)%x_centroid": 0.5,
"patch_icpp(1)%y_centroid": 0.5,
Expand Down
5 changes: 3 additions & 2 deletions examples/2D_acoustic_pulse/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@
"patch_icpp(2)%radius": 1.0,
"patch_icpp(2)%vel(1)": 0,
"patch_icpp(2)%vel(2)": 0,
"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))",
"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))",
"patch_icpp(2)%pres": 0.0,
"patch_icpp(2)%alpha_rho(1)": 0.0,
"patch_icpp(2)%hcid": 281,
"patch_icpp(2)%alpha(1)": 1.0,
"patch_icpp(2)%alter_patch(1)": "T",
# CBC Inflow / Outflow
Expand Down
102 changes: 102 additions & 0 deletions examples/2D_acoustic_pulse_analytical/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import math
import json

# Numerical setup
Nx = 99
Ny = 99
dx = 8.0 / (1.0 * (Nx + 1))

alf_st = 0.4

p_inf = 101325
rho_inf = 1
gam = 1.4

c = math.sqrt(gam * (p_inf) / rho_inf)
cfl = 0.3
mydt = cfl * dx / c
Tfinal = 80 * 1 / c
Nt = int(Tfinal / mydt)

# Configuring case dictionary
print(
json.dumps(
{
# Logistics
"run_time_info": "T",
# Computational Domain Parameters
"x_domain%beg": -4,
"x_domain%end": 4,
"y_domain%beg": -4,
"y_domain%end": 4,
"m": Nx,
"n": Ny,
"p": 0,
"dt": mydt,
"t_step_start": 0,
"t_step_stop": Nt,
"t_step_save": int(Nt / 100),
# Simulation Algorithm Parameters
"num_patches": 2,
"model_eqns": 2,
"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": -8,
"bc_x%end": -8,
"bc_y%beg": -8,
"bc_y%end": -8,
# Formatted Database Files Structure Parameters
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "T",
"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": 8.0,
"patch_icpp(1)%length_y": 8.0,
"patch_icpp(1)%vel(1)": 0,
"patch_icpp(1)%vel(2)": 0,
"patch_icpp(1)%pres": p_inf,
"patch_icpp(1)%alpha_rho(1)": rho_inf,
"patch_icpp(1)%alpha(1)": 1.0,
# Patch 2
"patch_icpp(2)%geometry": 2,
"patch_icpp(2)%x_centroid": 0,
"patch_icpp(2)%y_centroid": 0,
"patch_icpp(2)%radius": 1.0,
"patch_icpp(2)%vel(1)": 0,
"patch_icpp(2)%vel(2)": 0,
"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))",
"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))",
"patch_icpp(2)%alpha(1)": 1.0,
"patch_icpp(2)%alter_patch(1)": "T",
# CBC Inflow / Outflow
"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,
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0e00 / (gam - 1.0e00),
"fluid_pp(1)%pi_inf": 0.0,
}
)
)
2 changes: 1 addition & 1 deletion examples/2D_hardcodied_ic/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"prim_vars_wrt": "T",
"parallel_io": "T",
# Patch 1: Base
"patch_icpp(1)%geometry": 7,
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%hcid": 200,
"patch_icpp(1)%x_centroid": 4.0,
"patch_icpp(1)%y_centroid": 4.0,
Expand Down
Loading
Loading