|
4 | 4 | # + https://doi.org/10.1016/j.ijhydene.2023.03.190: Verification of numerical method |
5 | 5 | # + https://doi.org/10.1016/j.compfluid.2013.10.014: 4.7. Multi-species reactive shock tube |
6 | 6 |
|
7 | | -import json |
| 7 | +import json, argparse |
8 | 8 | import cantera as ct |
9 | 9 |
|
| 10 | +parser = argparse.ArgumentParser( |
| 11 | + prog="1D_reactive_shocktube", |
| 12 | + formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
| 13 | + |
| 14 | +parser.add_argument("--mfc", type=json.loads, default='{}', metavar="DICT", |
| 15 | + help="MFC's toolchain's internal state.") |
| 16 | +parser.add_argument("--no-chem", dest='chem', default=True, action="store_false", |
| 17 | + help="Disable chemistry.") |
| 18 | +parser.add_argument("--scale", type=float, default=1, help="Scale.") |
| 19 | + |
| 20 | +args = parser.parse_args() |
| 21 | + |
10 | 22 | ctfile = 'h2o2.yaml' |
11 | 23 | sol_L = ct.Solution(ctfile) |
12 | 24 | sol_L.DPX = 0.072, 7173, 'H2:2,O2:1,AR:7' |
|
18 | 30 | u_r = -487.34 |
19 | 31 |
|
20 | 32 | L = 0.12 |
21 | | -Nx = 800 |
| 33 | +Nx = 800 * args.scale |
22 | 34 | dx = L/Nx |
23 | 35 | dt = dx/abs(u_r)*0.01 |
24 | 36 | Tend=230e-6 |
|
27 | 39 | SAVE_COUNT=100 |
28 | 40 | NS=NT//SAVE_COUNT |
29 | 41 |
|
30 | | -chemistry = True |
31 | | - |
32 | 42 | case = { |
33 | 43 | # Logistics ================================================================ |
34 | 44 | 'run_time_info' : 'T', |
|
45 | 55 | 't_step_stop' : NT, |
46 | 56 | 't_step_save' : NS, |
47 | 57 | 't_step_print' : NS, |
48 | | - 'parallel_io' : 'F', |
| 58 | + 'parallel_io' : 'T' if args.mfc.get("mpi", True) else 'F', |
49 | 59 |
|
50 | 60 | # Simulation Algorithm Parameters ========================================== |
51 | 61 | 'model_eqns' : 2, |
|
66 | 76 | 'bc_x%end' :-3, |
67 | 77 |
|
68 | 78 | # Chemistry ================================================================ |
69 | | - 'chemistry' : 'F' if not chemistry else 'T', |
| 79 | + 'chemistry' : 'F' if not args.chemistry else 'T', |
70 | 80 | 'chem_params%advection' : 'T', |
71 | 81 | 'chem_params%diffusion' : 'F', |
72 | 82 | 'chem_params%reactions' : 'T', |
|
77 | 87 | 'format' : 1, |
78 | 88 | 'precision' : 2, |
79 | 89 | 'prim_vars_wrt' : 'T', |
| 90 | + 'chem_wrt_T' : 'T', |
80 | 91 | # ========================================================================== |
81 | 92 |
|
82 | 93 | # ========================================================================== |
|
105 | 116 | # ========================================================================== |
106 | 117 | } |
107 | 118 |
|
108 | | -if chemistry: |
| 119 | +if args.chemistry: |
109 | 120 | for i in range(len(sol_L.Y)): |
| 121 | + case[f'chem_wrt_Y({i + 1})'] = 'T' |
110 | 122 | case[f'patch_icpp(1)%Y({i+1})'] = sol_L.Y[i] |
111 | 123 | case[f'patch_icpp(2)%Y({i+1})'] = sol_R.Y[i] |
112 | 124 |
|
|
0 commit comments