Skip to content

Commit 44c6c06

Browse files
committed
Small Changes
1 parent a1709ef commit 44c6c06

19 files changed

+304
-297
lines changed

docs/documentation/case.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,16 @@ and use `patch_icpp(i)%%geometry = 7` and `patch_icpp(i)%%hcid = 200` in the inp
236236
Additional variables can be declared in `Hardcoded1[2,3]DVariables` and used in `hardcoded1[2,3]D`.
237237
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.
238238

239-
Also Several custom hard-coded patches are already defined to support common workflows. These include:
239+
The code provides three pre-built patches for dimensional extrusion of initial conditions:
240+
241+
- `case(170)`: Load 1D profile from data files
242+
- `case(270)`: Extrude 1D data to 2D domain
243+
- `case(370)`: Extrude 2D data to 3D domain
244+
245+
Setup: Only requires specifying `init_dir` and filename pattern via `zeros_default`. Grid dimensions are automatically detected from the data files.
246+
Implementation: All variables and file handling are managed in `src/pre_process/include/ExtrusionHardcodedIC.fpp` with no manual grid configuration needed.
247+
Usage: Ideal for initializing simulations from lower-dimensional solutions, enabling users to add perturbations or modifications to the base extruded fields for flow instability studies.
240248

241-
By convention, patch ID `case(170)` load a 1D profile, ID `case(270)` extrude that 1D data into 2D, and ID `case(370)` extrude 2D data into 3D.
242-
You only need to supply `init_dir` (and the filename‐pattern via `zeros_default`). All related variables (including init_dir, zeros_default, and the “files_loaded” flag)
243-
live in `src/pre_process/include/ExtrusionHardcodedIC.fpp`, and no manual grid‐size settings are required.
244249
#### Parameter Descriptions
245250

246251
- `num_patches` defines the total number of patches defined in the domain.

examples/1D_Ext_Test/case.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/usr/bin/env python3
2+
# References:
3+
# + https://doi.org/10.1016/j.compfluid.2013.10.014: 4.3. Multi-component inert shock tube
4+
5+
import json
6+
import argparse
7+
import math
8+
9+
import cantera as ct
10+
11+
parser = argparse.ArgumentParser(prog="nD_inert_shocktube", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
12+
13+
parser.add_argument("--mfc", type=json.loads, default="{}", metavar="DICT", help="MFC's toolchain's internal state.")
14+
parser.add_argument("--no-chem", dest="chemistry", default=True, action="store_false", help="Disable chemstry.")
15+
16+
args = parser.parse_args()
17+
18+
ctfile = "h2o2.yaml"
19+
sol_L = ct.Solution(ctfile)
20+
sol_L.TPX = 300, 101325, "O:1"
21+
u_r = -487.34
22+
L = 0.12
23+
Nx = 400
24+
dx = L / Nx
25+
dt = dx / abs(u_r) * 0.02
26+
Tend = 230e-6
27+
28+
NT = int(Tend / dt)
29+
SAVE_COUNT = 100
30+
NS = NT // SAVE_COUNT
31+
32+
case = {
33+
# Logistics ================================================================
34+
"run_time_info": "T",
35+
# ==========================================================================
36+
# Computational Domain Parameters ==========================================
37+
"x_domain%beg": 0,
38+
"x_domain%end": +L,
39+
"m": Nx,
40+
"n": 0,
41+
"p": 0,
42+
"dt": float(dt),
43+
"t_step_start": 0,
44+
"t_step_stop": NT,
45+
"t_step_save": NS,
46+
"t_step_print": NS,
47+
"parallel_io": "F",
48+
# ==========================================================================
49+
# Simulation Algorithm Parameters ==========================================
50+
"model_eqns": 2,
51+
"num_fluids": 1,
52+
"num_patches": 1,
53+
"mpp_lim": "F",
54+
"mixture_err": "F",
55+
"time_stepper": 3,
56+
"weno_order": 5,
57+
"weno_eps": 1e-16,
58+
"weno_avg": "F",
59+
"mapped_weno": "T",
60+
"mp_weno": "T",
61+
"riemann_solver": 2,
62+
"wave_speeds": 2,
63+
"avg_state": 1,
64+
"bc_x%beg": -2,
65+
"bc_x%end": -3,
66+
"viscous": "F",
67+
# ==========================================================================
68+
# Chemistry ================================================================
69+
"chemistry": "T" if not args.chemistry else "T",
70+
"chem_params%diffusion": "F",
71+
"chem_params%reactions": "T",
72+
# ==========================================================================
73+
# Formatted Database Files Structure Parameters ============================
74+
"format": 1,
75+
"precision": 2,
76+
"prim_vars_wrt": "F",
77+
# ==========================================================================
78+
# ==========================================================================
79+
"patch_icpp(1)%geometry": 15,
80+
"patch_icpp(1)%hcid": 170,
81+
"patch_icpp(1)%x_centroid": L / 2,
82+
"patch_icpp(1)%length_x": L,
83+
"patch_icpp(1)%vel(1)": "8*exp(-400*((x-0.002/2)/0.002)**2)",
84+
"patch_icpp(1)%pres": 1.01315e5,
85+
"patch_icpp(1)%alpha(1)": 1,
86+
# 'patch_icpp(1)%Y(1)' : '0.4+x/0.002*0.2',
87+
# 'patch_icpp(1)%Y(4)' : '0.6-x/0.002*0.2',
88+
# 'patch_icpp(1)%Y(5)' : '0.6-x/0.002*0.2',
89+
"patch_icpp(1)%alpha_rho(1)": "1", #'(1.01325*10**5-1100*exp(-400*((x-0.002/2)/0.002)**2))/(8.314*1000*( (0.4+x/0.002*0.2)/2.016+(0.6-x/0.002*0.2)/32)*(300+30*exp(-400*((x-0.002/2)/0.002)**2)))',
90+
# ==========================================================================
91+
# Fluids Physical Parameters ===============================================
92+
"fluid_pp(1)%gamma": 1.0e00 / (1.32e00 - 1.0e00),
93+
"fluid_pp(1)%pi_inf": 0,
94+
# ==========================================================================
95+
# Chemistry ================================================================
96+
"cantera_file": ctfile,
97+
# ==========================================================================
98+
}
99+
100+
101+
if __name__ == "__main__":
102+
print(json.dumps(case))
26.8 KB
Binary file not shown.
26.8 KB
Binary file not shown.
26.8 KB
Binary file not shown.
26.8 KB
Binary file not shown.
26.8 KB
Binary file not shown.
26.8 KB
Binary file not shown.
26.8 KB
Binary file not shown.
26.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)