|
| 1 | +""" |
| 2 | +Right-moving acoustic pulse in a single Mie-Gruneisen fluid at its reference state. |
| 3 | +A rectangle patch carries a simple-wave perturbation (drho, dp = c^2 drho, du = c drho/rho0), so |
| 4 | +only the right-going characteristic is excited; the harness tracks the centroid of drho against |
| 5 | +the general analytic c. Patches rather than an analytic IC: an IC expression is compiled in, and |
| 6 | +every distinct one costs the test suite a full rebuild. |
| 7 | +""" |
| 8 | + |
| 9 | +import argparse |
| 10 | +import json |
| 11 | +import math |
| 12 | + |
| 13 | +parser = argparse.ArgumentParser(description="1D Mie-Gruneisen acoustic pulse") |
| 14 | +parser.add_argument("--mfc", type=json.loads, default="{}", metavar="DICT") |
| 15 | +parser.add_argument("-N", type=int, default=200) |
| 16 | +parser.add_argument("--cfl", type=float, default=0.4) |
| 17 | +parser.add_argument("--a", type=float, default=0.0, help="Gruneisen slope: Gamma_G = Gamma_0 + a mu") |
| 18 | +args = parser.parse_args() |
| 19 | + |
| 20 | +rho0, p0, c0, s, gruneisen = 1.0, 1.0, 1.0, 1.5, 0.4 |
| 21 | +c = math.sqrt(c0**2 + (1.0 + gruneisen) * p0 / rho0 + args.a * p0 / (rho0 * gruneisen)) # the frozen speed at the reference state |
| 22 | +amp, x0, width = 1.0e-4, 0.25, 0.1 |
| 23 | +N, L, T_end = args.N, 1.0, 0.3 |
| 24 | +dt = args.cfl * (L / N) / c |
| 25 | +Nt = math.ceil(T_end / dt) |
| 26 | +dt = T_end / Nt |
| 27 | + |
| 28 | +print( |
| 29 | + json.dumps( |
| 30 | + { |
| 31 | + "run_time_info": "F", |
| 32 | + "x_domain%beg": 0.0, |
| 33 | + "x_domain%end": L, |
| 34 | + "m": N - 1, |
| 35 | + "n": 0, |
| 36 | + "p": 0, |
| 37 | + "dt": dt, |
| 38 | + "t_step_start": 0, |
| 39 | + "t_step_stop": Nt, |
| 40 | + "t_step_save": Nt, |
| 41 | + "model_eqns": 2, |
| 42 | + "num_fluids": 1, |
| 43 | + "time_stepper": 3, |
| 44 | + "recon_type": "weno", |
| 45 | + "weno_order": 5, |
| 46 | + "weno_eps": 1.0e-16, |
| 47 | + "mapped_weno": "T", |
| 48 | + "riemann_solver": 2, |
| 49 | + "wave_speeds": 1, |
| 50 | + "avg_state": 2, |
| 51 | + "bc_x%beg": -3, |
| 52 | + "bc_x%end": -3, |
| 53 | + "format": 1, |
| 54 | + "precision": 2, |
| 55 | + "prim_vars_wrt": "T", |
| 56 | + "parallel_io": "F", |
| 57 | + "num_patches": 2, |
| 58 | + "patch_icpp(1)%geometry": 1, |
| 59 | + "patch_icpp(1)%x_centroid": 0.5, |
| 60 | + "patch_icpp(1)%length_x": L, |
| 61 | + "patch_icpp(1)%alpha_rho(1)": rho0, |
| 62 | + "patch_icpp(1)%alpha(1)": 1.0, |
| 63 | + "patch_icpp(1)%vel(1)": 0.0, |
| 64 | + "patch_icpp(1)%pres": p0, |
| 65 | + "patch_icpp(2)%geometry": 1, |
| 66 | + "patch_icpp(2)%alter_patch(1)": "T", |
| 67 | + "patch_icpp(2)%x_centroid": x0, |
| 68 | + "patch_icpp(2)%length_x": width, |
| 69 | + "patch_icpp(2)%alpha_rho(1)": rho0 + amp, |
| 70 | + "patch_icpp(2)%alpha(1)": 1.0, |
| 71 | + "patch_icpp(2)%vel(1)": c / rho0 * amp, |
| 72 | + "patch_icpp(2)%pres": p0 + c**2 * amp, |
| 73 | + "fluid_pp(1)%eos": "mie_gruneisen", |
| 74 | + "fluid_pp(1)%mg_rho0": rho0, |
| 75 | + "fluid_pp(1)%mg_c0": c0, |
| 76 | + "fluid_pp(1)%mg_s": s, |
| 77 | + "fluid_pp(1)%mg_gruneisen": gruneisen, |
| 78 | + **({"fluid_pp(1)%mg_gruneisen_a": args.a} if args.a else {}), |
| 79 | + } |
| 80 | + ) |
| 81 | +) |
0 commit comments