|
1 | | -#!/usr/bin/env python3 |
2 | | - |
| 1 | +#!/usr/bin/env python3 |
3 | 2 | # References: |
4 | 3 | # + DOI: 10.2514/6.2020-1751: IV.B. Multi-component diffusion |
5 | 4 |
|
|
9 | 8 |
|
10 | 9 | import cantera as ct |
11 | 10 |
|
12 | | -parser = argparse.ArgumentParser( |
13 | | - prog="1D_MultiComponent_Diffusion", |
14 | | - formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
| 11 | +parser = argparse.ArgumentParser(prog="1D_MultiComponent_Diffusion", formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
15 | 12 |
|
16 | | -parser.add_argument("--mfc", type=json.loads, default='{}', metavar="DICT", |
17 | | - help="MFC's toolchain's internal state.") |
18 | | -parser.add_argument("--no-chem", dest='chemistry', default=True, action="store_false", |
19 | | - help="Disable chemistry.") |
| 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 chemistry.") |
20 | 15 |
|
21 | 16 | args = parser.parse_args() |
22 | 17 |
|
23 | | -ctfile = 'grigri.yaml' |
| 18 | +ctfile = "grigri.yaml" |
24 | 19 |
|
25 | | -L = 0.05 |
26 | | -Nx = 100 |
27 | | -dx = L / Nx |
28 | | -dt = 0.3e-6 |
| 20 | +L = 0.05 |
| 21 | +Nx = 100 |
| 22 | +dx = L / Nx |
| 23 | +dt = 0.3e-6 |
29 | 24 | Tend = 0.05 |
30 | 25 |
|
31 | | -NT = int(Tend / dt) |
| 26 | +NT = int(Tend / dt) |
32 | 27 | SAVE_COUNT = 2000 |
33 | | -NS = 2000 |
| 28 | +NS = 2000 |
34 | 29 | case = { |
35 | | - 'run_time_info' : 'T', |
36 | | - 'x_domain%beg' : 0, |
37 | | - 'x_domain%end' : +L, |
38 | | - 'm' : Nx, |
39 | | - 'n' : 0, |
40 | | - 'p' : 0, |
41 | | - 'dt' : float(dt), |
42 | | - 't_step_start' : 0, |
43 | | - 't_step_stop' : NT, |
44 | | - 't_step_save' : NS, |
45 | | - 't_step_print' : NS, |
46 | | - 'parallel_io' : 'F', |
47 | | - 'model_eqns' : 2, |
48 | | - 'num_fluids' : 1, |
49 | | - 'num_patches' : 1, |
50 | | - 'mpp_lim' : 'F', |
51 | | - 'mixture_err' : 'F', |
52 | | - 'time_stepper' : 3, |
53 | | - 'weno_order' : 5, |
54 | | - 'weno_eps' : 1E-16, |
55 | | - 'weno_avg' : 'F', |
56 | | - 'mapped_weno' : 'T', |
57 | | - 'mp_weno' : 'T', |
58 | | - 'riemann_solver' : 2, |
59 | | - 'wave_speeds' : 2, |
60 | | - 'avg_state' : 1, |
61 | | - 'bc_x%beg' :-1, |
62 | | - 'bc_x%end' :-1, |
63 | | - 'chemistry' : 'T' if not args.chemistry else 'T', |
64 | | - 'chem_params%diffusion' : 'T', |
65 | | - 'chem_params%reactions' : 'F', |
66 | | - 'format' : 1, |
67 | | - 'precision' : 2, |
68 | | - 'prim_vars_wrt' : 'T', |
69 | | - 'patch_icpp(1)%geometry' : 1, |
70 | | - 'patch_icpp(1)%x_centroid' : L/2, |
71 | | - 'patch_icpp(1)%length_x' : L, |
72 | | - 'patch_icpp(1)%vel(1)' : '0', |
73 | | - 'patch_icpp(1)%pres' : 1.01325e5, |
74 | | - 'patch_icpp(1)%alpha(1)' : 1, |
75 | | - 'patch_icpp(1)%Y(1)' : '(0.195-0.142)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.142', |
76 | | - 'patch_icpp(1)%Y(2)' : '(0.0-0.1)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.1', |
77 | | - 'patch_icpp(1)%Y(3)' : '(0.214-0.0)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.0', |
78 | | - 'patch_icpp(1)%Y(4)' : '(0.591-0.758)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.758', |
79 | | - 'patch_icpp(1)%alpha_rho(1)' : '1.01325d0*10.0d0**(5.0d0)/(((320.0d0-1350.0d0)*(1.0d0-0.50d0*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+1350.0d0)*8.3144626d0*1000.0d0*( ((0.195d0-0.142d0)*(1.0d0-0.5d0*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.142d0)/31.998d0 +((0.0-0.1)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.1)/18.01508d0+ ((0.214-0.0)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.0)/16.04256 + ((0.591-0.758)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.758)/28.0134))', |
80 | | - |
81 | | - 'fluid_pp(1)%gamma' : 1.0E+00/(1.9326E+00-1.0E+00), |
82 | | - 'fluid_pp(1)%pi_inf' : 0, |
83 | | - 'cantera_file' : ctfile, |
| 30 | + "run_time_info": "T", |
| 31 | + "x_domain%beg": 0, |
| 32 | + "x_domain%end": +L, |
| 33 | + "m": Nx, |
| 34 | + "n": 0, |
| 35 | + "p": 0, |
| 36 | + "dt": float(dt), |
| 37 | + "t_step_start": 0, |
| 38 | + "t_step_stop": NT, |
| 39 | + "t_step_save": NS, |
| 40 | + "t_step_print": NS, |
| 41 | + "parallel_io": "F", |
| 42 | + "model_eqns": 2, |
| 43 | + "num_fluids": 1, |
| 44 | + "num_patches": 1, |
| 45 | + "mpp_lim": "F", |
| 46 | + "mixture_err": "F", |
| 47 | + "time_stepper": 3, |
| 48 | + "weno_order": 5, |
| 49 | + "weno_eps": 1e-16, |
| 50 | + "weno_avg": "F", |
| 51 | + "mapped_weno": "T", |
| 52 | + "mp_weno": "T", |
| 53 | + "riemann_solver": 2, |
| 54 | + "wave_speeds": 2, |
| 55 | + "avg_state": 1, |
| 56 | + "bc_x%beg": -1, |
| 57 | + "bc_x%end": -1, |
| 58 | + "chemistry": "T" if not args.chemistry else "T", |
| 59 | + "chem_params%diffusion": "T", |
| 60 | + "chem_params%reactions": "F", |
| 61 | + "format": 1, |
| 62 | + "precision": 2, |
| 63 | + "prim_vars_wrt": "T", |
| 64 | + "patch_icpp(1)%geometry": 1, |
| 65 | + "patch_icpp(1)%x_centroid": L / 2, |
| 66 | + "patch_icpp(1)%length_x": L, |
| 67 | + "patch_icpp(1)%vel(1)": "0", |
| 68 | + "patch_icpp(1)%pres": 1.01325e5, |
| 69 | + "patch_icpp(1)%alpha(1)": 1, |
| 70 | + "patch_icpp(1)%Y(1)": "(0.195-0.142)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.142", |
| 71 | + "patch_icpp(1)%Y(2)": "(0.0-0.1)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.1", |
| 72 | + "patch_icpp(1)%Y(3)": "(0.214-0.0)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.0", |
| 73 | + "patch_icpp(1)%Y(4)": "(0.591-0.758)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.758", |
| 74 | + "patch_icpp(1)%alpha_rho(1)": "1.01325d0*10.0d0**(5.0d0)/(((320.0d0-1350.0d0)*(1.0d0-0.50d0*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+1350.0d0)*8.3144626d0*1000.0d0*( ((0.195d0-0.142d0)*(1.0d0-0.5d0*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.142d0)/31.998d0 +((0.0-0.1)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.1)/18.01508d0+ ((0.214-0.0)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.0)/16.04256 + ((0.591-0.758)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.758)/28.0134))", |
| 75 | + "fluid_pp(1)%gamma": 1.0e00 / (1.9326e00 - 1.0e00), |
| 76 | + "fluid_pp(1)%pi_inf": 0, |
| 77 | + "cantera_file": ctfile, |
84 | 78 | } |
85 | 79 |
|
86 | 80 | if args.chemistry: |
87 | 81 | for i in range(4): |
88 | | - case[f'chem_wrt_Y({i + 1})'] = 'T' |
89 | | -if __name__ == '__main__': |
| 82 | + case[f"chem_wrt_Y({i + 1})"] = "T" |
| 83 | +if __name__ == "__main__": |
90 | 84 | print(json.dumps(case)) |
|
0 commit comments