diff --git a/docs/documentation/case.md b/docs/documentation/case.md index dd5f2692de..416e79d6e4 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -98,6 +98,11 @@ There are multiple sets of parameters that must be specified in the python input Items 8, 9, 10, 11 and 12 are optional sets of parameters that activate the acoustic source model, ensemble-averaged bubble model, initial velocity field setup, phase change, artificial Mach number respectively. Definition of the parameters is described in the following subsections. +Enumerated parameters accept named values as well as integer codes: `"riemann_solver": "hllc"` +is equivalent to `"riemann_solver": 2`. Defined names appear in each parameter's table entry +(e.g. `1` (`hll`), `2` (`hllc`)). Existing case files can be rewritten to named syntax with +`./mfc.sh validate case.py --migrate`. + ### 1. Runtime {#sec-runtime} | Parameter | Type | Description | @@ -218,8 +223,10 @@ Some parameters, as described above, can be defined by analytical functions in t where `alpha_rho` is defined with the `1 + 0.1*sin(20*x*pi)` function. -The expressions are interpreted as Fortran code, in the execution context and scope of the function that defines the patch. -Additionally, the following variables are made available as shorthand: +Expressions use **Python syntax** and are parsed at case load time. +Syntax errors and unknown variable or function names are immediate, named errors — they are reported before any Fortran is compiled, with a message identifying the offending expression and listing the available names. + +The following variables are available in IC patch expressions: | Shorthand | Expands To | Shorthand | Expands To | Shorthand | Expands To | | --------- | ------------------------ | --------- | ------------------------- | --------- | ------------------------ | @@ -227,15 +234,23 @@ Additionally, the following variables are made available as shorthand: | `y` | `y_cc(j)` | `ly` | The patch's `length_y` | `yc` | The patch's `y_centroid` | | `z` | `z_cc(k)` | `lz` | The patch's `length_z` | `zc` | The patch's `z_centroid` | | `eps` | The patch's `epsilon` | `beta` | The patch's `beta` | `radii` | The patch's `radii` | -| `tau_e` | The patch's `tau_e` | `r` | The patch's `radius` | `pi` and `e` | \f$\pi\f$ and \f$e\f$ | +| `tau_e` | The patch's `tau_e` | `r` | The patch's `radius` | `pi` | \f$\pi\f$ (Fortran constant from `m_constants`) | where $(i,j,k)$ are the grid-indices of the current cell in each coordinate direction. +The allowed functions are the standard Fortran intrinsics: +`sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `atan2`, +`sinh`, `cosh`, `tanh`, `exp`, `log`, `log10`, `sqrt`, +`abs`, `min`, `max`, `mod`, `sign`. + +**Euler's number:** bare `e` is **not** a variable. +Write `exp(1.0)` or a numeric literal instead (e.g. `2.718281828`). + In the example above, the following code is generated: ```f90 if (patch_id == 2) then - q_prim_vf(eqn_idx%cont%beg)%sf(i, 0, 0) = 1 + 0.1*sin(20*x_cc(i)*3.141592653589793) + q_prim_vf(eqn_idx%cont%beg)%sf(i, 0, 0) = 1 + 0.1 * sin(20 * x_cc(i) * pi) end if ``` @@ -364,9 +379,13 @@ Additional details on this specification can be found in [NACA airfoil](https:// - `moving_ibm` sets the method by which movement will be applied to the immersed boundary. Using 0 will result in no movement. Using 1 will result 1-way coupling where the boundary moves at a constant rate and applied forces to the fluid based upon it's own motion. In 1-way coupling, the fluid does not apply forces back onto the IB. Using 2 will result in 2-way coupling, where the boundary pushes on the fluid and the fluid pushes back on the boundary via pressure and viscous forces. If external forces are applied, the boundary will also experience those forces. -- `vel(i)` is the initial linear velocity of the IB in the x, y, z direction for i=1, 2, 3. When `moving_ibm` equals 2, this velocity is just the starting speed of the object, which will then accelerate due to external forces. If `moving_ibm` equals 1, then this is constant if it is a number, or can be described analytically with an expression. +- `vel(i)` is the initial linear velocity of the IB in the x, y, z direction for i=1, 2, 3. When `moving_ibm` equals 2, this velocity is just the starting speed of the object, which will then accelerate due to external forces. If `moving_ibm` equals 1, then this is constant if it is a number, or can be described analytically with an expression. + +- `angular_vel(i)` is the initial angular velocity of the IB about the x, y, z axes for i=1, 2, 3 in radians per second. When `moving_ibm` equals 2, this rotation rate is just the starting rate of the object, which will then change due to external torques. If `moving_ibm` equals 1, then this is constant if it is a number, or can be described analytically with an expression. -- `angular_vel(i)` is the initial angular velocity of the IB about the x, y, z axes for i=1, 2, 3 in radians per second. When `moving_ibm` equals 2, this rotation rate is just the starting rate of the object, which will then change due to external torques. If `moving_ibm` equals 1, then this is constant if it is a number, or can be described analytically with an expression. + Moving-IB analytic expressions use the same Python syntax and error-reporting as IC patch expressions (see the "Analytical Definition of Primitive Variables" section above). + Available variables: `x` (`x_cc(i)`), `y` (`y_cc(j)`), `z` (`z_cc(k)`), `t` (current simulation time), and `r` (the IB patch radius). + The same intrinsic functions and `pi` constant apply; bare `e` is not available. - `coefficient_of_restitution` is a number from 0 (exclusive) to 1 (inclusive) describing how elastic IB collisions are. 0 is for perfectly inellastic collisions while 1 is for perfectly ellastic collisions. diff --git a/examples/0D_bubblecollapse_adap/case.py b/examples/0D_bubblecollapse_adap/case.py index ac79d69275..df515c7f21 100644 --- a/examples/0D_bubblecollapse_adap/case.py +++ b/examples/0D_bubblecollapse_adap/case.py @@ -69,25 +69,25 @@ "t_step_save": t_save, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "fd_order": 1, @@ -103,7 +103,7 @@ "patch_icpp(1)%v0": 0.0, # Bubbles "bubbles_euler": "T", - "bubble_model": 2, + "bubble_model": "keller_miksis", # Nondimensional numbers "bub_pp%R0ref": R0ref / x0, "bub_pp%p0ref": p0ref / p0, diff --git a/examples/1D_acoustic_dipole/case.py b/examples/1D_acoustic_dipole/case.py index 793b4aa0eb..785a7f2806 100644 --- a/examples/1D_acoustic_dipole/case.py +++ b/examples/1D_acoustic_dipole/case.py @@ -19,26 +19,26 @@ "t_step_save": 1, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_acoustic_gauss_sigmadist/case.py b/examples/1D_acoustic_gauss_sigmadist/case.py index 1c258638a8..2eb1af4716 100644 --- a/examples/1D_acoustic_gauss_sigmadist/case.py +++ b/examples/1D_acoustic_gauss_sigmadist/case.py @@ -19,26 +19,26 @@ "t_step_save": 1, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_acoustic_gauss_sigmatime/case.py b/examples/1D_acoustic_gauss_sigmatime/case.py index 11520f5b44..679b24c382 100644 --- a/examples/1D_acoustic_gauss_sigmatime/case.py +++ b/examples/1D_acoustic_gauss_sigmatime/case.py @@ -19,26 +19,26 @@ "t_step_save": 1, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_acoustic_sine_frequency/case.py b/examples/1D_acoustic_sine_frequency/case.py index f53e743369..ffad5b2d4c 100644 --- a/examples/1D_acoustic_sine_frequency/case.py +++ b/examples/1D_acoustic_sine_frequency/case.py @@ -19,26 +19,26 @@ "t_step_save": 1, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_acoustic_sine_wavelength/case.py b/examples/1D_acoustic_sine_wavelength/case.py index 9a57b159a9..b246480560 100644 --- a/examples/1D_acoustic_sine_wavelength/case.py +++ b/examples/1D_acoustic_sine_wavelength/case.py @@ -19,26 +19,26 @@ "t_step_save": 5, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_advection_convergence/case.py b/examples/1D_advection_convergence/case.py index f8fbef41f1..f6e69f4883 100644 --- a/examples/1D_advection_convergence/case.py +++ b/examples/1D_advection_convergence/case.py @@ -39,13 +39,13 @@ if args.muscl: scheme_params = { - "recon_type": 2, - "muscl_order": 2, + "recon_type": "muscl", + "muscl_order": "second_order", "muscl_lim": args.muscl_lim, } else: scheme_params = { - "recon_type": 1, + "recon_type": "weno", "weno_order": args.order, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -69,19 +69,19 @@ "t_step_stop": Nt, "t_step_save": Nt, "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "time_stepper": "rk3", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "patch_icpp(1)%geometry": 1, diff --git a/examples/1D_brio_wu/case.py b/examples/1D_brio_wu/case.py index 6c59dc238d..0e9714fdf2 100644 --- a/examples/1D_brio_wu/case.py +++ b/examples/1D_brio_wu/case.py @@ -22,25 +22,25 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "mapped_weno": "T", "weno_eps": 1.0e-16, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_brio_wu_hlld/case.py b/examples/1D_brio_wu_hlld/case.py index 19f94a32a5..d5dd02a6fc 100644 --- a/examples/1D_brio_wu_hlld/case.py +++ b/examples/1D_brio_wu_hlld/case.py @@ -23,25 +23,25 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "mapped_weno": "T", "weno_eps": 1.0e-16, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 4, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hlld", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_brio_wu_rmhd/case.py b/examples/1D_brio_wu_rmhd/case.py index f35a10a2d8..45bb4295b0 100644 --- a/examples/1D_brio_wu_rmhd/case.py +++ b/examples/1D_brio_wu_rmhd/case.py @@ -23,25 +23,25 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "mapped_weno": "T", "weno_eps": 1.0e-16, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_bubblescreen/case.py b/examples/1D_bubblescreen/case.py index f5d6011946..4b29e52e7e 100755 --- a/examples/1D_bubblescreen/case.py +++ b/examples/1D_bubblescreen/case.py @@ -88,12 +88,12 @@ "t_step_save": Nout, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -101,14 +101,14 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "fd_order": 1, @@ -142,7 +142,7 @@ "fluid_pp(1)%pi_inf": gam_l * (pi_inf_l / p0) / (gam_l - 1.0), # Bubbles "bubbles_euler": "T", - "bubble_model": 3, + "bubble_model": "rayleigh_plesset", "polytropic": "T", "polydisperse": "F", "thermal": 3, diff --git a/examples/1D_cont_damage/case.py b/examples/1D_cont_damage/case.py index aad89e4247..7040627256 100644 --- a/examples/1D_cont_damage/case.py +++ b/examples/1D_cont_damage/case.py @@ -19,12 +19,12 @@ "t_step_save": 50000, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -32,9 +32,9 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Turning on Hypoelasticity @@ -56,8 +56,8 @@ "acoustic(1)%frequency": 1e4, "acoustic(1)%delay": 0, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Patch 1 L diff --git a/examples/1D_convergence/case.py b/examples/1D_convergence/case.py index 7c5858bed4..6c89c15dff 100755 --- a/examples/1D_convergence/case.py +++ b/examples/1D_convergence/case.py @@ -43,7 +43,7 @@ "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": args.order, "weno_eps": dx**2, "weno_Re_flux": "F", @@ -52,13 +52,13 @@ "null_weights": "F", "mp_weno": "F", "riemann_solver": args.rs, - "wave_speeds": 1, - "avg_state": 2, + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Patch 1 L diff --git a/examples/1D_dai_woodward/case.py b/examples/1D_dai_woodward/case.py index 175cd953bb..64d078f910 100644 --- a/examples/1D_dai_woodward/case.py +++ b/examples/1D_dai_woodward/case.py @@ -32,24 +32,24 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 1, "weno_eps": 1.0e-16, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_dai_woodward_hlld/case.py b/examples/1D_dai_woodward_hlld/case.py index 5a03c24f0d..4e694c21c2 100644 --- a/examples/1D_dai_woodward_hlld/case.py +++ b/examples/1D_dai_woodward_hlld/case.py @@ -32,25 +32,25 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 1, # "mapped_weno": "T", "weno_eps": 1.0e-16, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 4, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hlld", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_euler_convergence/case.py b/examples/1D_euler_convergence/case.py index d67091328e..b0a4b571ad 100644 --- a/examples/1D_euler_convergence/case.py +++ b/examples/1D_euler_convergence/case.py @@ -44,13 +44,13 @@ if args.muscl: scheme_params = { - "recon_type": 2, - "muscl_order": 2, + "recon_type": "muscl", + "muscl_order": "second_order", "muscl_lim": args.muscl_lim, } else: scheme_params = { - "recon_type": 1, + "recon_type": "weno", "weno_order": args.order, "weno_eps": 1.0e-40, "weno_Re_flux": "F", @@ -76,19 +76,19 @@ "t_step_stop": Nt, "t_step_save": Nt, "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", "time_stepper": args.time_stepper, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "patch_icpp(1)%geometry": 1, diff --git a/examples/1D_exp_bubscreen/case.py b/examples/1D_exp_bubscreen/case.py index 212e18611d..ade72646ea 100755 --- a/examples/1D_exp_bubscreen/case.py +++ b/examples/1D_exp_bubscreen/case.py @@ -90,12 +90,12 @@ "t_step_save": Nout, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -103,14 +103,14 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -8, "bc_x%end": -8, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "fd_order": 1, @@ -144,7 +144,7 @@ "fluid_pp(1)%pi_inf": gam_l * (pi_inf_l / p0) / (gam_l - 1.0), # Bubbles "bubbles_euler": "T", - "bubble_model": 2, + "bubble_model": "keller_miksis", "polytropic": "T", "polydisperse": "F", "nb": 1, diff --git a/examples/1D_exp_tube_phasechange/case.py b/examples/1D_exp_tube_phasechange/case.py index 03808cd78d..bf6747cd78 100644 --- a/examples/1D_exp_tube_phasechange/case.py +++ b/examples/1D_exp_tube_phasechange/case.py @@ -138,20 +138,20 @@ "relax_model": 6, "palpha_eps": 1.0e-2, "ptgalpha_eps": 1.0e-2, - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 - Shocked Stated diff --git a/examples/1D_hypo_2materials/case.py b/examples/1D_hypo_2materials/case.py index cd4316fc41..386072ca84 100755 --- a/examples/1D_hypo_2materials/case.py +++ b/examples/1D_hypo_2materials/case.py @@ -28,12 +28,12 @@ "t_step_save": 50, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -41,17 +41,17 @@ "mapped_weno": "F", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Turning on Hypoelasticity "hypoelasticity": "T", "fd_order": 4, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Patch 1 L diff --git a/examples/1D_impact/case.py b/examples/1D_impact/case.py index 7f434741f8..14e490c9ea 100755 --- a/examples/1D_impact/case.py +++ b/examples/1D_impact/case.py @@ -28,12 +28,12 @@ "t_step_save": int(math.ceil(Nt / 1.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -41,17 +41,17 @@ "mapped_weno": "F", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Turning on Hypoelasticity "hypoelasticity": "T", "fd_order": 4, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Patch 1 L diff --git a/examples/1D_inert_shocktube/case.py b/examples/1D_inert_shocktube/case.py index 26f45f1658..c81e92b92a 100644 --- a/examples/1D_inert_shocktube/case.py +++ b/examples/1D_inert_shocktube/case.py @@ -58,20 +58,20 @@ "t_step_print": NS, "parallel_io": "F", # Simulation Algorithm Parameters - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 1, "num_patches": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1e-16, "weno_avg": "F", "mapped_weno": "T", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -2, "bc_x%end": -3, # Chemistry @@ -79,8 +79,8 @@ "chem_params%diffusion": "F", "chem_params%reactions": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "patch_icpp(1)%geometry": 1, "patch_icpp(1)%x_centroid": -L / 4, diff --git a/examples/1D_kapilashocktube/case.py b/examples/1D_kapilashocktube/case.py index b6efbbec88..fa5ef25a40 100755 --- a/examples/1D_kapilashocktube/case.py +++ b/examples/1D_kapilashocktube/case.py @@ -19,12 +19,12 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "T", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -32,14 +32,14 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: High pressured water diff --git a/examples/1D_laxshocktube/case.py b/examples/1D_laxshocktube/case.py index 15445f792c..1b16b529ce 100644 --- a/examples/1D_laxshocktube/case.py +++ b/examples/1D_laxshocktube/case.py @@ -27,25 +27,25 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Patch 1 L diff --git a/examples/1D_mhd_smooth_alfven_wave/case.py b/examples/1D_mhd_smooth_alfven_wave/case.py index 95f39e3c24..944fd3588b 100644 --- a/examples/1D_mhd_smooth_alfven_wave/case.py +++ b/examples/1D_mhd_smooth_alfven_wave/case.py @@ -23,24 +23,24 @@ "t_step_save": 10000, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1e-7, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 4, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hlld", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "F", diff --git a/examples/1D_multispecies_diffusion/case.py b/examples/1D_multispecies_diffusion/case.py index b4f52ae438..6fb45b9acd 100644 --- a/examples/1D_multispecies_diffusion/case.py +++ b/examples/1D_multispecies_diffusion/case.py @@ -34,20 +34,20 @@ "t_step_save": NS, "t_step_print": NS, "parallel_io": "F", - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 1, "num_patches": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1e-16, "weno_avg": "F", "mapped_weno": "T", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 2, - "avg_state": 1, + "riemann_solver": "hllc", + "wave_speeds": "pressure", + "avg_state": "roe", "bc_x%beg": -1, "bc_x%end": -1, "viscous": "F", @@ -55,8 +55,8 @@ "chem_params%diffusion": "T", "chem_params%reactions": "F", "chem_params%transport_model": 2, # Unity-Lewis - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "chem_wrt_T": "T", "patch_icpp(1)%geometry": 1, diff --git a/examples/1D_poly_bubscreen/case.py b/examples/1D_poly_bubscreen/case.py index 9006f72f31..2ee9d29940 100644 --- a/examples/1D_poly_bubscreen/case.py +++ b/examples/1D_poly_bubscreen/case.py @@ -84,12 +84,12 @@ "t_step_save": 1, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 1, + "time_stepper": "rk1", "weno_order": 1, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -97,14 +97,14 @@ "mapped_weno": "F", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "fd_order": 1, @@ -127,7 +127,7 @@ "fluid_pp(1)%pi_inf": gam_l * (pi_inf_l / p0) / (gam_l - 1.0), # Bubbles "bubbles_euler": "T", - "bubble_model": 2, + "bubble_model": "keller_miksis", "polytropic": "T", "thermal": 3, "nb": 1, diff --git a/examples/1D_qbmm/case.py b/examples/1D_qbmm/case.py index 426e1460b5..d308ad5773 100644 --- a/examples/1D_qbmm/case.py +++ b/examples/1D_qbmm/case.py @@ -87,12 +87,12 @@ "t_step_save": 80, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -100,14 +100,14 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -8, "bc_x%end": -8, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "fd_order": 1, @@ -141,7 +141,7 @@ "fluid_pp(1)%pi_inf": gam_l * (pi_inf_l / p0) / (gam_l - 1.0), # Bubbles "bubbles_euler": "T", - "bubble_model": 2, + "bubble_model": "keller_miksis", "polytropic": "F", "polydisperse": "T", "poly_sigma": 0.3, diff --git a/examples/1D_reactive_shocktube/case.py b/examples/1D_reactive_shocktube/case.py index d14c20c2ea..f5a75659a8 100644 --- a/examples/1D_reactive_shocktube/case.py +++ b/examples/1D_reactive_shocktube/case.py @@ -64,20 +64,20 @@ "t_step_print": NS, "parallel_io": "F" if args.mfc.get("mpi", True) else "F", # Simulation Algorithm Parameters - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 1, "num_patches": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1e-16, "weno_avg": "F", "mapped_weno": "T", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -2, "bc_x%end": -3, # Chemistry @@ -86,8 +86,8 @@ "chem_params%reactions": "T", "cantera_file": ctfile, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "chem_wrt_T": "T", "patch_icpp(1)%geometry": 1, diff --git a/examples/1D_shuosher_analytical/case.py b/examples/1D_shuosher_analytical/case.py index 4f9ceaff56..06ef323d5a 100644 --- a/examples/1D_shuosher_analytical/case.py +++ b/examples/1D_shuosher_analytical/case.py @@ -27,25 +27,25 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Background to cover whole domain with basic line patch diff --git a/examples/1D_shuosher_old/case.py b/examples/1D_shuosher_old/case.py index 7169f664b2..c9af7bb44a 100644 --- a/examples/1D_shuosher_old/case.py +++ b/examples/1D_shuosher_old/case.py @@ -27,25 +27,25 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Background to cover whole domain with basic line patch diff --git a/examples/1D_shuosher_teno5/case.py b/examples/1D_shuosher_teno5/case.py index 8132ed2067..d934a6cc00 100644 --- a/examples/1D_shuosher_teno5/case.py +++ b/examples/1D_shuosher_teno5/case.py @@ -27,26 +27,26 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-40, "teno": "T", "teno_CT": 1.0e-6, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_shuosher_teno7/case.py b/examples/1D_shuosher_teno7/case.py index 6c7963ced1..d720251d9e 100644 --- a/examples/1D_shuosher_teno7/case.py +++ b/examples/1D_shuosher_teno7/case.py @@ -27,26 +27,26 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 7, "weno_eps": 1.0e-40, "teno": "T", "teno_CT": 1.0e-9, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_shuosher_wenojs5/case.py b/examples/1D_shuosher_wenojs5/case.py index 94a9564552..af1fb0b999 100644 --- a/examples/1D_shuosher_wenojs5/case.py +++ b/examples/1D_shuosher_wenojs5/case.py @@ -27,25 +27,25 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-6, "mapped_weno": "F", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_shuosher_wenom5/case.py b/examples/1D_shuosher_wenom5/case.py index fd479db63c..690de9262d 100644 --- a/examples/1D_shuosher_wenom5/case.py +++ b/examples/1D_shuosher_wenom5/case.py @@ -27,25 +27,25 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-40, "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_shuosher_wenoz5/case.py b/examples/1D_shuosher_wenoz5/case.py index 4bc4789a6d..6071828e5a 100644 --- a/examples/1D_shuosher_wenoz5/case.py +++ b/examples/1D_shuosher_wenoz5/case.py @@ -27,25 +27,25 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-40, "wenoz": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/1D_sodHypo/case.py b/examples/1D_sodHypo/case.py index 2339e02026..f92e2549fe 100755 --- a/examples/1D_sodHypo/case.py +++ b/examples/1D_sodHypo/case.py @@ -28,12 +28,12 @@ "t_step_save": int(Nt), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -41,16 +41,16 @@ "mapped_weno": "F", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Turning on Hypoelasticity "hypoelasticity": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Patch 1 L diff --git a/examples/1D_sod_convergence/case.py b/examples/1D_sod_convergence/case.py index cf726519e9..234ce5daa2 100644 --- a/examples/1D_sod_convergence/case.py +++ b/examples/1D_sod_convergence/case.py @@ -36,13 +36,13 @@ if args.muscl: scheme_params = { - "recon_type": 2, - "muscl_order": 2, + "recon_type": "muscl", + "muscl_order": "second_order", "muscl_lim": args.muscl_lim, } else: scheme_params = { - "recon_type": 1, + "recon_type": "weno", "weno_order": args.order, "weno_eps": 1.0e-40, "weno_Re_flux": "F", @@ -68,19 +68,19 @@ "t_step_stop": Nt, "t_step_save": Nt, "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "time_stepper": "rk3", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "patch_icpp(1)%geometry": 1, diff --git a/examples/1D_sodshocktube/case.py b/examples/1D_sodshocktube/case.py index ea0be00820..61b7b70ae6 100755 --- a/examples/1D_sodshocktube/case.py +++ b/examples/1D_sodshocktube/case.py @@ -27,12 +27,12 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -40,14 +40,14 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 L diff --git a/examples/1D_sodshocktube_muscl/case.py b/examples/1D_sodshocktube_muscl/case.py index 9a21bbecb9..32dcc35daa 100755 --- a/examples/1D_sodshocktube_muscl/case.py +++ b/examples/1D_sodshocktube_muscl/case.py @@ -27,23 +27,23 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, - "recon_type": 2, - "muscl_order": 2, - "muscl_lim": 2, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "time_stepper": "rk3", + "recon_type": "muscl", + "muscl_order": "second_order", + "muscl_lim": "mc", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 L diff --git a/examples/1D_titarevtorro/case.py b/examples/1D_titarevtorro/case.py index 2d058d1746..d2d2c663e9 100644 --- a/examples/1D_titarevtorro/case.py +++ b/examples/1D_titarevtorro/case.py @@ -27,25 +27,25 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Patch 1 L (-5 < x < -4.5) diff --git a/examples/1D_titarevtorro_analytical/case.py b/examples/1D_titarevtorro_analytical/case.py index 73f012225f..5becdec684 100644 --- a/examples/1D_titarevtorro_analytical/case.py +++ b/examples/1D_titarevtorro_analytical/case.py @@ -27,25 +27,25 @@ "t_step_save": int(math.ceil(Nt / 10.0)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Patch 1 L (-5 < x < -4.5) diff --git a/examples/1D_vacuum/case.py b/examples/1D_vacuum/case.py index c86a08af1c..a65e7b344f 100644 --- a/examples/1D_vacuum/case.py +++ b/examples/1D_vacuum/case.py @@ -19,12 +19,12 @@ "t_step_save": 1000, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -32,14 +32,14 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Left state diff --git a/examples/1D_vacuum_restart/case.py b/examples/1D_vacuum_restart/case.py index 94e40c5ec0..bb7fd4ede9 100644 --- a/examples/1D_vacuum_restart/case.py +++ b/examples/1D_vacuum_restart/case.py @@ -19,12 +19,12 @@ "t_step_save": 1000, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -32,14 +32,14 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Left state diff --git a/examples/2D_5wave_quasi1D/case.py b/examples/2D_5wave_quasi1D/case.py index 0f5d6ba4a7..663596480f 100755 --- a/examples/2D_5wave_quasi1D/case.py +++ b/examples/2D_5wave_quasi1D/case.py @@ -33,12 +33,12 @@ "t_step_save": int(math.ceil(Nt / 1)), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -46,9 +46,9 @@ "mapped_weno": "F", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, "bc_y%beg": -3, @@ -57,8 +57,8 @@ "hypoelasticity": "T", "fd_order": 4, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", # Patch 1 L diff --git a/examples/2D_GreshoVortex/case.py b/examples/2D_GreshoVortex/case.py index ada31b2dd7..3396a0ca18 100644 --- a/examples/2D_GreshoVortex/case.py +++ b/examples/2D_GreshoVortex/case.py @@ -43,24 +43,24 @@ "t_step_save": t_save, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 1, - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, # 'mapped_weno' : 'T', "wenoz": "T", - "riemann_solver": 2, + "riemann_solver": "hllc", "low_Mach": 1, - "wave_speeds": 1, - "avg_state": 2, + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "cons_vars_wrt": "T", "prim_vars_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_IGR_2fluid/case.py b/examples/2D_IGR_2fluid/case.py index 774930a0ad..113a4fcb3a 100644 --- a/examples/2D_IGR_2fluid/case.py +++ b/examples/2D_IGR_2fluid/case.py @@ -40,12 +40,12 @@ "t_step_stop": 5000, "t_step_save": 50, # Simulation Algorithm - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "mixture_err": "T", "mpp_lim": "F", - "time_stepper": 3, - "riemann_solver": 5, + "time_stepper": "rk3", + "riemann_solver": "lax_friedrichs", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, @@ -62,8 +62,8 @@ "alf_factor": 10, "viscous": "T", # Database Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Fluid Parameters (Gas) diff --git a/examples/2D_IGR_triple_point/case.py b/examples/2D_IGR_triple_point/case.py index 441365b579..78800a855a 100755 --- a/examples/2D_IGR_triple_point/case.py +++ b/examples/2D_IGR_triple_point/case.py @@ -26,11 +26,11 @@ "t_save": 0.04, # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, - "time_stepper": 3, - "riemann_solver": 5, + "time_stepper": "rk3", + "riemann_solver": "lax_friedrichs", "elliptic_smoothing": "T", "elliptic_smoothing_iters": 50, "igr": "T", @@ -44,8 +44,8 @@ "bc_y%beg": -3, "bc_y%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "schlieren_wrt": "T", "fd_order": 4, diff --git a/examples/2D_TaylorGreenVortex/case.py b/examples/2D_TaylorGreenVortex/case.py index 4a419d38e6..1e66ad7dc4 100644 --- a/examples/2D_TaylorGreenVortex/case.py +++ b/examples/2D_TaylorGreenVortex/case.py @@ -29,12 +29,12 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "mapped_weno": "T", @@ -42,17 +42,17 @@ "mp_weno": "F", "weno_Re_flux": "T", "weno_avg": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Base diff --git a/examples/2D_Thermal_Flatplate/case.py b/examples/2D_Thermal_Flatplate/case.py index 9523e50f2a..dbaae022b4 100644 --- a/examples/2D_Thermal_Flatplate/case.py +++ b/examples/2D_Thermal_Flatplate/case.py @@ -25,26 +25,26 @@ "t_step_stop": 75000, "t_step_save": 4500, "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "mp_weno": "F", "weno_order": 5, "weno_eps": 1e-16, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -7, "bc_x%end": -3, "bc_y%beg": -16, "bc_y%end": -3, "bc_y%isothermal_in": "T", "bc_y%Twall_in": 600.0, - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "chemistry": "T", diff --git a/examples/2D_acoustic_broadband/case.py b/examples/2D_acoustic_broadband/case.py index c3255333ad..cb1bad890f 100644 --- a/examples/2D_acoustic_broadband/case.py +++ b/examples/2D_acoustic_broadband/case.py @@ -21,28 +21,28 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -6, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "probe_wrt": "T", diff --git a/examples/2D_acoustic_pulse/case.py b/examples/2D_acoustic_pulse/case.py index be11755d9b..08c7c50d76 100644 --- a/examples/2D_acoustic_pulse/case.py +++ b/examples/2D_acoustic_pulse/case.py @@ -38,27 +38,27 @@ "t_step_save": int(Nt / 100), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "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, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "omega_wrt(3)": "T", diff --git a/examples/2D_acoustic_pulse_analytical/case.py b/examples/2D_acoustic_pulse_analytical/case.py index 76192fd0e4..c1d93aab73 100644 --- a/examples/2D_acoustic_pulse_analytical/case.py +++ b/examples/2D_acoustic_pulse_analytical/case.py @@ -38,27 +38,27 @@ "t_step_save": int(Nt / 100), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "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, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "omega_wrt(3)": "T", diff --git a/examples/2D_acoustic_support10_axisym/case.py b/examples/2D_acoustic_support10_axisym/case.py index 37f8dfbf33..a28a1a771b 100644 --- a/examples/2D_acoustic_support10_axisym/case.py +++ b/examples/2D_acoustic_support10_axisym/case.py @@ -23,28 +23,28 @@ "t_step_save": 20, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -2, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/2D_acoustic_support2/case.py b/examples/2D_acoustic_support2/case.py index 07ab20336f..7c4f7b843f 100644 --- a/examples/2D_acoustic_support2/case.py +++ b/examples/2D_acoustic_support2/case.py @@ -22,28 +22,28 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -6, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/2D_acoustic_support5/case.py b/examples/2D_acoustic_support5/case.py index 167a6a2aef..70c01ed763 100644 --- a/examples/2D_acoustic_support5/case.py +++ b/examples/2D_acoustic_support5/case.py @@ -21,28 +21,28 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -6, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/2D_acoustic_support6_axisym/case.py b/examples/2D_acoustic_support6_axisym/case.py index 934ccc84d8..3737583fb1 100644 --- a/examples/2D_acoustic_support6_axisym/case.py +++ b/examples/2D_acoustic_support6_axisym/case.py @@ -22,28 +22,28 @@ "t_step_save": 20, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -2, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/2D_acoustic_support9/case.py b/examples/2D_acoustic_support9/case.py index de7972aad8..ba968b3e9d 100644 --- a/examples/2D_acoustic_support9/case.py +++ b/examples/2D_acoustic_support9/case.py @@ -22,28 +22,28 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -6, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/2D_advection/case.py b/examples/2D_advection/case.py index 693c7e9089..14dcf3fa83 100644 --- a/examples/2D_advection/case.py +++ b/examples/2D_advection/case.py @@ -21,12 +21,12 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -34,16 +34,16 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, "bc_y%beg": -3, "bc_y%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Base diff --git a/examples/2D_advection_convergence/case.py b/examples/2D_advection_convergence/case.py index 39ce6f1c1e..1c912b7745 100644 --- a/examples/2D_advection_convergence/case.py +++ b/examples/2D_advection_convergence/case.py @@ -48,13 +48,13 @@ if args.muscl: scheme_params = { - "recon_type": 2, - "muscl_order": 2, + "recon_type": "muscl", + "muscl_order": "second_order", "muscl_lim": args.muscl_lim, } else: scheme_params = { - "recon_type": 1, + "recon_type": "weno", "weno_order": args.order, "weno_eps": 1.0e-40, "weno_Re_flux": "F", @@ -82,21 +82,21 @@ "t_step_stop": Nt, "t_step_save": Nt, "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", "time_stepper": args.time_stepper, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "patch_icpp(1)%geometry": 3, diff --git a/examples/2D_advection_muscl/case.py b/examples/2D_advection_muscl/case.py index 96d3d0a48b..88bf7c5aa7 100644 --- a/examples/2D_advection_muscl/case.py +++ b/examples/2D_advection_muscl/case.py @@ -21,27 +21,27 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, - "recon_type": 2, - "muscl_order": 2, - "muscl_lim": 2, - "int_comp": 1, + "time_stepper": "rk3", + "recon_type": "muscl", + "muscl_order": "second_order", + "muscl_lim": "mc", + "int_comp": "thinc", "null_weights": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, "bc_y%beg": -3, "bc_y%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Base diff --git a/examples/2D_axisym_hypoelasticity/case.py b/examples/2D_axisym_hypoelasticity/case.py index 54b6ca50f4..db93483515 100644 --- a/examples/2D_axisym_hypoelasticity/case.py +++ b/examples/2D_axisym_hypoelasticity/case.py @@ -22,20 +22,20 @@ "t_step_save": 2000, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -2, @@ -44,8 +44,8 @@ "hypoelasticity": "T", "fd_order": 4, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/2D_axisym_shockbubble/case.py b/examples/2D_axisym_shockbubble/case.py index 86bacd5a83..fb23bdd801 100644 --- a/examples/2D_axisym_shockbubble/case.py +++ b/examples/2D_axisym_shockbubble/case.py @@ -44,12 +44,12 @@ "t_step_save": int(Nt / 100.0), # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -57,16 +57,16 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -2, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Background diff --git a/examples/2D_axisym_shockwatercavity/case.py b/examples/2D_axisym_shockwatercavity/case.py index b331322e76..05925a4920 100644 --- a/examples/2D_axisym_shockwatercavity/case.py +++ b/examples/2D_axisym_shockwatercavity/case.py @@ -177,27 +177,27 @@ "t_step_save": AS, # Simulation Algorithm Parameters "num_patches": 4, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -2, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "alpha_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_backward_facing_step/case.py b/examples/2D_backward_facing_step/case.py index 1955acca76..a06d9b7ac6 100644 --- a/examples/2D_backward_facing_step/case.py +++ b/examples/2D_backward_facing_step/case.py @@ -32,22 +32,22 @@ "t_stop": 100 * h / v0, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_avg": "T", "weno_Re_flux": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -11, "bc_x%end": -3, "bc_y%beg": -16, @@ -56,8 +56,8 @@ "num_ibs": 1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Fluid Patch: Background diff --git a/examples/2D_bubbly_steady_shock/case.py b/examples/2D_bubbly_steady_shock/case.py index 1401056986..05dc3cfdb0 100644 --- a/examples/2D_bubbly_steady_shock/case.py +++ b/examples/2D_bubbly_steady_shock/case.py @@ -81,22 +81,22 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -6, "bc_x%end": -3, "bc_y%beg": -3, @@ -107,8 +107,8 @@ # Formatted Database Files Structure Parameters # Export primitive variables in double precision with parallel # I/O to minimize I/O computational time during large simulations - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "fd_order": 1, "omega_wrt(3)": "T", @@ -156,7 +156,7 @@ # Bubbles "bubbles_euler": "T", "nb": nb, - "bubble_model": 2, + "bubble_model": "keller_miksis", "polytropic": "T", "polydisperse": "F", "poly_sigma": 0.3, diff --git a/examples/2D_cont_damage/case.py b/examples/2D_cont_damage/case.py index fe6e3d09ee..8d822067b4 100644 --- a/examples/2D_cont_damage/case.py +++ b/examples/2D_cont_damage/case.py @@ -21,21 +21,21 @@ "t_step_save": 2000, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -2, @@ -48,8 +48,8 @@ "cont_damage_s": 2.0, "alpha_bar": 1e-4, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/2D_forward_facing_step/case.py b/examples/2D_forward_facing_step/case.py index f55656c933..b7733a923e 100644 --- a/examples/2D_forward_facing_step/case.py +++ b/examples/2D_forward_facing_step/case.py @@ -31,21 +31,21 @@ "t_stop": 4, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_avg": "T", "weno_order": 5, "weno_eps": 1.0e-16, - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -3, "bc_x%end": -3, "bc_y%beg": -2, @@ -53,8 +53,8 @@ "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Background diff --git a/examples/2D_hardcoded_ic/case.py b/examples/2D_hardcoded_ic/case.py index e26e01f8ac..b41443ef07 100644 --- a/examples/2D_hardcoded_ic/case.py +++ b/examples/2D_hardcoded_ic/case.py @@ -31,27 +31,27 @@ "t_step_save": 200, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -2, "bc_x%end": -7, "bc_y%beg": -2, "bc_y%end": -7, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Base diff --git a/examples/2D_ibm/case.py b/examples/2D_ibm/case.py index 016d749cdd..a0d4eccb97 100644 --- a/examples/2D_ibm/case.py +++ b/examples/2D_ibm/case.py @@ -31,7 +31,7 @@ # Only one patches are necessary, the air tube "num_patches": 1, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", # One fluids: air "num_fluids": 1, @@ -40,18 +40,18 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "T", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell "bc_x%beg": -3, "bc_x%end": -3, @@ -62,8 +62,8 @@ "num_ibs": 1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_ibm_airfoil/case.py b/examples/2D_ibm_airfoil/case.py index 7a255d557c..8afd9883ed 100644 --- a/examples/2D_ibm_airfoil/case.py +++ b/examples/2D_ibm_airfoil/case.py @@ -30,7 +30,7 @@ # Only one patches are necessary, the air tube "num_patches": 1, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", # 6 equations model does not need the K \div(u) term "alt_soundspeed": "F", # One fluids: air @@ -40,21 +40,21 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Reconstruct the primitive variables to minimize spurious # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", # Use the mapped WENO weights to maintain monotinicity "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", # Use the HLLC Riemann solver - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use reflective boundary conditions at octant edges and # non-reflective boundary conditions at the domain edges "bc_x%beg": -3, @@ -65,8 +65,8 @@ "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_ibm_cfl_dt/case.py b/examples/2D_ibm_cfl_dt/case.py index 9f106d15f7..434a527e8f 100644 --- a/examples/2D_ibm_cfl_dt/case.py +++ b/examples/2D_ibm_cfl_dt/case.py @@ -32,7 +32,7 @@ # Only one patches are necessary, the air tube "num_patches": 1, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", # One fluids: air "num_fluids": 1, @@ -42,18 +42,18 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, # 'weno_Re_flux' : 'T', "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell "bc_x%beg": -3, "bc_x%end": -3, @@ -64,8 +64,8 @@ "num_ibs": 1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_ibm_ellipse/case.py b/examples/2D_ibm_ellipse/case.py index ceb9fda4b6..357f122319 100644 --- a/examples/2D_ibm_ellipse/case.py +++ b/examples/2D_ibm_ellipse/case.py @@ -31,7 +31,7 @@ # Only one patches are necessary, the air tube "num_patches": 1, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", # One fluids: air "num_fluids": 1, @@ -40,18 +40,18 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "T", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell "bc_x%beg": -3, "bc_x%end": -3, @@ -62,8 +62,8 @@ "num_ibs": 1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_ibm_multiphase/case.py b/examples/2D_ibm_multiphase/case.py index 2223534f92..f4239b4f97 100644 --- a/examples/2D_ibm_multiphase/case.py +++ b/examples/2D_ibm_multiphase/case.py @@ -30,27 +30,27 @@ # Only one patches are necessary, the air tube "num_patches": 1, # Use the 6 equation model - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", # Use the mapped WENO weights to maintain monotinicity "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", # Use the HLLC Riemann solver - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell extrapolation at every side "bc_x%beg": -3, "bc_x%end": -3, @@ -60,8 +60,8 @@ "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_ibm_steady_shock/case.py b/examples/2D_ibm_steady_shock/case.py index a4b58e2e80..b6c868a516 100644 --- a/examples/2D_ibm_steady_shock/case.py +++ b/examples/2D_ibm_steady_shock/case.py @@ -60,7 +60,7 @@ # Simulation Algorithm Parameters "num_patches": 2, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, # No need to ensure the volume fractions sum to unity at the end of each @@ -69,21 +69,21 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Reconstruct the primitive variables to minimize spurious # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", # Use the mapped WENO weights to maintain monotinicity "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", # Use the HLLC Riemann solver - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -7, "bc_x%end": -8, "bc_y%beg": -3, @@ -94,8 +94,8 @@ # Formatted Database Files Structure Parameters # Export primitive variables in double precision with parallel # I/O to minimize I/O computational time during large simulations - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "fd_order": 1, "omega_wrt(3)": "T", diff --git a/examples/2D_ibm_stl_MFCCharacter/case.py b/examples/2D_ibm_stl_MFCCharacter/case.py index 8b8eb16027..9616b97ef6 100644 --- a/examples/2D_ibm_stl_MFCCharacter/case.py +++ b/examples/2D_ibm_stl_MFCCharacter/case.py @@ -29,20 +29,20 @@ "t_step_save": 20, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "viscous": "T", "bc_x%beg": -3, "bc_x%end": -3, @@ -53,8 +53,8 @@ # Formatted Database Files Structure Parameters # Export primitive variables in double precision with parallel # I/O to minimize I/O computational time during large simulations - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch: Middle diff --git a/examples/2D_ibm_stl_test/case.py b/examples/2D_ibm_stl_test/case.py index f4d0b0fa39..843c6a535d 100644 --- a/examples/2D_ibm_stl_test/case.py +++ b/examples/2D_ibm_stl_test/case.py @@ -30,20 +30,20 @@ "t_step_save": 30, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "viscous": "F", "bc_x%beg": -3, "bc_x%end": -3, @@ -54,8 +54,8 @@ # Formatted Database Files Structure Parameters # Export primitive variables in double precision with parallel # I/O to minimize I/O computational time during large simulations - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch: Middle diff --git a/examples/2D_ibm_stl_wedge/case.py b/examples/2D_ibm_stl_wedge/case.py index e66a83472e..a644ff1e0e 100644 --- a/examples/2D_ibm_stl_wedge/case.py +++ b/examples/2D_ibm_stl_wedge/case.py @@ -30,20 +30,20 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "viscous": "T", "bc_x%beg": -3, "bc_x%end": -3, @@ -54,8 +54,8 @@ # Formatted Database Files Structure Parameters # Export primitive variables in double precision with parallel # I/O to minimize I/O computational time during large simulations - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch: Middle diff --git a/examples/2D_isentropicvortex/case.py b/examples/2D_isentropicvortex/case.py index 6bbffcd45c..1a301ff4bd 100644 --- a/examples/2D_isentropicvortex/case.py +++ b/examples/2D_isentropicvortex/case.py @@ -70,27 +70,27 @@ "t_step_save": 1, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -4, "bc_x%end": -4, "bc_y%beg": -4, "bc_y%end": -4, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "omega_wrt(3)": "T", diff --git a/examples/2D_isentropicvortex_analytical/case.py b/examples/2D_isentropicvortex_analytical/case.py index ba31fb491c..a90bdbc477 100644 --- a/examples/2D_isentropicvortex_analytical/case.py +++ b/examples/2D_isentropicvortex_analytical/case.py @@ -70,27 +70,27 @@ "t_step_save": 1, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -4, "bc_x%end": -4, "bc_y%beg": -4, "bc_y%end": -4, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "omega_wrt(3)": "T", diff --git a/examples/2D_jet/case.py b/examples/2D_jet/case.py index 7da489c055..97c01b9375 100644 --- a/examples/2D_jet/case.py +++ b/examples/2D_jet/case.py @@ -46,12 +46,12 @@ "cfl_target": 0.8, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -59,9 +59,9 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "elliptic_smoothing": "T", "elliptic_smoothing_iters": 50, "bc_x%beg": -2, @@ -76,8 +76,8 @@ "patch_bc(1)%centroid(2)": 0.0, "patch_bc(1)%length(2)": leng / 4, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Background diff --git a/examples/2D_kelvin_helmholtz/case.py b/examples/2D_kelvin_helmholtz/case.py index e6873f8145..cb7db668aa 100644 --- a/examples/2D_kelvin_helmholtz/case.py +++ b/examples/2D_kelvin_helmholtz/case.py @@ -27,26 +27,26 @@ "t_save": time_save, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-10, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Background diff --git a/examples/2D_lagrange_bubblescreen/case.py b/examples/2D_lagrange_bubblescreen/case.py index eba8edb699..37cbcb84aa 100644 --- a/examples/2D_lagrange_bubblescreen/case.py +++ b/examples/2D_lagrange_bubblescreen/case.py @@ -1,174 +1,174 @@ -#!/usr/bin/env python3 -import json -import math - -# Bubble screen -# Description: A planar acoustic wave interacts with a bubble cloud -# in water. The background field is modeled in using an Eulerian framework, -# while the bubbles are tracked using a Lagrangian framework. - -# Reference values for nondimensionalization -x0 = 1.0e-03 # length - m -rho0 = 1.0e03 # density - kg/m3 -c0 = 1475.0 # speed of sound - m/s -p0 = rho0 * c0 * c0 # pressure - Pa -T0 = 298 # temperature - K - -# Host properties (water) -gamma_host = 2.7466 # Specific heat ratio -pi_inf_host = 792.02e06 # Stiffness - Pa -mu_host = 1e-3 # Dynamic viscosity - Pa.s -c_host = 1475.0 # speed of sound - m/s -rho_host = 1000 # density kg/m3 -T_host = 298 # temperature K - -# Lagrangian bubbles' properties -R_uni = 8314 # Universal gas constant - J/kmol/K -MW_g = 28.0 # Molar weight of the gas - kg/kmol -MW_v = 18.0 # Molar weight of the vapor - kg/kmol -gam_g = 1.4 # Specific heat ratio of the gas -gam_v = 1.333 # Specific heat ratio of the vapor -pv = 2350 # Vapor pressure of the host - Pa -cp_g = 1.0e3 # Specific heat of the gas - J/kg/K -cp_v = 2.1e3 # Specific heat of the vapor - J/kg/K -k_g = 0.025 # Thermal conductivity of the gas - W/m/K -k_v = 0.02 # Thermal conductivity of the vapor - W/m/K -diffVapor = 2.5e-5 # Diffusivity coefficient of the vapor - m2/s -sigBubble = 0.069 # Surface tension of the bubble - N/m -mu_g = 1.48e-5 - -# Acoustic source properties -patm = 101325.0 # Atmospheric pressure - Pa -pamp = 1.0e5 # Amplitude of the acoustic source - Pa -freq = 300e03 # Source frequency - Hz -wlen = c_host / freq # Wavelength - m - -# Domain and time set up - -xb = -12.0e-3 # Domain boundaries - m (x direction) -xe = 12.0e-3 -yb = -2.5e-3 # Domain boundaries - m (y direction) -ye = 2.5e-3 -z_virtual = 5.0e-3 # Virtual depth (z direction) - -Nx = 240 # number of elements into x direction -Ny = 50 # number of elements into y direction - -dt = 7.5e-9 # constant time-step - sec - -# Configuring case dictionary -print( - json.dumps( - { - # Logistics - "run_time_info": "T", - # Computational Domain Parameters - "x_domain%beg": xb / x0, - "x_domain%end": xe / x0, - "y_domain%beg": yb / x0, - "y_domain%end": ye / x0, - "stretch_y": "F", - "stretch_x": "F", - "m": Nx, - "n": Ny, - "p": 0, - "dt": dt * (c0 / x0), - "t_step_start": 0, - "t_step_stop": 3000, - "t_step_save": 500, - # Simulation Algorithm Parameters - "model_eqns": 2, - "time_stepper": 3, - "num_fluids": 2, - "num_patches": 1, - "viscous": "T", - "mpp_lim": "F", - "weno_order": 5, - "weno_eps": 1.0e-16, - "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -1, - "bc_y%end": -1, - # Acoustic source - "acoustic_source": "T", - "num_source": 1, - "acoustic(1)%support": 2, - "acoustic(1)%pulse": 1, - "acoustic(1)%npulse": 1, - "acoustic(1)%mag": pamp / p0, - "acoustic(1)%wavelength": wlen / x0, - "acoustic(1)%length": 2 * (ye - yb) / x0, - "acoustic(1)%loc(1)": -7.0e-03 / x0, - "acoustic(1)%loc(2)": 0.0, - "acoustic(1)%dir": 0.0, - "acoustic(1)%delay": 0.0, - # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, - "prim_vars_wrt": "T", - "parallel_io": "T", - "lag_db_wrt": "T", - # Patch 1: Water (left) - "patch_icpp(1)%geometry": 3, - "patch_icpp(1)%x_centroid": 0.0, - "patch_icpp(1)%y_centroid": 0.0, - "patch_icpp(1)%length_x": 2 * (xe - xb) / x0, - "patch_icpp(1)%length_y": 2 * (ye - yb) / x0, - "patch_icpp(1)%vel(1)": 0.0, - "patch_icpp(1)%vel(2)": 0.0, - "patch_icpp(1)%pres": patm / p0, - "patch_icpp(1)%alpha_rho(1)": rho_host / rho0, - "patch_icpp(1)%alpha_rho(2)": 0.0, - "patch_icpp(1)%alpha(1)": 1.0, - "patch_icpp(1)%alpha(2)": 0.0, - # Lagrangian Bubbles - "bubbles_lagrange": "T", - "bubble_model": 2, # Keller-Miksis model - "thermal": 3, - "polytropic": "F", - "lag_params%nBubs_glb": 1194, # Number of bubbles - "lag_params%solver_approach": 2, - "lag_params%cluster_type": 2, - "lag_params%pressure_corrector": "T", - "lag_params%smooth_type": 1, - "lag_params%heatTransfer_model": "T", - "lag_params%massTransfer_model": "T", - "lag_params%epsilonb": 1.0, - "lag_params%valmaxvoid": 0.9, - "lag_params%write_bubbles": "F", - "lag_params%write_bubbles_stats": "F", - # Bubble parameters - "bub_pp%R0ref": 1.0, - "bub_pp%p0ref": 1.0, - "bub_pp%rho0ref": 1.0, - "bub_pp%T0ref": 1.0, - "bub_pp%ss": sigBubble / (rho0 * x0 * c0 * c0), - "bub_pp%pv": pv / p0, - "bub_pp%vd": diffVapor / (x0 * c0), - "bub_pp%mu_l": mu_host / (rho0 * x0 * c0), - "bub_pp%gam_v": gam_v, - "bub_pp%gam_g": gam_g, - "bub_pp%M_v": MW_v, - "bub_pp%M_g": MW_g, - "bub_pp%k_v": k_v * (T0 / (x0 * rho0 * c0 * c0 * c0)), - "bub_pp%k_g": k_g * (T0 / (x0 * rho0 * c0 * c0 * c0)), - "bub_pp%cp_v": cp_v * (T0 / (c0 * c0)), - "bub_pp%cp_g": cp_g * (T0 / (c0 * c0)), - "bub_pp%R_v": (R_uni / MW_v) * (T0 / (c0 * c0)), - "bub_pp%R_g": (R_uni / MW_g) * (T0 / (c0 * c0)), - # Fluids Physical Parameters - # Host medium - "fluid_pp(1)%gamma": 1.0 / (gamma_host - 1.0), - "fluid_pp(1)%pi_inf": gamma_host * (pi_inf_host / p0) / (gamma_host - 1.0), - "fluid_pp(1)%Re(1)": 1.0 / (mu_host / (rho0 * c0 * x0)), - # Bubble gas state - "fluid_pp(2)%gamma": 1.0 / (gam_g - 1.0), - "fluid_pp(2)%pi_inf": 0.0e00, - "fluid_pp(2)%Re(1)": 1.0 / (mu_g / (rho0 * c0 * x0)), - } - ) -) +#!/usr/bin/env python3 +import json +import math + +# Bubble screen +# Description: A planar acoustic wave interacts with a bubble cloud +# in water. The background field is modeled in using an Eulerian framework, +# while the bubbles are tracked using a Lagrangian framework. + +# Reference values for nondimensionalization +x0 = 1.0e-03 # length - m +rho0 = 1.0e03 # density - kg/m3 +c0 = 1475.0 # speed of sound - m/s +p0 = rho0 * c0 * c0 # pressure - Pa +T0 = 298 # temperature - K + +# Host properties (water) +gamma_host = 2.7466 # Specific heat ratio +pi_inf_host = 792.02e06 # Stiffness - Pa +mu_host = 1e-3 # Dynamic viscosity - Pa.s +c_host = 1475.0 # speed of sound - m/s +rho_host = 1000 # density kg/m3 +T_host = 298 # temperature K + +# Lagrangian bubbles' properties +R_uni = 8314 # Universal gas constant - J/kmol/K +MW_g = 28.0 # Molar weight of the gas - kg/kmol +MW_v = 18.0 # Molar weight of the vapor - kg/kmol +gam_g = 1.4 # Specific heat ratio of the gas +gam_v = 1.333 # Specific heat ratio of the vapor +pv = 2350 # Vapor pressure of the host - Pa +cp_g = 1.0e3 # Specific heat of the gas - J/kg/K +cp_v = 2.1e3 # Specific heat of the vapor - J/kg/K +k_g = 0.025 # Thermal conductivity of the gas - W/m/K +k_v = 0.02 # Thermal conductivity of the vapor - W/m/K +diffVapor = 2.5e-5 # Diffusivity coefficient of the vapor - m2/s +sigBubble = 0.069 # Surface tension of the bubble - N/m +mu_g = 1.48e-5 + +# Acoustic source properties +patm = 101325.0 # Atmospheric pressure - Pa +pamp = 1.0e5 # Amplitude of the acoustic source - Pa +freq = 300e03 # Source frequency - Hz +wlen = c_host / freq # Wavelength - m + +# Domain and time set up + +xb = -12.0e-3 # Domain boundaries - m (x direction) +xe = 12.0e-3 +yb = -2.5e-3 # Domain boundaries - m (y direction) +ye = 2.5e-3 +z_virtual = 5.0e-3 # Virtual depth (z direction) + +Nx = 240 # number of elements into x direction +Ny = 50 # number of elements into y direction + +dt = 7.5e-9 # constant time-step - sec + +# Configuring case dictionary +print( + json.dumps( + { + # Logistics + "run_time_info": "T", + # Computational Domain Parameters + "x_domain%beg": xb / x0, + "x_domain%end": xe / x0, + "y_domain%beg": yb / x0, + "y_domain%end": ye / x0, + "stretch_y": "F", + "stretch_x": "F", + "m": Nx, + "n": Ny, + "p": 0, + "dt": dt * (c0 / x0), + "t_step_start": 0, + "t_step_stop": 3000, + "t_step_save": 500, + # Simulation Algorithm Parameters + "model_eqns": "5eq", + "time_stepper": "rk3", + "num_fluids": 2, + "num_patches": 1, + "viscous": "T", + "mpp_lim": "F", + "weno_order": 5, + "weno_eps": 1.0e-16, + "mapped_weno": "T", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", + "bc_x%beg": -6, + "bc_x%end": -6, + "bc_y%beg": -1, + "bc_y%end": -1, + # Acoustic source + "acoustic_source": "T", + "num_source": 1, + "acoustic(1)%support": 2, + "acoustic(1)%pulse": 1, + "acoustic(1)%npulse": 1, + "acoustic(1)%mag": pamp / p0, + "acoustic(1)%wavelength": wlen / x0, + "acoustic(1)%length": 2 * (ye - yb) / x0, + "acoustic(1)%loc(1)": -7.0e-03 / x0, + "acoustic(1)%loc(2)": 0.0, + "acoustic(1)%dir": 0.0, + "acoustic(1)%delay": 0.0, + # Formatted Database Files Structure Parameters + "format": "silo", + "precision": "double", + "prim_vars_wrt": "T", + "parallel_io": "T", + "lag_db_wrt": "T", + # Patch 1: Water (left) + "patch_icpp(1)%geometry": 3, + "patch_icpp(1)%x_centroid": 0.0, + "patch_icpp(1)%y_centroid": 0.0, + "patch_icpp(1)%length_x": 2 * (xe - xb) / x0, + "patch_icpp(1)%length_y": 2 * (ye - yb) / x0, + "patch_icpp(1)%vel(1)": 0.0, + "patch_icpp(1)%vel(2)": 0.0, + "patch_icpp(1)%pres": patm / p0, + "patch_icpp(1)%alpha_rho(1)": rho_host / rho0, + "patch_icpp(1)%alpha_rho(2)": 0.0, + "patch_icpp(1)%alpha(1)": 1.0, + "patch_icpp(1)%alpha(2)": 0.0, + # Lagrangian Bubbles + "bubbles_lagrange": "T", + "bubble_model": "keller_miksis", # Keller-Miksis model + "thermal": 3, + "polytropic": "F", + "lag_params%nBubs_glb": 1194, # Number of bubbles + "lag_params%solver_approach": 2, + "lag_params%cluster_type": 2, + "lag_params%pressure_corrector": "T", + "lag_params%smooth_type": 1, + "lag_params%heatTransfer_model": "T", + "lag_params%massTransfer_model": "T", + "lag_params%epsilonb": 1.0, + "lag_params%valmaxvoid": 0.9, + "lag_params%write_bubbles": "F", + "lag_params%write_bubbles_stats": "F", + # Bubble parameters + "bub_pp%R0ref": 1.0, + "bub_pp%p0ref": 1.0, + "bub_pp%rho0ref": 1.0, + "bub_pp%T0ref": 1.0, + "bub_pp%ss": sigBubble / (rho0 * x0 * c0 * c0), + "bub_pp%pv": pv / p0, + "bub_pp%vd": diffVapor / (x0 * c0), + "bub_pp%mu_l": mu_host / (rho0 * x0 * c0), + "bub_pp%gam_v": gam_v, + "bub_pp%gam_g": gam_g, + "bub_pp%M_v": MW_v, + "bub_pp%M_g": MW_g, + "bub_pp%k_v": k_v * (T0 / (x0 * rho0 * c0 * c0 * c0)), + "bub_pp%k_g": k_g * (T0 / (x0 * rho0 * c0 * c0 * c0)), + "bub_pp%cp_v": cp_v * (T0 / (c0 * c0)), + "bub_pp%cp_g": cp_g * (T0 / (c0 * c0)), + "bub_pp%R_v": (R_uni / MW_v) * (T0 / (c0 * c0)), + "bub_pp%R_g": (R_uni / MW_g) * (T0 / (c0 * c0)), + # Fluids Physical Parameters + # Host medium + "fluid_pp(1)%gamma": 1.0 / (gamma_host - 1.0), + "fluid_pp(1)%pi_inf": gamma_host * (pi_inf_host / p0) / (gamma_host - 1.0), + "fluid_pp(1)%Re(1)": 1.0 / (mu_host / (rho0 * c0 * x0)), + # Bubble gas state + "fluid_pp(2)%gamma": 1.0 / (gam_g - 1.0), + "fluid_pp(2)%pi_inf": 0.0e00, + "fluid_pp(2)%Re(1)": 1.0 / (mu_g / (rho0 * c0 * x0)), + } + ) +) diff --git a/examples/2D_laplace_pressure_jump/case.py b/examples/2D_laplace_pressure_jump/case.py index ec1b2a32a8..47964e6c19 100644 --- a/examples/2D_laplace_pressure_jump/case.py +++ b/examples/2D_laplace_pressure_jump/case.py @@ -41,20 +41,20 @@ "t_step_stop": 100000, "t_step_save": 1000, # Simulation Algorithm - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "mixture_err": "T", "mpp_lim": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, - "avg_state": 2, + "avg_state": "arithmetic", "weno_eps": 1e-16, "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", "weno_Re_flux": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -2, "bc_x%end": -3, "bc_y%beg": -2, @@ -64,8 +64,8 @@ "weno_avg": "T", "surface_tension": "T", # Database Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "cons_vars_wrt": "T", "cf_wrt": "T", diff --git a/examples/2D_lid_driven_cavity/case.py b/examples/2D_lid_driven_cavity/case.py index 657d6b00b9..f7e1c6346b 100644 --- a/examples/2D_lid_driven_cavity/case.py +++ b/examples/2D_lid_driven_cavity/case.py @@ -22,21 +22,21 @@ "t_step_save": 8000, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1e-16, "mapped_weno": "T", "weno_Re_flux": "T", "mp_weno": "T", "weno_avg": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -16, "bc_x%end": -16, "bc_y%beg": -16, @@ -44,8 +44,8 @@ "bc_y%ve1": 0.5, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "omega_wrt(3)": "T", "fd_order": 4, diff --git a/examples/2D_lungwave/case.py b/examples/2D_lungwave/case.py index badea226f7..1e6c1df085 100644 --- a/examples/2D_lungwave/case.py +++ b/examples/2D_lungwave/case.py @@ -102,12 +102,12 @@ "t_step_save": tsave, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -115,16 +115,16 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -6, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Monopole setting diff --git a/examples/2D_lungwave_horizontal/case.py b/examples/2D_lungwave_horizontal/case.py index 0c9d2632a3..73afa85129 100644 --- a/examples/2D_lungwave_horizontal/case.py +++ b/examples/2D_lungwave_horizontal/case.py @@ -98,12 +98,12 @@ "t_step_save": tsave, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -111,16 +111,16 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -1, "bc_y%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Monopole setting diff --git a/examples/2D_mhd_magnetic_vortex/case.py b/examples/2D_mhd_magnetic_vortex/case.py index 7297472089..a2a7f31390 100644 --- a/examples/2D_mhd_magnetic_vortex/case.py +++ b/examples/2D_mhd_magnetic_vortex/case.py @@ -29,26 +29,26 @@ "t_step_save": 1000, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-12, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 4, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hlld", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_mhd_rotor/case.py b/examples/2D_mhd_rotor/case.py index e05000ddad..29af1c0767 100644 --- a/examples/2D_mhd_rotor/case.py +++ b/examples/2D_mhd_rotor/case.py @@ -22,27 +22,27 @@ "t_step_save": 5, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "mapped_weno": "T", "weno_eps": 1.0e-6, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_mibm_cylinder_in_cross_flow/case.py b/examples/2D_mibm_cylinder_in_cross_flow/case.py index 07adb3b491..0c89ef5962 100644 --- a/examples/2D_mibm_cylinder_in_cross_flow/case.py +++ b/examples/2D_mibm_cylinder_in_cross_flow/case.py @@ -31,7 +31,7 @@ # Only one patches are necessary, the air tube "num_patches": 1, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", # One fluids: air "num_fluids": 1, @@ -40,18 +40,18 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "T", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell "bc_x%beg": -3, "bc_x%end": -3, @@ -62,8 +62,8 @@ "num_ibs": 1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_mibm_particle_cloud/case.py b/examples/2D_mibm_particle_cloud/case.py index 68abf5badc..e8214d7d82 100644 --- a/examples/2D_mibm_particle_cloud/case.py +++ b/examples/2D_mibm_particle_cloud/case.py @@ -55,22 +55,22 @@ "t_step_save": steps_to_save, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "T", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -17, "bc_x%end": -8, "bc_y%beg": -15, @@ -100,8 +100,8 @@ "particle_cloud(1)%seed": 42, "particle_cloud(1)%packing_method": 1, # Output - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "ib_state_wrt": "F", diff --git a/examples/2D_mibm_shock_cylinder/case.py b/examples/2D_mibm_shock_cylinder/case.py index 9fbc86829d..f344ef9e27 100644 --- a/examples/2D_mibm_shock_cylinder/case.py +++ b/examples/2D_mibm_shock_cylinder/case.py @@ -52,7 +52,7 @@ # Only one patches are necessary, the air tube "num_patches": 2, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", # One fluids: air "num_fluids": 1, @@ -61,18 +61,18 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "T", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell "bc_x%beg": -17, "bc_x%end": -8, @@ -83,8 +83,8 @@ "num_ibs": 1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "ib_state_wrt": "F", diff --git a/examples/2D_mixing_artificial_Ma/case.py b/examples/2D_mixing_artificial_Ma/case.py index c14b7b8f16..c5d5092e55 100644 --- a/examples/2D_mixing_artificial_Ma/case.py +++ b/examples/2D_mixing_artificial_Ma/case.py @@ -71,24 +71,24 @@ "t_step_save": t_save, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 1, - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "T", "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -6, "bc_y%end": -6, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "cons_vars_wrt": "T", "prim_vars_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_orszag_tang/case.py b/examples/2D_orszag_tang/case.py index f01a4828ba..bd768894c2 100644 --- a/examples/2D_orszag_tang/case.py +++ b/examples/2D_orszag_tang/case.py @@ -22,26 +22,26 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 1, "weno_eps": 1.0e-6, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_orszag_tang_hyper_cleaning/case.py b/examples/2D_orszag_tang_hyper_cleaning/case.py index f062c344c0..d0d334ab1b 100644 --- a/examples/2D_orszag_tang_hyper_cleaning/case.py +++ b/examples/2D_orszag_tang_hyper_cleaning/case.py @@ -22,27 +22,27 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "mapped_weno": "T", "weno_eps": 1.0e-6, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_patch_modal_shape/case.py b/examples/2D_patch_modal_shape/case.py index c1be303320..3d459c53b2 100644 --- a/examples/2D_patch_modal_shape/case.py +++ b/examples/2D_patch_modal_shape/case.py @@ -42,26 +42,26 @@ "t_step_stop": Nt, "t_step_save": max(1, int(Nt / 10)), "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -8, "bc_x%end": -8, "bc_y%beg": -8, "bc_y%end": -8, - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "omega_wrt(3)": "T", diff --git a/examples/2D_patch_modal_shape_exp/case.py b/examples/2D_patch_modal_shape_exp/case.py index 9d1873e4d5..e53ca4f29f 100644 --- a/examples/2D_patch_modal_shape_exp/case.py +++ b/examples/2D_patch_modal_shape_exp/case.py @@ -44,26 +44,26 @@ "t_step_stop": Nt, "t_step_save": max(1, int(Nt / 10)), "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -8, "bc_x%end": -8, "bc_y%beg": -8, "bc_y%end": -8, - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "omega_wrt(3)": "T", diff --git a/examples/2D_phasechange_bubble/case.py b/examples/2D_phasechange_bubble/case.py index c7b782daab..6d1d0c2ad3 100644 --- a/examples/2D_phasechange_bubble/case.py +++ b/examples/2D_phasechange_bubble/case.py @@ -1,288 +1,288 @@ -#!/usr/bin/env python3 -import argparse -import json -import math - -parser = argparse.ArgumentParser(prog="phasechange", description="phase change considering both 5 and 6 equation models.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) -parser.add_argument("--mfc", type=json.loads, default={}, metavar="DICT", help="MFC's toolchain's internal state.") -parser.add_argument("-me", "--model_eqns", type=int, metavar="MODEL EQN", choices=[2, 3], default=3, help="choose `2' for 5-equation model or `3' for 6-equation model.") -args = parser.parse_args() - -# 1 FOR BACKGROUND, 2 FOR BUBBLE -# Pressure [Pa] -p01 = 5e6 -p02 = 3550 - -# Temperature [K] -T01 = 298.15 -T02 = 298.15 - -#### FLUID PROPERTIES #### - -### liquid water ### -# pi infty -piwl = 1.0e09 -# qv -qvwl = -1167000 -# qv' -qvpwl = 0.0e0 -# cv -cvwl = 1816 -# cp -cpwl = 4267 -# gamma -gamwl = cpwl / cvwl - -## FOR PATCHES 1 & 2 ## - -# density -rho0wl1 = (p01 + piwl) / ((gamwl - 1) * cvwl * T01) -rho0wl2 = (p02 + piwl) / ((gamwl - 1) * cvwl * T02) - -# speed of sound FOR -c_wl1 = math.sqrt(gamwl * (p01 + piwl) / rho0wl1) -c_wl2 = math.sqrt(gamwl * (p02 + piwl) / rho0wl2) - -# part for Gases - relations from IMR -Ru = 8.3144598 # Universal gas constant (J/mol-K) - -### Vapor water ### -Rv = Ru / (18.01528e-3) # Gas constant for vapor (Ru/molecular weight) (J/kg-K) -# gamma -gamwv = 1.4 -# cp -cpwv = Rv * gamwv / (gamwv - 1) -# cv -cvwv = cpwv / gamwv -# pi infinity -piwv = 0.0e0 -# qv -qvwv = 2030000 -# qv' -qvpwv = -23400 - -## FOR PATCHES 1 & 2 ## - -# density -rho0wv1 = (p01 + piwv) / ((gamwv - 1) * cvwv * T01) -rho0wv2 = (p02 + piwv) / ((gamwv - 1) * cvwv * T02) - -# speed of sound -c_wv1 = math.sqrt(gamwv * (p01 + piwv) / rho0wv1) -c_wv2 = math.sqrt(gamwv * (p02 + piwv) / rho0wv2) - -### Air ### - -Ra = Ru / (28.966e-3) # Gas constant for air (Ru/molecular weight) (J/kg-K) -# gamma -gama = 1.4 -# cp -cpa = Ra * gama / (gama - 1) -# cv -cva = cpa / gama -# pi infinity -pia = 0.0e0 -# qv -qva = 0.0e0 -# qv' -qvpa = 0.0e0 - -## FOR PATCHES 1 & 2 ## - -# density -rho0a1 = (p01 + pia) / ((gama - 1) * cva * T01) -rho0a2 = (p02 + pia) / ((gama - 1) * cva * T02) - -# Speed of sound -c_a1 = math.sqrt(gama * (p01 + pia) / rho0a1) -c_a2 = math.sqrt(gama * (p02 + pia) / rho0a2) - -# SHOCK RELATIONS -p02Op01 = p02 / p01 - -# Mach number of the shocked region - this should agree with Min, if everything is correct -Ms = math.sqrt((gama + 1.0) / (2.0 * gama) * (p02Op01 - 1.0) * (p02 / (p02 + pia)) + 1.0) - -# shock speed -ss = Ms * c_a1 - -### volume fractions for each of the patches ### -C0 = 0.25 # vapor concentration for IMR - -# water liquid -awl1 = 1.00e00 - 2.00e-12 -awl2 = 1.00e-12 -# water vapor -awv1 = 1.00e-12 -awv2 = 1 / ((1 - C0) / C0 * rho0wv2 / rho0a2 + 1) -# air -aa1 = 1.0 - awl1 - awv1 -aa2 = 1.0 - awl2 - awv2 - -# SIMULATION PARAMETERS - -# CFL -cfl = 0.50 - -# Bubble Initial Radius -R0 = 30e-06 - -# number of elements -Nx0 = 400 -Nx = 1600 -Ny = 1600 -Nz = 1600 - -# domain boundaries -xb = 0.00 -xe = 120e-6 - -yb = 0.00 -ye = 120e-6 - -zb = 0.00 -ze = 120e-6 - -# typical cell size -dx = (xe - xb) / Nx -dy = (ye - yb) / Ny -dz = (ze - zb) / Nz - -# time step - -# save frequency = SF + 1 (because the initial state, 0.dat, is also saved) -SF = 200 - -# Critical time-step -tc = 0.915 * R0 * math.sqrt(rho0wl1 / p01) - -# making Nt divisible by SF -# tendA = 1.5 * tc -tend = 1.2 * tc - -# 1 - ensure NtA is sufficient to go a little beyond tendA -# NtA = int( tendA // dt + 1 ) - -# Array of saves. it is the same as Nt/Sf = t_step_save -# AS = int( NtA // SF + 1 ) - -# Nt = total number of steps. Ensure Nt > NtA (so the total tendA is covered) -# Nt = AS * SF -Nt = int(18e3 * tend // tc * Nx / Nx0 + 1) - -dt = tend / Nt - -AS = int(Nt // SF) - -# Total physical time -# tend = Nt * dt - -# Configuring case dictionary -print( - json.dumps( - { - # Logistics - "run_time_info": "T", - # Computational Domain Parameters - "x_domain%beg": xb, - "x_domain%end": xe, - "y_domain%beg": yb, - "y_domain%end": ye, - "stretch_x": "T", - "loops_x": 3, - "a_x": 4.0e0, - "x_a": -2.0 * R0, - "x_b": 2.0 * R0, - "stretch_y": "T", - "loops_y": 3, - "a_y": 4.0e0, - "y_a": -2.0 * R0, - "y_b": 2.0 * R0, - "cyl_coord": "T", - "m": Nx, - "n": Ny, - "p": 0, - "dt": dt, - "t_step_start": 0, - "t_step_stop": Nt, - "t_step_save": AS, - # Simulation Algorithm Parameters - "num_patches": 2, - "model_eqns": args.model_eqns, - "num_fluids": 3, - "mpp_lim": "T", - "mixture_err": "T", - "relax": "T", - "relax_model": 6, - "palpha_eps": 1.0e-8, - "ptgalpha_eps": 1.0e-2, - "time_stepper": 3, - "weno_order": 3, - "weno_eps": 1.0e-16, - "weno_Re_flux": "F", - "weno_avg": "F", - "mapped_weno": "T", - "null_weights": "F", - "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, - "bc_x%beg": -2, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, - # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, - "prim_vars_wrt": "T", - "parallel_io": "T", - # Patch 1: High pressured water - # Specify the cubic water background grid geometry - "patch_icpp(1)%geometry": 3, - "patch_icpp(1)%x_centroid": (xe + xb) * 500000 / 100, - "patch_icpp(1)%y_centroid": (ye + yb) * 500000 / 100, - "patch_icpp(1)%length_x": (xe - xb) * 1000000 / 100, - "patch_icpp(1)%length_y": (ye - yb) * 1000000 / 100, - "patch_icpp(1)%vel(1)": 0.0e00, - "patch_icpp(1)%vel(2)": 0.0e00, - "patch_icpp(1)%pres": p01, - "patch_icpp(1)%alpha_rho(1)": awl1 * rho0wl1, - "patch_icpp(1)%alpha_rho(2)": awv1 * rho0wv1, - "patch_icpp(1)%alpha_rho(3)": aa1 * rho0a1, - "patch_icpp(1)%alpha(1)": awl1, - "patch_icpp(1)%alpha(2)": awv1, - "patch_icpp(1)%alpha(3)": aa1, - # Patch 2: (Vapor) Bubble - "patch_icpp(2)%geometry": 2, - "patch_icpp(2)%x_centroid": xb, - "patch_icpp(2)%y_centroid": yb, - "patch_icpp(2)%radius": R0, - "patch_icpp(2)%vel(1)": 0.0e00, - "patch_icpp(2)%vel(2)": 0.0e00, - "patch_icpp(2)%pres": p02, - "patch_icpp(2)%alpha_rho(1)": awl2 * rho0wl2, - "patch_icpp(2)%alpha_rho(2)": awv2 * rho0wv2, - "patch_icpp(2)%alpha_rho(3)": aa2 * rho0a2, - "patch_icpp(2)%alpha(1)": awl2, - "patch_icpp(2)%alpha(2)": awv2, - "patch_icpp(2)%alpha(3)": aa2, - "patch_icpp(2)%alter_patch(1)": "T", - # Fluids Physical Parameters - "fluid_pp(1)%gamma": 1.0e00 / (gamwl - 1), - "fluid_pp(1)%pi_inf": gamwl * piwl / (gamwl - 1), - "fluid_pp(1)%cv": cvwl, - "fluid_pp(1)%qv": qvwl, - "fluid_pp(1)%qvp": qvpwl, - "fluid_pp(2)%gamma": 1.0e00 / (gamwv - 1), - "fluid_pp(2)%pi_inf": gamwv * piwv / (gamwv - 1), - "fluid_pp(2)%cv": cvwv, - "fluid_pp(2)%qv": qvwv, - "fluid_pp(2)%qvp": qvpwv, - "fluid_pp(3)%gamma": 1.0e00 / (gama - 1), - "fluid_pp(3)%pi_inf": gama * pia / (gama - 1), - "fluid_pp(3)%cv": cva, - "fluid_pp(3)%qv": qva, - "fluid_pp(3)%qvp": qvpa, - } - ) -) +#!/usr/bin/env python3 +import argparse +import json +import math + +parser = argparse.ArgumentParser(prog="phasechange", description="phase change considering both 5 and 6 equation models.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) +parser.add_argument("--mfc", type=json.loads, default={}, metavar="DICT", help="MFC's toolchain's internal state.") +parser.add_argument("-me", "--model_eqns", type=int, metavar="MODEL EQN", choices=[2, 3], default=3, help="choose `2' for 5-equation model or `3' for 6-equation model.") +args = parser.parse_args() + +# 1 FOR BACKGROUND, 2 FOR BUBBLE +# Pressure [Pa] +p01 = 5e6 +p02 = 3550 + +# Temperature [K] +T01 = 298.15 +T02 = 298.15 + +#### FLUID PROPERTIES #### + +### liquid water ### +# pi infty +piwl = 1.0e09 +# qv +qvwl = -1167000 +# qv' +qvpwl = 0.0e0 +# cv +cvwl = 1816 +# cp +cpwl = 4267 +# gamma +gamwl = cpwl / cvwl + +## FOR PATCHES 1 & 2 ## + +# density +rho0wl1 = (p01 + piwl) / ((gamwl - 1) * cvwl * T01) +rho0wl2 = (p02 + piwl) / ((gamwl - 1) * cvwl * T02) + +# speed of sound FOR +c_wl1 = math.sqrt(gamwl * (p01 + piwl) / rho0wl1) +c_wl2 = math.sqrt(gamwl * (p02 + piwl) / rho0wl2) + +# part for Gases - relations from IMR +Ru = 8.3144598 # Universal gas constant (J/mol-K) + +### Vapor water ### +Rv = Ru / (18.01528e-3) # Gas constant for vapor (Ru/molecular weight) (J/kg-K) +# gamma +gamwv = 1.4 +# cp +cpwv = Rv * gamwv / (gamwv - 1) +# cv +cvwv = cpwv / gamwv +# pi infinity +piwv = 0.0e0 +# qv +qvwv = 2030000 +# qv' +qvpwv = -23400 + +## FOR PATCHES 1 & 2 ## + +# density +rho0wv1 = (p01 + piwv) / ((gamwv - 1) * cvwv * T01) +rho0wv2 = (p02 + piwv) / ((gamwv - 1) * cvwv * T02) + +# speed of sound +c_wv1 = math.sqrt(gamwv * (p01 + piwv) / rho0wv1) +c_wv2 = math.sqrt(gamwv * (p02 + piwv) / rho0wv2) + +### Air ### + +Ra = Ru / (28.966e-3) # Gas constant for air (Ru/molecular weight) (J/kg-K) +# gamma +gama = 1.4 +# cp +cpa = Ra * gama / (gama - 1) +# cv +cva = cpa / gama +# pi infinity +pia = 0.0e0 +# qv +qva = 0.0e0 +# qv' +qvpa = 0.0e0 + +## FOR PATCHES 1 & 2 ## + +# density +rho0a1 = (p01 + pia) / ((gama - 1) * cva * T01) +rho0a2 = (p02 + pia) / ((gama - 1) * cva * T02) + +# Speed of sound +c_a1 = math.sqrt(gama * (p01 + pia) / rho0a1) +c_a2 = math.sqrt(gama * (p02 + pia) / rho0a2) + +# SHOCK RELATIONS +p02Op01 = p02 / p01 + +# Mach number of the shocked region - this should agree with Min, if everything is correct +Ms = math.sqrt((gama + 1.0) / (2.0 * gama) * (p02Op01 - 1.0) * (p02 / (p02 + pia)) + 1.0) + +# shock speed +ss = Ms * c_a1 + +### volume fractions for each of the patches ### +C0 = 0.25 # vapor concentration for IMR + +# water liquid +awl1 = 1.00e00 - 2.00e-12 +awl2 = 1.00e-12 +# water vapor +awv1 = 1.00e-12 +awv2 = 1 / ((1 - C0) / C0 * rho0wv2 / rho0a2 + 1) +# air +aa1 = 1.0 - awl1 - awv1 +aa2 = 1.0 - awl2 - awv2 + +# SIMULATION PARAMETERS + +# CFL +cfl = 0.50 + +# Bubble Initial Radius +R0 = 30e-06 + +# number of elements +Nx0 = 400 +Nx = 1600 +Ny = 1600 +Nz = 1600 + +# domain boundaries +xb = 0.00 +xe = 120e-6 + +yb = 0.00 +ye = 120e-6 + +zb = 0.00 +ze = 120e-6 + +# typical cell size +dx = (xe - xb) / Nx +dy = (ye - yb) / Ny +dz = (ze - zb) / Nz + +# time step + +# save frequency = SF + 1 (because the initial state, 0.dat, is also saved) +SF = 200 + +# Critical time-step +tc = 0.915 * R0 * math.sqrt(rho0wl1 / p01) + +# making Nt divisible by SF +# tendA = 1.5 * tc +tend = 1.2 * tc + +# 1 - ensure NtA is sufficient to go a little beyond tendA +# NtA = int( tendA // dt + 1 ) + +# Array of saves. it is the same as Nt/Sf = t_step_save +# AS = int( NtA // SF + 1 ) + +# Nt = total number of steps. Ensure Nt > NtA (so the total tendA is covered) +# Nt = AS * SF +Nt = int(18e3 * tend // tc * Nx / Nx0 + 1) + +dt = tend / Nt + +AS = int(Nt // SF) + +# Total physical time +# tend = Nt * dt + +# Configuring case dictionary +print( + json.dumps( + { + # Logistics + "run_time_info": "T", + # Computational Domain Parameters + "x_domain%beg": xb, + "x_domain%end": xe, + "y_domain%beg": yb, + "y_domain%end": ye, + "stretch_x": "T", + "loops_x": 3, + "a_x": 4.0e0, + "x_a": -2.0 * R0, + "x_b": 2.0 * R0, + "stretch_y": "T", + "loops_y": 3, + "a_y": 4.0e0, + "y_a": -2.0 * R0, + "y_b": 2.0 * R0, + "cyl_coord": "T", + "m": Nx, + "n": Ny, + "p": 0, + "dt": dt, + "t_step_start": 0, + "t_step_stop": Nt, + "t_step_save": AS, + # Simulation Algorithm Parameters + "num_patches": 2, + "model_eqns": args.model_eqns, + "num_fluids": 3, + "mpp_lim": "T", + "mixture_err": "T", + "relax": "T", + "relax_model": 6, + "palpha_eps": 1.0e-8, + "ptgalpha_eps": 1.0e-2, + "time_stepper": "rk3", + "weno_order": 3, + "weno_eps": 1.0e-16, + "weno_Re_flux": "F", + "weno_avg": "F", + "mapped_weno": "T", + "null_weights": "F", + "mp_weno": "F", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", + "bc_x%beg": -2, + "bc_x%end": -6, + "bc_y%beg": -2, + "bc_y%end": -6, + # Formatted Database Files Structure Parameters + "format": "silo", + "precision": "double", + "prim_vars_wrt": "T", + "parallel_io": "T", + # Patch 1: High pressured water + # Specify the cubic water background grid geometry + "patch_icpp(1)%geometry": 3, + "patch_icpp(1)%x_centroid": (xe + xb) * 500000 / 100, + "patch_icpp(1)%y_centroid": (ye + yb) * 500000 / 100, + "patch_icpp(1)%length_x": (xe - xb) * 1000000 / 100, + "patch_icpp(1)%length_y": (ye - yb) * 1000000 / 100, + "patch_icpp(1)%vel(1)": 0.0e00, + "patch_icpp(1)%vel(2)": 0.0e00, + "patch_icpp(1)%pres": p01, + "patch_icpp(1)%alpha_rho(1)": awl1 * rho0wl1, + "patch_icpp(1)%alpha_rho(2)": awv1 * rho0wv1, + "patch_icpp(1)%alpha_rho(3)": aa1 * rho0a1, + "patch_icpp(1)%alpha(1)": awl1, + "patch_icpp(1)%alpha(2)": awv1, + "patch_icpp(1)%alpha(3)": aa1, + # Patch 2: (Vapor) Bubble + "patch_icpp(2)%geometry": 2, + "patch_icpp(2)%x_centroid": xb, + "patch_icpp(2)%y_centroid": yb, + "patch_icpp(2)%radius": R0, + "patch_icpp(2)%vel(1)": 0.0e00, + "patch_icpp(2)%vel(2)": 0.0e00, + "patch_icpp(2)%pres": p02, + "patch_icpp(2)%alpha_rho(1)": awl2 * rho0wl2, + "patch_icpp(2)%alpha_rho(2)": awv2 * rho0wv2, + "patch_icpp(2)%alpha_rho(3)": aa2 * rho0a2, + "patch_icpp(2)%alpha(1)": awl2, + "patch_icpp(2)%alpha(2)": awv2, + "patch_icpp(2)%alpha(3)": aa2, + "patch_icpp(2)%alter_patch(1)": "T", + # Fluids Physical Parameters + "fluid_pp(1)%gamma": 1.0e00 / (gamwl - 1), + "fluid_pp(1)%pi_inf": gamwl * piwl / (gamwl - 1), + "fluid_pp(1)%cv": cvwl, + "fluid_pp(1)%qv": qvwl, + "fluid_pp(1)%qvp": qvpwl, + "fluid_pp(2)%gamma": 1.0e00 / (gamwv - 1), + "fluid_pp(2)%pi_inf": gamwv * piwv / (gamwv - 1), + "fluid_pp(2)%cv": cvwv, + "fluid_pp(2)%qv": qvwv, + "fluid_pp(2)%qvp": qvpwv, + "fluid_pp(3)%gamma": 1.0e00 / (gama - 1), + "fluid_pp(3)%pi_inf": gama * pia / (gama - 1), + "fluid_pp(3)%cv": cva, + "fluid_pp(3)%qv": qva, + "fluid_pp(3)%qvp": qvpa, + } + ) +) diff --git a/examples/2D_rayleigh_taylor/case.py b/examples/2D_rayleigh_taylor/case.py index ab7d9267db..b77b4c1b8b 100644 --- a/examples/2D_rayleigh_taylor/case.py +++ b/examples/2D_rayleigh_taylor/case.py @@ -44,20 +44,20 @@ "t_step_stop": Nt, "t_step_save": Ns, # Simulation Algorithm - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "mixture_err": "T", "mpp_lim": "T", - "time_stepper": 3, - "avg_state": 2, + "time_stepper": "rk3", + "avg_state": "arithmetic", "weno_order": 5, "weno_eps": 1e-16, "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", "weno_Re_flux": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -2, "bc_x%end": -2, "bc_y%beg": -16, @@ -66,8 +66,8 @@ "num_fluids": 2, "viscous": "T", # Database Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Fluid Parameters (Heavy Gas) diff --git a/examples/2D_richtmyer_meshkov/case.py b/examples/2D_richtmyer_meshkov/case.py index fed6529c55..f497d9862d 100644 --- a/examples/2D_richtmyer_meshkov/case.py +++ b/examples/2D_richtmyer_meshkov/case.py @@ -29,28 +29,28 @@ "t_save": time_save, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "recon_type": 1, - "time_stepper": 3, + "recon_type": "weno", + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-9, "null_weights": "F", "mapped_weno": "T", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -17, "bc_x%end": -17, "bc_y%beg": -15, "bc_y%end": -15, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Fluid #1 = Heavier Fluid diff --git a/examples/2D_riemann_test/case.py b/examples/2D_riemann_test/case.py index 8680984f23..94df6c683a 100644 --- a/examples/2D_riemann_test/case.py +++ b/examples/2D_riemann_test/case.py @@ -22,28 +22,28 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 4, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "mp_weno": "F", - # 'recon_type' : 1, + # 'recon_type' : "weno", "weno_order": 5, "weno_eps": 1e-16, - # 'muscl_order' : 2, - # 'muscl_lim' : 1, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + # 'muscl_order' : "second_order", + # 'muscl_lim' : "minmod", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, "bc_y%beg": -3, "bc_y%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Base diff --git a/examples/2D_riemann_test_muscl/case.py b/examples/2D_riemann_test_muscl/case.py index f21bbea559..9eb916c16c 100644 --- a/examples/2D_riemann_test_muscl/case.py +++ b/examples/2D_riemann_test_muscl/case.py @@ -22,28 +22,28 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 4, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", # "mp_weno": "F", - "recon_type": 2, + "recon_type": "muscl", # "weno_order": 5, # "weno_eps": 1e-16, - "muscl_order": 2, - "muscl_lim": 1, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "muscl_order": "second_order", + "muscl_lim": "minmod", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, "bc_y%beg": -3, "bc_y%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Base diff --git a/examples/2D_shearlayer/case.py b/examples/2D_shearlayer/case.py index 40edaf48b2..7871fb03a7 100644 --- a/examples/2D_shearlayer/case.py +++ b/examples/2D_shearlayer/case.py @@ -24,28 +24,28 @@ "t_step_stop": int(4e5), "t_step_save": int(1e4), # Simulation Algorithm Parameters - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 2, "num_patches": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.00000000000000e-16, "weno_Re_flux": "T", "weno_avg": "T", "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -5, "bc_y%end": -5, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: initialize entire domain diff --git a/examples/2D_shock_cloud_rmhd/case.py b/examples/2D_shock_cloud_rmhd/case.py index 3898b970a7..212f6b2f65 100644 --- a/examples/2D_shock_cloud_rmhd/case.py +++ b/examples/2D_shock_cloud_rmhd/case.py @@ -26,26 +26,26 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 1, "weno_eps": 1.0e-6, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, "bc_y%beg": -3, "bc_y%end": -2, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_shockbubble/case.py b/examples/2D_shockbubble/case.py index 6a195c7a2f..3db0902396 100644 --- a/examples/2D_shockbubble/case.py +++ b/examples/2D_shockbubble/case.py @@ -39,12 +39,12 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -52,16 +52,16 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -6, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Background diff --git a/examples/2D_shockdroplet/case.py b/examples/2D_shockdroplet/case.py index 910d1e42aa..e77790c5bb 100755 --- a/examples/2D_shockdroplet/case.py +++ b/examples/2D_shockdroplet/case.py @@ -50,12 +50,12 @@ "t_step_save": Nt, # math.ceil(Nt/100), # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -63,16 +63,16 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, # 11, "bc_x%end": -6, # 12 "bc_y%beg": -2, "bc_y%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Background diff --git a/examples/2D_shockdroplet_muscl/case.py b/examples/2D_shockdroplet_muscl/case.py index e27e13aefe..dc24935dc7 100755 --- a/examples/2D_shockdroplet_muscl/case.py +++ b/examples/2D_shockdroplet_muscl/case.py @@ -50,27 +50,27 @@ "t_step_save": math.ceil(Nt / 100), # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, - "recon_type": 2, - "muscl_order": 2, - "muscl_lim": 4, - "int_comp": 1, + "time_stepper": "rk3", + "recon_type": "muscl", + "muscl_order": "second_order", + "muscl_lim": "van_leer", + "int_comp": "thinc", "null_weights": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, # 11, "bc_x%end": -6, # 12 "bc_y%beg": -2, "bc_y%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Background diff --git a/examples/2D_shocktube_phasechange/case.py b/examples/2D_shocktube_phasechange/case.py index fe4614316e..5f4a23be69 100644 --- a/examples/2D_shocktube_phasechange/case.py +++ b/examples/2D_shocktube_phasechange/case.py @@ -188,22 +188,22 @@ "relax_model": 6, "palpha_eps": 1.0e-2, "ptgalpha_eps": 1.0e-2, - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -2, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 - Background diff --git a/examples/2D_triple_point/case.py b/examples/2D_triple_point/case.py index a67ebe8cce..dee855e4a4 100755 --- a/examples/2D_triple_point/case.py +++ b/examples/2D_triple_point/case.py @@ -26,12 +26,12 @@ "t_save": 0.04, # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 7, "weno_eps": 1.0e-16, "weno_Re_flux": "F", @@ -39,16 +39,16 @@ "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, # 11, "bc_x%end": -3, # 12 "bc_y%beg": -3, "bc_y%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "schlieren_wrt": "T", "fd_order": 4, diff --git a/examples/2D_tumbling_rectangle/case.py b/examples/2D_tumbling_rectangle/case.py index 8e71160f0f..ac7f16158f 100644 --- a/examples/2D_tumbling_rectangle/case.py +++ b/examples/2D_tumbling_rectangle/case.py @@ -31,7 +31,7 @@ # Only one patches are necessary, the air tube "num_patches": 1, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", # One fluids: air "num_fluids": 1, @@ -40,18 +40,18 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "T", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell "bc_x%beg": -3, "bc_x%end": -3, @@ -62,8 +62,8 @@ "num_ibs": 1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/2D_viscous/case.py b/examples/2D_viscous/case.py index f525067b29..333a51a38b 100644 --- a/examples/2D_viscous/case.py +++ b/examples/2D_viscous/case.py @@ -34,12 +34,12 @@ "t_step_save": 20, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "mapped_weno": "T", @@ -47,17 +47,17 @@ "mp_weno": "F", "weno_Re_flux": "T", "weno_avg": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -6, "bc_y%end": -6, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: Top fluid, water diff --git a/examples/2D_viscous_shock_tube/case.py b/examples/2D_viscous_shock_tube/case.py index 7c760e696b..f1b5152d6a 100644 --- a/examples/2D_viscous_shock_tube/case.py +++ b/examples/2D_viscous_shock_tube/case.py @@ -28,27 +28,27 @@ "t_save": time_save, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-10, "null_weights": "F", "mapped_weno": "T", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 1, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "roe", "bc_x%beg": -8, "bc_x%end": -15, "bc_y%beg": -16, "bc_y%end": -5, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Left diff --git a/examples/2D_whale_bubble_annulus/case.py b/examples/2D_whale_bubble_annulus/case.py index e6de0dca20..9128e99c98 100755 --- a/examples/2D_whale_bubble_annulus/case.py +++ b/examples/2D_whale_bubble_annulus/case.py @@ -60,26 +60,26 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 @@ -128,7 +128,7 @@ "fluid_pp(1)%pi_inf": gam_l * (pi_inf_l / p0) / (gam_l - 1.0), # Bubbles "bubbles_euler": "T", - "bubble_model": 3, + "bubble_model": "rayleigh_plesset", "polytropic": "T", "thermal": 3, "nb": 1, diff --git a/examples/2D_zero_circ_vortex/case.py b/examples/2D_zero_circ_vortex/case.py index a400cb02e5..0b07e0b329 100644 --- a/examples/2D_zero_circ_vortex/case.py +++ b/examples/2D_zero_circ_vortex/case.py @@ -40,27 +40,27 @@ "t_step_save": int(Nt / 100), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -7, "bc_x%end": -8, "bc_y%beg": -6, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "omega_wrt(3)": "T", diff --git a/examples/2D_zero_circ_vortex_analytical/case.py b/examples/2D_zero_circ_vortex_analytical/case.py index da28a8c43e..1c0f8a05b0 100644 --- a/examples/2D_zero_circ_vortex_analytical/case.py +++ b/examples/2D_zero_circ_vortex_analytical/case.py @@ -40,27 +40,27 @@ "t_step_save": int(Nt / 100), # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "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, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -7, "bc_x%end": -8, "bc_y%beg": -6, "bc_y%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "omega_wrt(3)": "T", diff --git a/examples/3D_IGR_33jet/case.py b/examples/3D_IGR_33jet/case.py index f999ad4494..9209d0c60b 100644 --- a/examples/3D_IGR_33jet/case.py +++ b/examples/3D_IGR_33jet/case.py @@ -47,12 +47,12 @@ # Simulation Algorithm Parameters "num_patches": 1, "num_bc_patches": 0, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", - "time_stepper": 3, - "riemann_solver": 5, + "time_stepper": "rk3", + "riemann_solver": "lax_friedrichs", "igr": "T", "igr_order": 3, "igr_pres_lim": "T", @@ -67,8 +67,8 @@ "bc_z%beg": -3, "bc_z%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 1, + "format": "silo", + "precision": "single", "prim_vars_wrt": "T", "file_per_process": "T", "parallel_io": "T", diff --git a/examples/3D_IGR_TaylorGreenVortex/case.py b/examples/3D_IGR_TaylorGreenVortex/case.py index 79553de313..5e5cbb9009 100644 --- a/examples/3D_IGR_TaylorGreenVortex/case.py +++ b/examples/3D_IGR_TaylorGreenVortex/case.py @@ -46,10 +46,10 @@ "t_step_save": int(Nt / 100), # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 1, - "time_stepper": 3, - "riemann_solver": 5, + "time_stepper": "rk3", + "riemann_solver": "lax_friedrichs", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, @@ -64,8 +64,8 @@ "alf_factor": 10, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "omega_wrt(1)": "T", "omega_wrt(2)": "T", diff --git a/examples/3D_IGR_TaylorGreenVortex_nvidia/case.py b/examples/3D_IGR_TaylorGreenVortex_nvidia/case.py index df1c2d202f..ed4a049843 100644 --- a/examples/3D_IGR_TaylorGreenVortex_nvidia/case.py +++ b/examples/3D_IGR_TaylorGreenVortex_nvidia/case.py @@ -51,10 +51,10 @@ "t_step_save": 10, # int(Nt / 100), # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 1, - "time_stepper": 3, - "riemann_solver": 5, + "time_stepper": "rk3", + "riemann_solver": "lax_friedrichs", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, @@ -69,8 +69,8 @@ "alf_factor": 10, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "omega_wrt(1)": "T", "omega_wrt(2)": "T", diff --git a/examples/3D_IGR_jet/case.py b/examples/3D_IGR_jet/case.py index 9529615996..ad7544bf8a 100644 --- a/examples/3D_IGR_jet/case.py +++ b/examples/3D_IGR_jet/case.py @@ -73,12 +73,12 @@ # Simulation Algorithm Parameters "num_patches": 1, "num_bc_patches": 0, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", - "time_stepper": 3, - "riemann_solver": 5, + "time_stepper": "rk3", + "riemann_solver": "lax_friedrichs", "igr": "T", "igr_order": 3, "igr_pres_lim": "T", @@ -93,8 +93,8 @@ "bc_z%beg": -3, "bc_z%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "c_wrt": "T", "parallel_io": "T", diff --git a/examples/3D_IGR_jet_1fluid/case.py b/examples/3D_IGR_jet_1fluid/case.py index 6837a5deec..7d51ab29a8 100644 --- a/examples/3D_IGR_jet_1fluid/case.py +++ b/examples/3D_IGR_jet_1fluid/case.py @@ -48,12 +48,12 @@ # Simulation Algorithm Parameters "num_patches": 1, "num_bc_patches": 0, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", - "time_stepper": 3, - "riemann_solver": 5, + "time_stepper": "rk3", + "riemann_solver": "lax_friedrichs", "igr": "T", "igr_order": 5, "igr_pres_lim": "T", @@ -68,8 +68,8 @@ "bc_z%beg": -3, "bc_z%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "c_wrt": "F", "parallel_io": "T", diff --git a/examples/3D_TaylorGreenVortex/case.py b/examples/3D_TaylorGreenVortex/case.py index e6df484570..104186bb77 100644 --- a/examples/3D_TaylorGreenVortex/case.py +++ b/examples/3D_TaylorGreenVortex/case.py @@ -46,19 +46,19 @@ "t_step_save": int(Nt / 100), # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, @@ -67,8 +67,8 @@ "bc_z%end": -1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", # 'prim_vars_wrt' :'T', "omega_wrt(1)": "T", "omega_wrt(2)": "T", diff --git a/examples/3D_TaylorGreenVortex_analytical/case.py b/examples/3D_TaylorGreenVortex_analytical/case.py index 11cab03bdb..943134305a 100644 --- a/examples/3D_TaylorGreenVortex_analytical/case.py +++ b/examples/3D_TaylorGreenVortex_analytical/case.py @@ -46,19 +46,19 @@ "t_step_save": int(Nt / 100), # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, @@ -67,8 +67,8 @@ "bc_z%end": -1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", # 'prim_vars_wrt' :'T', "omega_wrt(1)": "T", "omega_wrt(2)": "T", diff --git a/examples/3D_acoustic_support11/case.py b/examples/3D_acoustic_support11/case.py index 19625bbce6..83a4f23fa9 100644 --- a/examples/3D_acoustic_support11/case.py +++ b/examples/3D_acoustic_support11/case.py @@ -24,21 +24,21 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -6, @@ -46,8 +46,8 @@ "bc_z%beg": -6, "bc_z%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/3D_acoustic_support3/case.py b/examples/3D_acoustic_support3/case.py index 5548ce8399..47c3ac6ed7 100644 --- a/examples/3D_acoustic_support3/case.py +++ b/examples/3D_acoustic_support3/case.py @@ -24,21 +24,21 @@ "t_step_save": 5, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -6, @@ -46,8 +46,8 @@ "bc_z%beg": -6, "bc_z%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/3D_acoustic_support7/case.py b/examples/3D_acoustic_support7/case.py index 1a3333ae13..065417daef 100644 --- a/examples/3D_acoustic_support7/case.py +++ b/examples/3D_acoustic_support7/case.py @@ -23,21 +23,21 @@ "t_step_save": 5, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "teno": "T", "teno_CT": 1e-8, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -6, @@ -45,8 +45,8 @@ "bc_z%beg": -6, "bc_z%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1 Liquid diff --git a/examples/3D_advection_convergence/case.py b/examples/3D_advection_convergence/case.py index eeb33b071b..323beda9f9 100644 --- a/examples/3D_advection_convergence/case.py +++ b/examples/3D_advection_convergence/case.py @@ -43,13 +43,13 @@ if args.muscl: scheme_params = { - "recon_type": 2, - "muscl_order": 2, + "recon_type": "muscl", + "muscl_order": "second_order", "muscl_lim": args.muscl_lim, } else: scheme_params = { - "recon_type": 1, + "recon_type": "weno", "weno_order": args.order, "weno_eps": 1.0e-40, "weno_Re_flux": "F", @@ -79,23 +79,23 @@ "t_step_stop": Nt, "t_step_save": Nt, "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", "time_stepper": args.time_stepper, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, "bc_y%end": -1, "bc_z%beg": -1, "bc_z%end": -1, - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "F", "patch_icpp(1)%geometry": 9, diff --git a/examples/3D_brio_wu/case.py b/examples/3D_brio_wu/case.py index 08e3e7ca3c..d428fb7a0d 100644 --- a/examples/3D_brio_wu/case.py +++ b/examples/3D_brio_wu/case.py @@ -26,19 +26,19 @@ "t_step_save": 1, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 1, "weno_eps": 1.0e-16, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -3, "bc_x%end": -3, "bc_y%beg": -3, @@ -46,8 +46,8 @@ "bc_z%beg": -3, "bc_z%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "rho_wrt": "T", "parallel_io": "T", diff --git a/examples/3D_ibm_bowshock/case.py b/examples/3D_ibm_bowshock/case.py index bd54f07f05..05c04d3917 100644 --- a/examples/3D_ibm_bowshock/case.py +++ b/examples/3D_ibm_bowshock/case.py @@ -34,7 +34,7 @@ # Only one patches are necessary, the air tube "num_patches": 1, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", # 6 equations model does not need the K \div(u) term "alt_soundspeed": "F", # One fluids: air @@ -44,19 +44,19 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Reconstruct the primitive variables to minimize spurious # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "T", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell extrapolation "bc_x%beg": -3, "bc_x%end": -3, @@ -69,8 +69,8 @@ "num_ibs": 1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/3D_ibm_stl_ellipsoid/case.py b/examples/3D_ibm_stl_ellipsoid/case.py index 6021bef1c5..d5323d96d1 100644 --- a/examples/3D_ibm_stl_ellipsoid/case.py +++ b/examples/3D_ibm_stl_ellipsoid/case.py @@ -31,22 +31,22 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "viscous": "T", "bc_x%beg": -3, "bc_x%end": -3, @@ -57,8 +57,8 @@ "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "omega_wrt(1)": "T", diff --git a/examples/3D_ibm_stl_pyramid/case.py b/examples/3D_ibm_stl_pyramid/case.py index 67c5c8d0e4..ca2df151a9 100644 --- a/examples/3D_ibm_stl_pyramid/case.py +++ b/examples/3D_ibm_stl_pyramid/case.py @@ -31,22 +31,22 @@ "t_step_save": 30, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "viscous": "T", "bc_x%beg": -3, "bc_x%end": -3, @@ -57,8 +57,8 @@ "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "omega_wrt(1)": "T", diff --git a/examples/3D_ibm_stl_test/case.py b/examples/3D_ibm_stl_test/case.py index 573ea7e35a..51e2d40501 100644 --- a/examples/3D_ibm_stl_test/case.py +++ b/examples/3D_ibm_stl_test/case.py @@ -31,22 +31,22 @@ "t_step_save": 10, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "viscous": "F", "bc_x%beg": -3, "bc_x%end": -3, @@ -57,8 +57,8 @@ "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "omega_wrt(1)": "T", diff --git a/examples/3D_lagrange_bubblescreen/case.py b/examples/3D_lagrange_bubblescreen/case.py index ab61ffbe42..d8540b587a 100644 --- a/examples/3D_lagrange_bubblescreen/case.py +++ b/examples/3D_lagrange_bubblescreen/case.py @@ -1,186 +1,186 @@ -#!/usr/bin/env python3 -import json -import math - -# Bubble screen -# Description: A planar acoustic wave interacts with a bubble cloud -# in water. The background field is modeled in using an Eulerian framework, -# while the bubbles are tracked using a Lagrangian framework. - -# Reference values for nondimensionalization -x0 = 1.0e-03 # length - m -rho0 = 1.0e03 # density - kg/m3 -c0 = 1475.0 # speed of sound - m/s -p0 = rho0 * c0 * c0 # pressure - Pa -T0 = 298 # temperature - K - -# Host properties (water) -gamma_host = 2.7466 # Specific heat ratio -pi_inf_host = 792.02e06 # Stiffness - Pa -mu_host = 1e-3 # Dynamic viscosity - Pa.s -c_host = 1475.0 # speed of sound - m/s -rho_host = 1000 # density kg/m3 -T_host = 298 # temperature K - -# Lagrangian bubbles' properties -R_uni = 8314 # Universal gas constant - J/kmol/K -MW_g = 28.0 # Molar weight of the gas - kg/kmol -MW_v = 18.0 # Molar weight of the vapor - kg/kmol -gam_g = 1.4 # Specific heat ratio of the gas -gam_v = 1.333 # Specific heat ratio of the vapor -pv = 2350 # Vapor pressure of the host - Pa -cp_g = 1.0e3 # Specific heat of the gas - J/kg/K -cp_v = 2.1e3 # Specific heat of the vapor - J/kg/K -k_g = 0.025 # Thermal conductivity of the gas - W/m/K -k_v = 0.02 # Thermal conductivity of the vapor - W/m/K -diffVapor = 2.5e-5 # Diffusivity coefficient of the vapor - m2/s -sigBubble = 0.069 # Surface tension of the bubble - N/m -mu_g = 1.48e-5 - -# Acoustic source properties -patm = 101325.0 # Atmospheric pressure - Pa -pamp = 1.0e5 # Amplitude of the acoustic source - Pa -freq = 300e03 # Source frequency - Hz -wlen = c_host / freq # Wavelength - m - -# Domain and time set up - -xb = -12.0e-3 # Domain boundaries - m (x direction) -xe = 12.0e-3 -yb = -2.5e-3 # Domain boundaries - m (y direction) -ye = 2.5e-3 -zb = -2.5e-3 # Domain boundaries - m (z direction) -ze = 2.5e-3 - -Nx = 240 # number of elements into x direction -Ny = 50 # number of elements into y direction -Nz = 50 # number of elements into z direction - -dt = 7.5e-9 # constant time-step - sec - -# Configuring case dictionary -print( - json.dumps( - { - # Logistics - "run_time_info": "T", - # Computational Domain Parameters - "x_domain%beg": xb / x0, - "x_domain%end": xe / x0, - "y_domain%beg": yb / x0, - "y_domain%end": ye / x0, - "z_domain%beg": zb / x0, - "z_domain%end": ze / x0, - "stretch_z": "F", - "stretch_y": "F", - "stretch_x": "F", - "m": Nx, - "n": Ny, - "p": Nz, - "dt": dt * (c0 / x0), - "t_step_start": 0, - "t_step_stop": 3000, - "t_step_save": 500, - # Simulation Algorithm Parameters - "model_eqns": 2, - "time_stepper": 3, - "num_fluids": 2, - "num_patches": 1, - "viscous": "T", - "mpp_lim": "F", - "weno_order": 5, - "weno_eps": 1.0e-16, - "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -1, - "bc_y%end": -1, - "bc_z%beg": -1, - "bc_z%end": -1, - # Acoustic source - "acoustic_source": "T", - "num_source": 1, - "acoustic(1)%support": 3, - "acoustic(1)%pulse": 1, - "acoustic(1)%npulse": 1, - "acoustic(1)%mag": pamp / p0, - "acoustic(1)%wavelength": wlen / x0, - "acoustic(1)%length": 2 * (ze - zb) / x0, - "acoustic(1)%height": 2 * (ye - yb) / x0, - "acoustic(1)%loc(1)": -7.0e-03 / x0, - "acoustic(1)%loc(2)": 0.0, - "acoustic(1)%loc(3)": 0.0, - "acoustic(1)%dir": 0.0, - "acoustic(1)%delay": 0.0, - # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, - "prim_vars_wrt": "T", - "parallel_io": "T", - "lag_db_wrt": "T", - # Patch 1: Water (left) - "patch_icpp(1)%geometry": 9, - "patch_icpp(1)%x_centroid": 0.0, - "patch_icpp(1)%y_centroid": 0.0, - "patch_icpp(1)%z_centroid": 0.0, - "patch_icpp(1)%length_x": 2 * (xe - xb) / x0, - "patch_icpp(1)%length_y": 2 * (ye - yb) / x0, - "patch_icpp(1)%length_z": 2 * (ze - zb) / x0, - "patch_icpp(1)%vel(1)": 0.0, - "patch_icpp(1)%vel(2)": 0.0, - "patch_icpp(1)%vel(3)": 0.0, - "patch_icpp(1)%pres": patm / p0, - "patch_icpp(1)%alpha_rho(1)": rho_host / rho0, - "patch_icpp(1)%alpha_rho(2)": 0.0, - "patch_icpp(1)%alpha(1)": 1.0, - "patch_icpp(1)%alpha(2)": 0.0, - # Lagrangian Bubbles - "bubbles_lagrange": "T", - "bubble_model": 2, # Keller-Miksis model - "thermal": 3, - "polytropic": "F", - "lag_params%nBubs_glb": 1194, # Number of bubbles - "lag_params%solver_approach": 2, - "lag_params%cluster_type": 2, - "lag_params%pressure_corrector": "T", - "lag_params%smooth_type": 1, - "lag_params%heatTransfer_model": "T", - "lag_params%massTransfer_model": "T", - "lag_params%epsilonb": 1.0, - "lag_params%valmaxvoid": 0.9, - "lag_params%write_bubbles": "F", - "lag_params%write_bubbles_stats": "F", - # Bubble parameters - "bub_pp%R0ref": 1.0, - "bub_pp%p0ref": 1.0, - "bub_pp%rho0ref": 1.0, - "bub_pp%T0ref": 1.0, - "bub_pp%ss": sigBubble / (rho0 * x0 * c0 * c0), - "bub_pp%pv": pv / p0, - "bub_pp%vd": diffVapor / (x0 * c0), - "bub_pp%mu_l": mu_host / (rho0 * x0 * c0), - "bub_pp%gam_v": gam_v, - "bub_pp%gam_g": gam_g, - "bub_pp%M_v": MW_v, - "bub_pp%M_g": MW_g, - "bub_pp%k_v": k_v * (T0 / (x0 * rho0 * c0 * c0 * c0)), - "bub_pp%k_g": k_g * (T0 / (x0 * rho0 * c0 * c0 * c0)), - "bub_pp%cp_v": cp_v * (T0 / (c0 * c0)), - "bub_pp%cp_g": cp_g * (T0 / (c0 * c0)), - "bub_pp%R_v": (R_uni / MW_v) * (T0 / (c0 * c0)), - "bub_pp%R_g": (R_uni / MW_g) * (T0 / (c0 * c0)), - # Fluids Physical Parameters - # Host medium - "fluid_pp(1)%gamma": 1.0 / (gamma_host - 1.0), - "fluid_pp(1)%pi_inf": gamma_host * (pi_inf_host / p0) / (gamma_host - 1.0), - "fluid_pp(1)%Re(1)": 1.0 / (mu_host / (rho0 * c0 * x0)), - # Bubble gas state - "fluid_pp(2)%gamma": 1.0 / (gam_g - 1.0), - "fluid_pp(2)%pi_inf": 0.0e00, - "fluid_pp(2)%Re(1)": 1.0 / (mu_g / (rho0 * c0 * x0)), - } - ) -) +#!/usr/bin/env python3 +import json +import math + +# Bubble screen +# Description: A planar acoustic wave interacts with a bubble cloud +# in water. The background field is modeled in using an Eulerian framework, +# while the bubbles are tracked using a Lagrangian framework. + +# Reference values for nondimensionalization +x0 = 1.0e-03 # length - m +rho0 = 1.0e03 # density - kg/m3 +c0 = 1475.0 # speed of sound - m/s +p0 = rho0 * c0 * c0 # pressure - Pa +T0 = 298 # temperature - K + +# Host properties (water) +gamma_host = 2.7466 # Specific heat ratio +pi_inf_host = 792.02e06 # Stiffness - Pa +mu_host = 1e-3 # Dynamic viscosity - Pa.s +c_host = 1475.0 # speed of sound - m/s +rho_host = 1000 # density kg/m3 +T_host = 298 # temperature K + +# Lagrangian bubbles' properties +R_uni = 8314 # Universal gas constant - J/kmol/K +MW_g = 28.0 # Molar weight of the gas - kg/kmol +MW_v = 18.0 # Molar weight of the vapor - kg/kmol +gam_g = 1.4 # Specific heat ratio of the gas +gam_v = 1.333 # Specific heat ratio of the vapor +pv = 2350 # Vapor pressure of the host - Pa +cp_g = 1.0e3 # Specific heat of the gas - J/kg/K +cp_v = 2.1e3 # Specific heat of the vapor - J/kg/K +k_g = 0.025 # Thermal conductivity of the gas - W/m/K +k_v = 0.02 # Thermal conductivity of the vapor - W/m/K +diffVapor = 2.5e-5 # Diffusivity coefficient of the vapor - m2/s +sigBubble = 0.069 # Surface tension of the bubble - N/m +mu_g = 1.48e-5 + +# Acoustic source properties +patm = 101325.0 # Atmospheric pressure - Pa +pamp = 1.0e5 # Amplitude of the acoustic source - Pa +freq = 300e03 # Source frequency - Hz +wlen = c_host / freq # Wavelength - m + +# Domain and time set up + +xb = -12.0e-3 # Domain boundaries - m (x direction) +xe = 12.0e-3 +yb = -2.5e-3 # Domain boundaries - m (y direction) +ye = 2.5e-3 +zb = -2.5e-3 # Domain boundaries - m (z direction) +ze = 2.5e-3 + +Nx = 240 # number of elements into x direction +Ny = 50 # number of elements into y direction +Nz = 50 # number of elements into z direction + +dt = 7.5e-9 # constant time-step - sec + +# Configuring case dictionary +print( + json.dumps( + { + # Logistics + "run_time_info": "T", + # Computational Domain Parameters + "x_domain%beg": xb / x0, + "x_domain%end": xe / x0, + "y_domain%beg": yb / x0, + "y_domain%end": ye / x0, + "z_domain%beg": zb / x0, + "z_domain%end": ze / x0, + "stretch_z": "F", + "stretch_y": "F", + "stretch_x": "F", + "m": Nx, + "n": Ny, + "p": Nz, + "dt": dt * (c0 / x0), + "t_step_start": 0, + "t_step_stop": 3000, + "t_step_save": 500, + # Simulation Algorithm Parameters + "model_eqns": "5eq", + "time_stepper": "rk3", + "num_fluids": 2, + "num_patches": 1, + "viscous": "T", + "mpp_lim": "F", + "weno_order": 5, + "weno_eps": 1.0e-16, + "mapped_weno": "T", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", + "bc_x%beg": -6, + "bc_x%end": -6, + "bc_y%beg": -1, + "bc_y%end": -1, + "bc_z%beg": -1, + "bc_z%end": -1, + # Acoustic source + "acoustic_source": "T", + "num_source": 1, + "acoustic(1)%support": 3, + "acoustic(1)%pulse": 1, + "acoustic(1)%npulse": 1, + "acoustic(1)%mag": pamp / p0, + "acoustic(1)%wavelength": wlen / x0, + "acoustic(1)%length": 2 * (ze - zb) / x0, + "acoustic(1)%height": 2 * (ye - yb) / x0, + "acoustic(1)%loc(1)": -7.0e-03 / x0, + "acoustic(1)%loc(2)": 0.0, + "acoustic(1)%loc(3)": 0.0, + "acoustic(1)%dir": 0.0, + "acoustic(1)%delay": 0.0, + # Formatted Database Files Structure Parameters + "format": "silo", + "precision": "double", + "prim_vars_wrt": "T", + "parallel_io": "T", + "lag_db_wrt": "T", + # Patch 1: Water (left) + "patch_icpp(1)%geometry": 9, + "patch_icpp(1)%x_centroid": 0.0, + "patch_icpp(1)%y_centroid": 0.0, + "patch_icpp(1)%z_centroid": 0.0, + "patch_icpp(1)%length_x": 2 * (xe - xb) / x0, + "patch_icpp(1)%length_y": 2 * (ye - yb) / x0, + "patch_icpp(1)%length_z": 2 * (ze - zb) / x0, + "patch_icpp(1)%vel(1)": 0.0, + "patch_icpp(1)%vel(2)": 0.0, + "patch_icpp(1)%vel(3)": 0.0, + "patch_icpp(1)%pres": patm / p0, + "patch_icpp(1)%alpha_rho(1)": rho_host / rho0, + "patch_icpp(1)%alpha_rho(2)": 0.0, + "patch_icpp(1)%alpha(1)": 1.0, + "patch_icpp(1)%alpha(2)": 0.0, + # Lagrangian Bubbles + "bubbles_lagrange": "T", + "bubble_model": "keller_miksis", # Keller-Miksis model + "thermal": 3, + "polytropic": "F", + "lag_params%nBubs_glb": 1194, # Number of bubbles + "lag_params%solver_approach": 2, + "lag_params%cluster_type": 2, + "lag_params%pressure_corrector": "T", + "lag_params%smooth_type": 1, + "lag_params%heatTransfer_model": "T", + "lag_params%massTransfer_model": "T", + "lag_params%epsilonb": 1.0, + "lag_params%valmaxvoid": 0.9, + "lag_params%write_bubbles": "F", + "lag_params%write_bubbles_stats": "F", + # Bubble parameters + "bub_pp%R0ref": 1.0, + "bub_pp%p0ref": 1.0, + "bub_pp%rho0ref": 1.0, + "bub_pp%T0ref": 1.0, + "bub_pp%ss": sigBubble / (rho0 * x0 * c0 * c0), + "bub_pp%pv": pv / p0, + "bub_pp%vd": diffVapor / (x0 * c0), + "bub_pp%mu_l": mu_host / (rho0 * x0 * c0), + "bub_pp%gam_v": gam_v, + "bub_pp%gam_g": gam_g, + "bub_pp%M_v": MW_v, + "bub_pp%M_g": MW_g, + "bub_pp%k_v": k_v * (T0 / (x0 * rho0 * c0 * c0 * c0)), + "bub_pp%k_g": k_g * (T0 / (x0 * rho0 * c0 * c0 * c0)), + "bub_pp%cp_v": cp_v * (T0 / (c0 * c0)), + "bub_pp%cp_g": cp_g * (T0 / (c0 * c0)), + "bub_pp%R_v": (R_uni / MW_v) * (T0 / (c0 * c0)), + "bub_pp%R_g": (R_uni / MW_g) * (T0 / (c0 * c0)), + # Fluids Physical Parameters + # Host medium + "fluid_pp(1)%gamma": 1.0 / (gamma_host - 1.0), + "fluid_pp(1)%pi_inf": gamma_host * (pi_inf_host / p0) / (gamma_host - 1.0), + "fluid_pp(1)%Re(1)": 1.0 / (mu_host / (rho0 * c0 * x0)), + # Bubble gas state + "fluid_pp(2)%gamma": 1.0 / (gam_g - 1.0), + "fluid_pp(2)%pi_inf": 0.0e00, + "fluid_pp(2)%Re(1)": 1.0 / (mu_g / (rho0 * c0 * x0)), + } + ) +) diff --git a/examples/3D_lagrange_shbubcollapse/case.py b/examples/3D_lagrange_shbubcollapse/case.py index 73e0b88f69..59c89d2a1c 100644 --- a/examples/3D_lagrange_shbubcollapse/case.py +++ b/examples/3D_lagrange_shbubcollapse/case.py @@ -1,188 +1,188 @@ -#!/usr/bin/env python3 -import json -import math - -# Single bubble collapse -# Description: A planar acoustic wave interacts with a single bubble -# in water. The background field is modeled in using an Eulerian framework, -# while the bubbles are tracked using a Lagrangian framework. - -# Reference values for nondimensionalization -x0 = 1.0e-03 # length - m -rho0 = 1.0e03 # density - kg/m3 -c0 = 1475.0 # speed of sound - m/s -T0 = 298 # temperature - K -p0 = rho0 * c0 * c0 # pressure - Pa - -# Host properties (water + glicerol) -gamma_host = 2.7466 # Specific heat ratio -pi_inf_host = 792.02e06 # Stiffness - Pa -mu_host = 0.006 # Dynamic viscosity - Pa.s -c_host = 1475.0 # speed of sound - m/s -rho_host = 1000 # density kg/m3 -T_host = T0 # temperature K - -# Lagrangian bubble's properties -R_uni = 8314 # Universal gas constant - J/kmol/K -MW_g = 28.0 # Molar weight of the gas - kg/kmol -MW_v = 18.0 # Molar weight of the vapor - kg/kmol -gam_g = 1.33 # Specific heat ratio of the gas -gam_v = 1.33 # Specific heat ratio of the vapor -pv = 2500 # Vapor pressure of the host - Pa -cp_g = 1.0e3 # Specific heat of the gas - J/kg/K -cp_v = 2.1e3 # Specific heat of the vapor - J/kg/K -k_g = 0.025 # Thermal conductivity of the gas - W/m/K -k_v = 0.02 # Thermal conductivity of the vapor - W/m/K -diffVapor = 2.5e-5 # Diffusivity coefficient of the vapor - m2/s -sigBubble = 0.07 # Surface tension of the bubble - N/m -mu_g = 1.48e-5 - -# Acoustic source properties -patm = 1.0e05 # Atmospheric pressure - Pa -pamp = 1.32e05 # Amplitude of the acoustic source - Pa -freq = 21.4e03 # Source frequency - Hz -wlen = c_host / freq # Wavelength - m - -# Domain and time set up - -xb = -6.0e-3 # Domain boundaries - m (x direction) -xe = 6.0e-3 -yb = -3.0e-3 # Domain boundaries - m (y direction) -ye = 3.0e-3 -zb = -3.0e-3 # Domain boundaries - m (z direction) -ze = 3.0e-3 - -Nx = 2 * 60 # number of elements into x direction -Ny = 60 # number of elements into y direction -Nz = 60 # number of elements into z direction - -dt = 4.0e-08 # time-step - sec -stopTime = 60.0e-06 # stop time - sec -saveTime = 30.0e-06 # save time - sec - -# Configuring case dictionary -print( - json.dumps( - { - # Logistics - "run_time_info": "T", - # Computational Domain Parameters - "x_domain%beg": xb / x0, - "x_domain%end": xe / x0, - "y_domain%beg": yb / x0, - "y_domain%end": ye / x0, - "z_domain%beg": zb / x0, - "z_domain%end": ze / x0, - "stretch_x": "F", - "stretch_y": "F", - "stretch_z": "F", - "m": Nx, - "n": Ny, - "p": Nz, - "dt": round(dt * c0 / x0, 6), - "adap_dt": "T", - "n_start": 0, - "t_save": saveTime * (c0 / x0), - "t_stop": stopTime * (c0 / x0), - # Simulation Algorithm Parameters - "model_eqns": 2, - "num_fluids": 2, - "num_patches": 1, - "mpp_lim": "F", - "viscous": "T", - "time_stepper": 3, - "weno_order": 5, - "weno_eps": 1.0e-16, - "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, - "bc_z%beg": -6, - "bc_z%end": -6, - # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, - "prim_vars_wrt": "T", - "parallel_io": "T", - # Patch 1: Water (left) - "patch_icpp(1)%geometry": 9, - "patch_icpp(1)%x_centroid": 0.0, - "patch_icpp(1)%y_centroid": 0.0, - "patch_icpp(1)%z_centroid": 0.0, - "patch_icpp(1)%length_x": 2 * (xe - xb) / x0, - "patch_icpp(1)%length_y": 2 * (ye - yb) / x0, - "patch_icpp(1)%length_z": 2 * (ze - zb) / x0, - "patch_icpp(1)%vel(1)": 0.0, - "patch_icpp(1)%vel(2)": 0.0, - "patch_icpp(1)%vel(3)": 0.0, - "patch_icpp(1)%pres": patm / p0, - "patch_icpp(1)%alpha_rho(1)": rho_host / rho0, - "patch_icpp(1)%alpha_rho(2)": 0.0, - "patch_icpp(1)%alpha(1)": 1.0, - "patch_icpp(1)%alpha(2)": 0.0, - # Acoustic source - "acoustic_source": "T", - "num_source": 1, - "acoustic(1)%support": 3, - "acoustic(1)%pulse": 1, - "acoustic(1)%npulse": 10, - "acoustic(1)%mag": -pamp / p0, - "acoustic(1)%wavelength": wlen / x0, - "acoustic(1)%length": 2 * (ze - zb) / x0, - "acoustic(1)%height": 2 * (ye - yb) / x0, - "acoustic(1)%loc(1)": -2.0e-03 / x0, - "acoustic(1)%loc(2)": 0.0, - "acoustic(1)%loc(3)": 0.0, - "acoustic(1)%dir": 0.0, - "acoustic(1)%delay": 0.0, - # Lagrangian Bubbles - "bubbles_lagrange": "T", - "bubble_model": 2, # Keller-Miksis model - "thermal": 3, - "polytropic": "F", - "lag_params%nBubs_glb": 1, - "lag_params%solver_approach": 2, - "lag_params%cluster_type": 2, - "lag_params%pressure_corrector": "T", - "lag_params%smooth_type": 1, - "lag_params%heatTransfer_model": "T", - "lag_params%massTransfer_model": "F", - "lag_params%epsilonb": 1.0, - "lag_params%valmaxvoid": 0.9, - "lag_params%write_bubbles": "F", - "lag_params%write_bubbles_stats": "F", - # Bubble parameters - "bub_pp%R0ref": 1.0, - "bub_pp%p0ref": 1.0, - "bub_pp%rho0ref": 1.0, - "bub_pp%T0ref": 1.0, - "bub_pp%ss": sigBubble / (rho0 * x0 * c0 * c0), - "bub_pp%pv": pv / p0, - "bub_pp%vd": diffVapor / (x0 * c0), - "bub_pp%mu_l": mu_host / (rho0 * x0 * c0), - "bub_pp%gam_v": gam_v, - "bub_pp%gam_g": gam_g, - "bub_pp%M_v": MW_v, - "bub_pp%M_g": MW_g, - "bub_pp%k_v": k_v * (T0 / (x0 * rho0 * c0 * c0 * c0)), - "bub_pp%k_g": k_g * (T0 / (x0 * rho0 * c0 * c0 * c0)), - "bub_pp%cp_v": cp_v * (T0 / (c0 * c0)), - "bub_pp%cp_g": cp_g * (T0 / (c0 * c0)), - "bub_pp%R_v": (R_uni / MW_v) * (T0 / (c0 * c0)), - "bub_pp%R_g": (R_uni / MW_g) * (T0 / (c0 * c0)), - # Fluids Physical Parameters - # Host medium - "fluid_pp(1)%gamma": 1.0 / (gamma_host - 1.0), - "fluid_pp(1)%pi_inf": gamma_host * (pi_inf_host / p0) / (gamma_host - 1.0), - "fluid_pp(1)%Re(1)": 1.0 / (mu_host / (rho0 * c0 * x0)), - # Bubble gas state - "fluid_pp(2)%gamma": 1.0 / (gam_g - 1.0), - "fluid_pp(2)%pi_inf": 0.0e00, - "fluid_pp(2)%Re(1)": 1.0 / (mu_g / (rho0 * c0 * x0)), - } - ) -) +#!/usr/bin/env python3 +import json +import math + +# Single bubble collapse +# Description: A planar acoustic wave interacts with a single bubble +# in water. The background field is modeled in using an Eulerian framework, +# while the bubbles are tracked using a Lagrangian framework. + +# Reference values for nondimensionalization +x0 = 1.0e-03 # length - m +rho0 = 1.0e03 # density - kg/m3 +c0 = 1475.0 # speed of sound - m/s +T0 = 298 # temperature - K +p0 = rho0 * c0 * c0 # pressure - Pa + +# Host properties (water + glicerol) +gamma_host = 2.7466 # Specific heat ratio +pi_inf_host = 792.02e06 # Stiffness - Pa +mu_host = 0.006 # Dynamic viscosity - Pa.s +c_host = 1475.0 # speed of sound - m/s +rho_host = 1000 # density kg/m3 +T_host = T0 # temperature K + +# Lagrangian bubble's properties +R_uni = 8314 # Universal gas constant - J/kmol/K +MW_g = 28.0 # Molar weight of the gas - kg/kmol +MW_v = 18.0 # Molar weight of the vapor - kg/kmol +gam_g = 1.33 # Specific heat ratio of the gas +gam_v = 1.33 # Specific heat ratio of the vapor +pv = 2500 # Vapor pressure of the host - Pa +cp_g = 1.0e3 # Specific heat of the gas - J/kg/K +cp_v = 2.1e3 # Specific heat of the vapor - J/kg/K +k_g = 0.025 # Thermal conductivity of the gas - W/m/K +k_v = 0.02 # Thermal conductivity of the vapor - W/m/K +diffVapor = 2.5e-5 # Diffusivity coefficient of the vapor - m2/s +sigBubble = 0.07 # Surface tension of the bubble - N/m +mu_g = 1.48e-5 + +# Acoustic source properties +patm = 1.0e05 # Atmospheric pressure - Pa +pamp = 1.32e05 # Amplitude of the acoustic source - Pa +freq = 21.4e03 # Source frequency - Hz +wlen = c_host / freq # Wavelength - m + +# Domain and time set up + +xb = -6.0e-3 # Domain boundaries - m (x direction) +xe = 6.0e-3 +yb = -3.0e-3 # Domain boundaries - m (y direction) +ye = 3.0e-3 +zb = -3.0e-3 # Domain boundaries - m (z direction) +ze = 3.0e-3 + +Nx = 2 * 60 # number of elements into x direction +Ny = 60 # number of elements into y direction +Nz = 60 # number of elements into z direction + +dt = 4.0e-08 # time-step - sec +stopTime = 60.0e-06 # stop time - sec +saveTime = 30.0e-06 # save time - sec + +# Configuring case dictionary +print( + json.dumps( + { + # Logistics + "run_time_info": "T", + # Computational Domain Parameters + "x_domain%beg": xb / x0, + "x_domain%end": xe / x0, + "y_domain%beg": yb / x0, + "y_domain%end": ye / x0, + "z_domain%beg": zb / x0, + "z_domain%end": ze / x0, + "stretch_x": "F", + "stretch_y": "F", + "stretch_z": "F", + "m": Nx, + "n": Ny, + "p": Nz, + "dt": round(dt * c0 / x0, 6), + "adap_dt": "T", + "n_start": 0, + "t_save": saveTime * (c0 / x0), + "t_stop": stopTime * (c0 / x0), + # Simulation Algorithm Parameters + "model_eqns": "5eq", + "num_fluids": 2, + "num_patches": 1, + "mpp_lim": "F", + "viscous": "T", + "time_stepper": "rk3", + "weno_order": 5, + "weno_eps": 1.0e-16, + "mapped_weno": "T", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", + "bc_x%beg": -6, + "bc_x%end": -6, + "bc_y%beg": -6, + "bc_y%end": -6, + "bc_z%beg": -6, + "bc_z%end": -6, + # Formatted Database Files Structure Parameters + "format": "silo", + "precision": "double", + "prim_vars_wrt": "T", + "parallel_io": "T", + # Patch 1: Water (left) + "patch_icpp(1)%geometry": 9, + "patch_icpp(1)%x_centroid": 0.0, + "patch_icpp(1)%y_centroid": 0.0, + "patch_icpp(1)%z_centroid": 0.0, + "patch_icpp(1)%length_x": 2 * (xe - xb) / x0, + "patch_icpp(1)%length_y": 2 * (ye - yb) / x0, + "patch_icpp(1)%length_z": 2 * (ze - zb) / x0, + "patch_icpp(1)%vel(1)": 0.0, + "patch_icpp(1)%vel(2)": 0.0, + "patch_icpp(1)%vel(3)": 0.0, + "patch_icpp(1)%pres": patm / p0, + "patch_icpp(1)%alpha_rho(1)": rho_host / rho0, + "patch_icpp(1)%alpha_rho(2)": 0.0, + "patch_icpp(1)%alpha(1)": 1.0, + "patch_icpp(1)%alpha(2)": 0.0, + # Acoustic source + "acoustic_source": "T", + "num_source": 1, + "acoustic(1)%support": 3, + "acoustic(1)%pulse": 1, + "acoustic(1)%npulse": 10, + "acoustic(1)%mag": -pamp / p0, + "acoustic(1)%wavelength": wlen / x0, + "acoustic(1)%length": 2 * (ze - zb) / x0, + "acoustic(1)%height": 2 * (ye - yb) / x0, + "acoustic(1)%loc(1)": -2.0e-03 / x0, + "acoustic(1)%loc(2)": 0.0, + "acoustic(1)%loc(3)": 0.0, + "acoustic(1)%dir": 0.0, + "acoustic(1)%delay": 0.0, + # Lagrangian Bubbles + "bubbles_lagrange": "T", + "bubble_model": "keller_miksis", # Keller-Miksis model + "thermal": 3, + "polytropic": "F", + "lag_params%nBubs_glb": 1, + "lag_params%solver_approach": 2, + "lag_params%cluster_type": 2, + "lag_params%pressure_corrector": "T", + "lag_params%smooth_type": 1, + "lag_params%heatTransfer_model": "T", + "lag_params%massTransfer_model": "F", + "lag_params%epsilonb": 1.0, + "lag_params%valmaxvoid": 0.9, + "lag_params%write_bubbles": "F", + "lag_params%write_bubbles_stats": "F", + # Bubble parameters + "bub_pp%R0ref": 1.0, + "bub_pp%p0ref": 1.0, + "bub_pp%rho0ref": 1.0, + "bub_pp%T0ref": 1.0, + "bub_pp%ss": sigBubble / (rho0 * x0 * c0 * c0), + "bub_pp%pv": pv / p0, + "bub_pp%vd": diffVapor / (x0 * c0), + "bub_pp%mu_l": mu_host / (rho0 * x0 * c0), + "bub_pp%gam_v": gam_v, + "bub_pp%gam_g": gam_g, + "bub_pp%M_v": MW_v, + "bub_pp%M_g": MW_g, + "bub_pp%k_v": k_v * (T0 / (x0 * rho0 * c0 * c0 * c0)), + "bub_pp%k_g": k_g * (T0 / (x0 * rho0 * c0 * c0 * c0)), + "bub_pp%cp_v": cp_v * (T0 / (c0 * c0)), + "bub_pp%cp_g": cp_g * (T0 / (c0 * c0)), + "bub_pp%R_v": (R_uni / MW_v) * (T0 / (c0 * c0)), + "bub_pp%R_g": (R_uni / MW_g) * (T0 / (c0 * c0)), + # Fluids Physical Parameters + # Host medium + "fluid_pp(1)%gamma": 1.0 / (gamma_host - 1.0), + "fluid_pp(1)%pi_inf": gamma_host * (pi_inf_host / p0) / (gamma_host - 1.0), + "fluid_pp(1)%Re(1)": 1.0 / (mu_host / (rho0 * c0 * x0)), + # Bubble gas state + "fluid_pp(2)%gamma": 1.0 / (gam_g - 1.0), + "fluid_pp(2)%pi_inf": 0.0e00, + "fluid_pp(2)%Re(1)": 1.0 / (mu_g / (rho0 * c0 * x0)), + } + ) +) diff --git a/examples/3D_mibm_sphere_head_on_collision/case.py b/examples/3D_mibm_sphere_head_on_collision/case.py index 0a2fe3ba67..981aacb310 100644 --- a/examples/3D_mibm_sphere_head_on_collision/case.py +++ b/examples/3D_mibm_sphere_head_on_collision/case.py @@ -54,7 +54,7 @@ # Simulation Algorithm Parameters "num_patches": 1, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", # One fluids: air "num_fluids": 1, @@ -62,17 +62,17 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell "bc_x%beg": -3, "bc_x%end": -3, @@ -84,8 +84,8 @@ "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/3D_patch_spherical_harmonic/case.py b/examples/3D_patch_spherical_harmonic/case.py index dc0314a869..4b745e0f96 100644 --- a/examples/3D_patch_spherical_harmonic/case.py +++ b/examples/3D_patch_spherical_harmonic/case.py @@ -45,19 +45,19 @@ "t_step_stop": Nt, "t_step_save": max(1, int(Nt / 10)), "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -8, "bc_x%end": -8, "bc_y%beg": -8, @@ -76,8 +76,8 @@ "bc_z%grcbc_out": "T", "bc_z%grcbc_vel_out": "F", "bc_z%pres_out": p_inf, - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", "patch_icpp(1)%geometry": 9, diff --git a/examples/3D_performance_test/case.py b/examples/3D_performance_test/case.py index 4e08a8ea1b..c60f39ad01 100644 --- a/examples/3D_performance_test/case.py +++ b/examples/3D_performance_test/case.py @@ -36,22 +36,22 @@ "t_step_save": 30, # Simulation Algorithm Parameters "num_patches": 2, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -2, "bc_x%end": -6, "bc_y%beg": -2, @@ -59,8 +59,8 @@ "bc_z%beg": -2, "bc_z%end": -6, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: High pressured water diff --git a/examples/3D_phasechange_bubble/case.py b/examples/3D_phasechange_bubble/case.py index 6c71aa1936..228875a1d7 100644 --- a/examples/3D_phasechange_bubble/case.py +++ b/examples/3D_phasechange_bubble/case.py @@ -1,302 +1,302 @@ -#!/usr/bin/env python3 -import argparse -import json -import math - -parser = argparse.ArgumentParser(prog="phasechange", description="phase change considering both 5 and 6 equation models.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) -parser.add_argument("--mfc", type=json.loads, default="{}", metavar="DICT", help="MFC's toolchain's internal state.") -parser.add_argument("-me", "--model_eqns", type=int, metavar="MODEL EQN", choices=[2, 3], default=3, help="choose `2' for 5-equation model or `3' for 6-equation model.") -args = parser.parse_args() - -# 1 FOR BACKGROUND, 2 FOR BUBBLE -# Pressure [Pa] -p01 = 5e6 -p02 = 3550 - -# Temperature [K] -T01 = 298.15 -T02 = 298.15 - -#### FLUID PROPERTIES #### - -### liquid water ### -# pi infty -piwl = 1.0e09 -# qv -qvwl = -1167000 -# qv' -qvpwl = 0.0e0 -# cv -cvwl = 1816 -# cp -cpwl = 4267 -# gamma -gamwl = cpwl / cvwl - -## FOR PATCHES 1 & 2 ## - -# density -rho0wl1 = (p01 + piwl) / ((gamwl - 1) * cvwl * T01) -rho0wl2 = (p02 + piwl) / ((gamwl - 1) * cvwl * T02) - -# speed of sound FOR -c_wl1 = math.sqrt(gamwl * (p01 + piwl) / rho0wl1) -c_wl2 = math.sqrt(gamwl * (p02 + piwl) / rho0wl2) - -# part for Gases - relations from IMR -Ru = 8.3144598 # Universal gas constant (J/mol-K) - -### Vapor water ### -Rv = Ru / (18.01528e-3) # Gas constant for vapor (Ru/molecular weight) (J/kg-K) -# gamma -gamwv = 1.4 -# cp -cpwv = Rv * gamwv / (gamwv - 1) -# cv -cvwv = cpwv / gamwv -# pi infinity -piwv = 0.0e0 -# qv -qvwv = 2030000 -# qv' -qvpwv = -23400 - -## FOR PATCHES 1 & 2 ## - -# density -rho0wv1 = (p01 + piwv) / ((gamwv - 1) * cvwv * T01) -rho0wv2 = (p02 + piwv) / ((gamwv - 1) * cvwv * T02) - -# speed of sound -c_wv1 = math.sqrt(gamwv * (p01 + piwv) / rho0wv1) -c_wv2 = math.sqrt(gamwv * (p02 + piwv) / rho0wv2) - -### Air ### - -Ra = Ru / (28.966e-3) # Gas constant for air (Ru/molecular weight) (J/kg-K) -# gamma -gama = 1.4 -# cp -cpa = Ra * gama / (gama - 1) -# cv -cva = cpa / gama -# pi infinity -pia = 0.0e0 -# qv -qva = 0.0e0 -# qv' -qvpa = 0.0e0 - -## FOR PATCHES 1 & 2 ## - -# density -rho0a1 = (p01 + pia) / ((gama - 1) * cva * T01) -rho0a2 = (p02 + pia) / ((gama - 1) * cva * T02) - -# Speed of sound -c_a1 = math.sqrt(gama * (p01 + pia) / rho0a1) -c_a2 = math.sqrt(gama * (p02 + pia) / rho0a2) - -# SHOCK RELATIONS -p02Op01 = p02 / p01 - -# Mach number of the shocked region - this should agree with Min, if everything is correct -Ms = math.sqrt((gama + 1.0) / (2.0 * gama) * (p02Op01 - 1.0) * (p02 / (p02 + pia)) + 1.0) - -# shock speed -ss = Ms * c_a1 - -### volume fractions for each of the patches ### -C0 = 0.25 # vapor concentration for IMR - -# water liquid -awl1 = 1.00e00 - 2.00e-12 -awl2 = 1.00e-12 -# water vapor -awv1 = 1.00e-12 -awv2 = 1 / ((1 - C0) / C0 * rho0wv2 / rho0a2 + 1) -# air -aa1 = 1.0 - awl1 - awv1 -aa2 = 1.0 - awl2 - awv2 - -# SIMULATION PARAMETERS - -# CFL -cfl = 0.50 - -# Bubble Initial Radius -R0 = 30e-06 - -# number of elements -Nx0 = 400 -Nx = 199 -Ny = 199 -Nz = 199 - -# domain boundaries -xb = 0.00 -xe = 120e-6 - -yb = 0.00 -ye = 120e-6 - -zb = 0.00 -ze = 120e-6 - -# typical cell size -dx = (xe - xb) / Nx -dy = (ye - yb) / Ny -dz = (ze - zb) / Nz - -# time step - -# save frequency = SF + 1 (because the initial state, 0.dat, is also saved) -SF = 200 - -# Critical time-step -tc = 0.915 * R0 * math.sqrt(rho0wl1 / p01) - -# making Nt divisible by SF -# tendA = 1.5 * tc -tend = 1.2 * tc - -# 1 - ensure NtA is sufficient to go a little beyond tendA -# NtA = int( tendA // dt + 1 ) - -# Array of saves. it is the same as Nt/Sf = t_step_save -# AS = int( NtA // SF + 1 ) - -# Nt = total number of steps. Ensure Nt > NtA (so the total tendA is covered) -# Nt = AS * SF -Nt = int(18e3 * tend // tc * Nx / Nx0 + 1) - -dt = tend / Nt - -AS = int(Nt // SF) - -# Total physical time -# tend = Nt * dt - -# Configuring case dictionary -print( - json.dumps( - { - # Logistics - "run_time_info": "T", - # Computational Domain Parameters - "x_domain%beg": xb, - "x_domain%end": xe, - "y_domain%beg": yb, - "y_domain%end": ye, - "z_domain%beg": zb, - "z_domain%end": ze, - "stretch_x": "T", - "loops_x": 3, - "a_x": 4.0e0, - "x_a": -2.0 * R0, - "x_b": 2.0 * R0, - "stretch_y": "T", - "loops_y": 3, - "a_y": 4.0e0, - "y_a": -2.0 * R0, - "y_b": 2.0 * R0, - "stretch_z": "T", - "loops_z": 3, - "a_z": 4.0e0, - "z_a": -2.0 * R0, - "z_b": 2.0 * R0, - "cyl_coord": "F", - "m": Nx, - "n": Ny, - "p": Nz, - "dt": dt, - "t_step_start": 0, - "t_step_stop": Nt, - "t_step_save": AS, - # Simulation Algorithm Parameters - "num_patches": 2, - "model_eqns": args.model_eqns, - "num_fluids": 3, - "mpp_lim": "T", - "mixture_err": "T", - "relax": "T", - "relax_model": 6, - "palpha_eps": 1.0e-6, - "ptgalpha_eps": 1.0e-2, - "time_stepper": 3, - "weno_order": 3, - "weno_eps": 1.0e-32, - "weno_Re_flux": "F", - "weno_avg": "F", - "mapped_weno": "T", - "null_weights": "F", - "mp_weno": "F", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, - "bc_x%beg": -2, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, - "bc_z%beg": -2, - "bc_z%end": -6, - # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, - "prim_vars_wrt": "T", - "parallel_io": "T", - # Patch 1: High pressured water - # Specify the cubic water background grid geometry - "patch_icpp(1)%geometry": 9, - "patch_icpp(1)%x_centroid": (xe + xb) * 500000 / 100, - "patch_icpp(1)%y_centroid": (ye + yb) * 500000 / 100, - "patch_icpp(1)%z_centroid": (ze + zb) * 500000 / 100, - "patch_icpp(1)%length_x": (xe - xb) * 1000000 / 100, - "patch_icpp(1)%length_y": (ye - yb) * 1000000 / 100, - "patch_icpp(1)%length_z": (ze - zb) * 1000000 / 100, - "patch_icpp(1)%vel(1)": 0.0e00, - "patch_icpp(1)%vel(2)": 0.0e00, - "patch_icpp(1)%vel(3)": 0.0e00, - "patch_icpp(1)%pres": p01, - "patch_icpp(1)%alpha_rho(1)": awl1 * rho0wl1, - "patch_icpp(1)%alpha_rho(2)": awv1 * rho0wv1, - "patch_icpp(1)%alpha_rho(3)": aa1 * rho0a1, - "patch_icpp(1)%alpha(1)": awl1, - "patch_icpp(1)%alpha(2)": awv1, - "patch_icpp(1)%alpha(3)": aa1, - # Patch 2: (Vapor) Bubble - "patch_icpp(2)%geometry": 8, - "patch_icpp(2)%x_centroid": xb, - "patch_icpp(2)%y_centroid": yb, - "patch_icpp(2)%z_centroid": zb, - "patch_icpp(2)%radius": R0, - "patch_icpp(2)%vel(1)": 0.0e00, - "patch_icpp(2)%vel(2)": 0.0e00, - "patch_icpp(2)%vel(3)": 0.0e00, - "patch_icpp(2)%pres": p02, - "patch_icpp(2)%alpha_rho(1)": awl2 * rho0wl2, - "patch_icpp(2)%alpha_rho(2)": awv2 * rho0wv2, - "patch_icpp(2)%alpha_rho(3)": aa2 * rho0a2, - "patch_icpp(2)%alpha(1)": awl2, - "patch_icpp(2)%alpha(2)": awv2, - "patch_icpp(2)%alpha(3)": aa2, - "patch_icpp(2)%alter_patch(1)": "T", - # Fluids Physical Parameters - "fluid_pp(1)%gamma": 1.0e00 / (gamwl - 1), - "fluid_pp(1)%pi_inf": gamwl * piwl / (gamwl - 1), - "fluid_pp(1)%cv": cvwl, - "fluid_pp(1)%qv": qvwl, - "fluid_pp(1)%qvp": qvpwl, - "fluid_pp(2)%gamma": 1.0e00 / (gamwv - 1), - "fluid_pp(2)%pi_inf": gamwv * piwv / (gamwv - 1), - "fluid_pp(2)%cv": cvwv, - "fluid_pp(2)%qv": qvwv, - "fluid_pp(2)%qvp": qvpwv, - "fluid_pp(3)%gamma": 1.0e00 / (gama - 1), - "fluid_pp(3)%pi_inf": gama * pia / (gama - 1), - "fluid_pp(3)%cv": cva, - "fluid_pp(3)%qv": qva, - "fluid_pp(3)%qvp": qvpa, - } - ) -) +#!/usr/bin/env python3 +import argparse +import json +import math + +parser = argparse.ArgumentParser(prog="phasechange", description="phase change considering both 5 and 6 equation models.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) +parser.add_argument("--mfc", type=json.loads, default="{}", metavar="DICT", help="MFC's toolchain's internal state.") +parser.add_argument("-me", "--model_eqns", type=int, metavar="MODEL EQN", choices=[2, 3], default=3, help="choose `2' for 5-equation model or `3' for 6-equation model.") +args = parser.parse_args() + +# 1 FOR BACKGROUND, 2 FOR BUBBLE +# Pressure [Pa] +p01 = 5e6 +p02 = 3550 + +# Temperature [K] +T01 = 298.15 +T02 = 298.15 + +#### FLUID PROPERTIES #### + +### liquid water ### +# pi infty +piwl = 1.0e09 +# qv +qvwl = -1167000 +# qv' +qvpwl = 0.0e0 +# cv +cvwl = 1816 +# cp +cpwl = 4267 +# gamma +gamwl = cpwl / cvwl + +## FOR PATCHES 1 & 2 ## + +# density +rho0wl1 = (p01 + piwl) / ((gamwl - 1) * cvwl * T01) +rho0wl2 = (p02 + piwl) / ((gamwl - 1) * cvwl * T02) + +# speed of sound FOR +c_wl1 = math.sqrt(gamwl * (p01 + piwl) / rho0wl1) +c_wl2 = math.sqrt(gamwl * (p02 + piwl) / rho0wl2) + +# part for Gases - relations from IMR +Ru = 8.3144598 # Universal gas constant (J/mol-K) + +### Vapor water ### +Rv = Ru / (18.01528e-3) # Gas constant for vapor (Ru/molecular weight) (J/kg-K) +# gamma +gamwv = 1.4 +# cp +cpwv = Rv * gamwv / (gamwv - 1) +# cv +cvwv = cpwv / gamwv +# pi infinity +piwv = 0.0e0 +# qv +qvwv = 2030000 +# qv' +qvpwv = -23400 + +## FOR PATCHES 1 & 2 ## + +# density +rho0wv1 = (p01 + piwv) / ((gamwv - 1) * cvwv * T01) +rho0wv2 = (p02 + piwv) / ((gamwv - 1) * cvwv * T02) + +# speed of sound +c_wv1 = math.sqrt(gamwv * (p01 + piwv) / rho0wv1) +c_wv2 = math.sqrt(gamwv * (p02 + piwv) / rho0wv2) + +### Air ### + +Ra = Ru / (28.966e-3) # Gas constant for air (Ru/molecular weight) (J/kg-K) +# gamma +gama = 1.4 +# cp +cpa = Ra * gama / (gama - 1) +# cv +cva = cpa / gama +# pi infinity +pia = 0.0e0 +# qv +qva = 0.0e0 +# qv' +qvpa = 0.0e0 + +## FOR PATCHES 1 & 2 ## + +# density +rho0a1 = (p01 + pia) / ((gama - 1) * cva * T01) +rho0a2 = (p02 + pia) / ((gama - 1) * cva * T02) + +# Speed of sound +c_a1 = math.sqrt(gama * (p01 + pia) / rho0a1) +c_a2 = math.sqrt(gama * (p02 + pia) / rho0a2) + +# SHOCK RELATIONS +p02Op01 = p02 / p01 + +# Mach number of the shocked region - this should agree with Min, if everything is correct +Ms = math.sqrt((gama + 1.0) / (2.0 * gama) * (p02Op01 - 1.0) * (p02 / (p02 + pia)) + 1.0) + +# shock speed +ss = Ms * c_a1 + +### volume fractions for each of the patches ### +C0 = 0.25 # vapor concentration for IMR + +# water liquid +awl1 = 1.00e00 - 2.00e-12 +awl2 = 1.00e-12 +# water vapor +awv1 = 1.00e-12 +awv2 = 1 / ((1 - C0) / C0 * rho0wv2 / rho0a2 + 1) +# air +aa1 = 1.0 - awl1 - awv1 +aa2 = 1.0 - awl2 - awv2 + +# SIMULATION PARAMETERS + +# CFL +cfl = 0.50 + +# Bubble Initial Radius +R0 = 30e-06 + +# number of elements +Nx0 = 400 +Nx = 199 +Ny = 199 +Nz = 199 + +# domain boundaries +xb = 0.00 +xe = 120e-6 + +yb = 0.00 +ye = 120e-6 + +zb = 0.00 +ze = 120e-6 + +# typical cell size +dx = (xe - xb) / Nx +dy = (ye - yb) / Ny +dz = (ze - zb) / Nz + +# time step + +# save frequency = SF + 1 (because the initial state, 0.dat, is also saved) +SF = 200 + +# Critical time-step +tc = 0.915 * R0 * math.sqrt(rho0wl1 / p01) + +# making Nt divisible by SF +# tendA = 1.5 * tc +tend = 1.2 * tc + +# 1 - ensure NtA is sufficient to go a little beyond tendA +# NtA = int( tendA // dt + 1 ) + +# Array of saves. it is the same as Nt/Sf = t_step_save +# AS = int( NtA // SF + 1 ) + +# Nt = total number of steps. Ensure Nt > NtA (so the total tendA is covered) +# Nt = AS * SF +Nt = int(18e3 * tend // tc * Nx / Nx0 + 1) + +dt = tend / Nt + +AS = int(Nt // SF) + +# Total physical time +# tend = Nt * dt + +# Configuring case dictionary +print( + json.dumps( + { + # Logistics + "run_time_info": "T", + # Computational Domain Parameters + "x_domain%beg": xb, + "x_domain%end": xe, + "y_domain%beg": yb, + "y_domain%end": ye, + "z_domain%beg": zb, + "z_domain%end": ze, + "stretch_x": "T", + "loops_x": 3, + "a_x": 4.0e0, + "x_a": -2.0 * R0, + "x_b": 2.0 * R0, + "stretch_y": "T", + "loops_y": 3, + "a_y": 4.0e0, + "y_a": -2.0 * R0, + "y_b": 2.0 * R0, + "stretch_z": "T", + "loops_z": 3, + "a_z": 4.0e0, + "z_a": -2.0 * R0, + "z_b": 2.0 * R0, + "cyl_coord": "F", + "m": Nx, + "n": Ny, + "p": Nz, + "dt": dt, + "t_step_start": 0, + "t_step_stop": Nt, + "t_step_save": AS, + # Simulation Algorithm Parameters + "num_patches": 2, + "model_eqns": args.model_eqns, + "num_fluids": 3, + "mpp_lim": "T", + "mixture_err": "T", + "relax": "T", + "relax_model": 6, + "palpha_eps": 1.0e-6, + "ptgalpha_eps": 1.0e-2, + "time_stepper": "rk3", + "weno_order": 3, + "weno_eps": 1.0e-32, + "weno_Re_flux": "F", + "weno_avg": "F", + "mapped_weno": "T", + "null_weights": "F", + "mp_weno": "F", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", + "bc_x%beg": -2, + "bc_x%end": -6, + "bc_y%beg": -2, + "bc_y%end": -6, + "bc_z%beg": -2, + "bc_z%end": -6, + # Formatted Database Files Structure Parameters + "format": "silo", + "precision": "double", + "prim_vars_wrt": "T", + "parallel_io": "T", + # Patch 1: High pressured water + # Specify the cubic water background grid geometry + "patch_icpp(1)%geometry": 9, + "patch_icpp(1)%x_centroid": (xe + xb) * 500000 / 100, + "patch_icpp(1)%y_centroid": (ye + yb) * 500000 / 100, + "patch_icpp(1)%z_centroid": (ze + zb) * 500000 / 100, + "patch_icpp(1)%length_x": (xe - xb) * 1000000 / 100, + "patch_icpp(1)%length_y": (ye - yb) * 1000000 / 100, + "patch_icpp(1)%length_z": (ze - zb) * 1000000 / 100, + "patch_icpp(1)%vel(1)": 0.0e00, + "patch_icpp(1)%vel(2)": 0.0e00, + "patch_icpp(1)%vel(3)": 0.0e00, + "patch_icpp(1)%pres": p01, + "patch_icpp(1)%alpha_rho(1)": awl1 * rho0wl1, + "patch_icpp(1)%alpha_rho(2)": awv1 * rho0wv1, + "patch_icpp(1)%alpha_rho(3)": aa1 * rho0a1, + "patch_icpp(1)%alpha(1)": awl1, + "patch_icpp(1)%alpha(2)": awv1, + "patch_icpp(1)%alpha(3)": aa1, + # Patch 2: (Vapor) Bubble + "patch_icpp(2)%geometry": 8, + "patch_icpp(2)%x_centroid": xb, + "patch_icpp(2)%y_centroid": yb, + "patch_icpp(2)%z_centroid": zb, + "patch_icpp(2)%radius": R0, + "patch_icpp(2)%vel(1)": 0.0e00, + "patch_icpp(2)%vel(2)": 0.0e00, + "patch_icpp(2)%vel(3)": 0.0e00, + "patch_icpp(2)%pres": p02, + "patch_icpp(2)%alpha_rho(1)": awl2 * rho0wl2, + "patch_icpp(2)%alpha_rho(2)": awv2 * rho0wv2, + "patch_icpp(2)%alpha_rho(3)": aa2 * rho0a2, + "patch_icpp(2)%alpha(1)": awl2, + "patch_icpp(2)%alpha(2)": awv2, + "patch_icpp(2)%alpha(3)": aa2, + "patch_icpp(2)%alter_patch(1)": "T", + # Fluids Physical Parameters + "fluid_pp(1)%gamma": 1.0e00 / (gamwl - 1), + "fluid_pp(1)%pi_inf": gamwl * piwl / (gamwl - 1), + "fluid_pp(1)%cv": cvwl, + "fluid_pp(1)%qv": qvwl, + "fluid_pp(1)%qvp": qvpwl, + "fluid_pp(2)%gamma": 1.0e00 / (gamwv - 1), + "fluid_pp(2)%pi_inf": gamwv * piwv / (gamwv - 1), + "fluid_pp(2)%cv": cvwv, + "fluid_pp(2)%qv": qvwv, + "fluid_pp(2)%qvp": qvpwv, + "fluid_pp(3)%gamma": 1.0e00 / (gama - 1), + "fluid_pp(3)%pi_inf": gama * pia / (gama - 1), + "fluid_pp(3)%cv": cva, + "fluid_pp(3)%qv": qva, + "fluid_pp(3)%qvp": qvpa, + } + ) +) diff --git a/examples/3D_rayleigh_taylor/case.py b/examples/3D_rayleigh_taylor/case.py index 647127426d..eac40590a0 100644 --- a/examples/3D_rayleigh_taylor/case.py +++ b/examples/3D_rayleigh_taylor/case.py @@ -49,20 +49,20 @@ "t_step_stop": Nt, "t_step_save": Ns, # Simulation Algorithm - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "mixture_err": "T", "mpp_lim": "T", - "time_stepper": 3, - "avg_state": 2, + "time_stepper": "rk3", + "avg_state": "arithmetic", "weno_order": 5, "weno_eps": 1e-16, "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", "weno_Re_flux": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -2, "bc_x%end": -3, "bc_y%beg": -16, @@ -73,8 +73,8 @@ "num_fluids": 2, "viscous": "T", # Database Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Fluid Parameters (Heavy Gas) diff --git a/examples/3D_rayleigh_taylor_muscl/case.py b/examples/3D_rayleigh_taylor_muscl/case.py index f93248383c..e2ba950ccf 100644 --- a/examples/3D_rayleigh_taylor_muscl/case.py +++ b/examples/3D_rayleigh_taylor_muscl/case.py @@ -49,18 +49,18 @@ "t_step_stop": Nt, "t_step_save": Ns, # Simulation Algorithm - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "mixture_err": "T", "mpp_lim": "T", - "time_stepper": 3, - "recon_type": 2, - "muscl_order": 2, - "muscl_lim": 4, - "int_comp": 1, - "avg_state": 2, - "riemann_solver": 2, - "wave_speeds": 1, + "time_stepper": "rk3", + "recon_type": "muscl", + "muscl_order": "second_order", + "muscl_lim": "van_leer", + "int_comp": "thinc", + "avg_state": "arithmetic", + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -2, "bc_x%end": -3, "bc_y%beg": -16, @@ -71,8 +71,8 @@ "num_fluids": 2, "viscous": "T", # Database Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Fluid Parameters (Heavy Gas) diff --git a/examples/3D_recovering_sphere/case.py b/examples/3D_recovering_sphere/case.py index 9a92c654a2..765fcc59de 100644 --- a/examples/3D_recovering_sphere/case.py +++ b/examples/3D_recovering_sphere/case.py @@ -47,20 +47,20 @@ # 't_step_stop' : 100, # 't_step_save' : 100, # Simulation Algorithm - "model_eqns": 3, + "model_eqns": "6eq", "alt_soundspeed": "F", "mixture_err": "T", "mpp_lim": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, - "avg_state": 2, + "avg_state": "arithmetic", "weno_eps": 1e-16, "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", "weno_Re_flux": "F", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", "bc_x%beg": -2, "bc_x%end": -3, "bc_y%beg": -2, @@ -72,8 +72,8 @@ "weno_avg": "T", "surface_tension": "T", # Database Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "alpha_wrt(1)": "T", # 'prim_vars_wrt' : 'T', "cf_wrt": "T", diff --git a/examples/3D_rotating_sphere/case.py b/examples/3D_rotating_sphere/case.py index 59282de860..1093211f59 100644 --- a/examples/3D_rotating_sphere/case.py +++ b/examples/3D_rotating_sphere/case.py @@ -31,7 +31,7 @@ # Only one patches are necessary, the air tube "num_patches": 1, # Use the 5 equation model - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", # One fluids: air "num_fluids": 1, @@ -40,18 +40,18 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "T", "weno_avg": "T", - "avg_state": 2, + "avg_state": "arithmetic", "mapped_weno": "T", "null_weights": "F", "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use ghost-cell "bc_x%beg": -3, "bc_x%end": -3, @@ -64,8 +64,8 @@ "num_ibs": 1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "E_wrt": "T", "parallel_io": "T", diff --git a/examples/3D_shockdroplet/case.py b/examples/3D_shockdroplet/case.py index 10741bc82e..9967429178 100644 --- a/examples/3D_shockdroplet/case.py +++ b/examples/3D_shockdroplet/case.py @@ -193,20 +193,20 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 3, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", "mapped_weno": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -2, @@ -214,8 +214,8 @@ "bc_z%beg": -2, "bc_z%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # I will use 1 for WATER properties, and 2 for AIR properties diff --git a/examples/3D_shockdroplet_muscl/case.py b/examples/3D_shockdroplet_muscl/case.py index d1defd1e5d..fa59ee951d 100644 --- a/examples/3D_shockdroplet_muscl/case.py +++ b/examples/3D_shockdroplet_muscl/case.py @@ -193,19 +193,19 @@ "t_step_save": 100, # Simulation Algorithm Parameters "num_patches": 3, - "model_eqns": 2, + "model_eqns": "5eq", "alt_soundspeed": "F", "num_fluids": 2, "mpp_lim": "T", "mixture_err": "T", - "time_stepper": 3, - "recon_type": 2, - "muscl_order": 2, - "muscl_lim": 3, - "int_comp": 1, - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "time_stepper": "rk3", + "recon_type": "muscl", + "muscl_order": "second_order", + "muscl_lim": "van_albada", + "int_comp": "thinc", + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -6, "bc_x%end": -6, "bc_y%beg": -2, @@ -213,8 +213,8 @@ "bc_z%beg": -2, "bc_z%end": -3, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # I will use 1 for WATER properties, and 2 for AIR properties diff --git a/examples/3D_sphbubcollapse/case.py b/examples/3D_sphbubcollapse/case.py index d22975494b..f232b8e7e9 100644 --- a/examples/3D_sphbubcollapse/case.py +++ b/examples/3D_sphbubcollapse/case.py @@ -46,7 +46,7 @@ # gas bubble "num_patches": 2, # Use the 6 equation model - "model_eqns": 3, + "model_eqns": "6eq", # 6 equations model does not need the K \div(u) term "alt_soundspeed": "F", # Two fluids: water and air @@ -56,20 +56,20 @@ # Correct errors when computing speed of sound "mixture_err": "T", # Use TVD RK3 for time marching - "time_stepper": 3, + "time_stepper": "rk3", # Use WENO5 "weno_order": 5, "weno_eps": 1.0e-16, "weno_Re_flux": "F", "weno_avg": "F", - "avg_state": 2, + "avg_state": "arithmetic", # Use the mapped WENO weights to maintain monotinicity "mapped_weno": "T", "null_weights": "F", "mp_weno": "F", # Use the HLLC Riemann solver - "riemann_solver": 2, - "wave_speeds": 1, + "riemann_solver": "hllc", + "wave_speeds": "direct", # We use reflective boundary conditions at octant edges and # non-reflective boundary conditions at the domain edges "bc_x%beg": -2, @@ -81,8 +81,8 @@ # Formatted Database Files Structure Parameters # Export primitive variables in double precision with parallel # I/O to minimize I/O computational time during large simulations - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "parallel_io": "T", # Patch 1: High pressured water diff --git a/examples/3D_turb_mixing/case.py b/examples/3D_turb_mixing/case.py index f4b8a0c486..80a1484c0a 100644 --- a/examples/3D_turb_mixing/case.py +++ b/examples/3D_turb_mixing/case.py @@ -68,16 +68,16 @@ "t_step_save": t_save, # Simulation Algorithm Parameters "num_patches": 1, - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 1, - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1.0e-40, "weno_Re_flux": "F", "wenoz": "T", - "riemann_solver": 2, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hllc", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -6, @@ -86,8 +86,8 @@ "bc_z%end": -1, "viscous": "T", # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "cons_vars_wrt": "F", "prim_vars_wrt": "T", "parallel_io": "T", diff --git a/examples/nD_perfect_reactor/case.py b/examples/nD_perfect_reactor/case.py index d0000deb89..ea8ef93a21 100644 --- a/examples/nD_perfect_reactor/case.py +++ b/examples/nD_perfect_reactor/case.py @@ -63,20 +63,20 @@ "t_step_print": NS, "parallel_io": "T" if args.ndim > 1 and args.mfc.get("mpi", True) else "F", # Simulation Algorithm Parameters - "model_eqns": 2, + "model_eqns": "5eq", "num_fluids": 1, "num_patches": 1, "mpp_lim": "F", "mixture_err": "F", - "time_stepper": 3, + "time_stepper": "rk3", "weno_order": 5, "weno_eps": 1e-16, "weno_avg": "F", "mapped_weno": "T", "mp_weno": "T", - "riemann_solver": 1, - "wave_speeds": 1, - "avg_state": 2, + "riemann_solver": "hll", + "wave_speeds": "direct", + "avg_state": "arithmetic", "bc_x%beg": -1, "bc_x%end": -1, "bc_y%beg": -1, @@ -84,8 +84,8 @@ "bc_z%beg": -1, "bc_z%end": -1, # Formatted Database Files Structure Parameters - "format": 1, - "precision": 2, + "format": "silo", + "precision": "double", "prim_vars_wrt": "T", "chem_wrt_T": "T", # Patch 1 diff --git a/src/common/m_constants.fpp b/src/common/m_constants.fpp index b2259ae44d..5452c13a21 100644 --- a/src/common/m_constants.fpp +++ b/src/common/m_constants.fpp @@ -116,4 +116,8 @@ module m_constants integer, parameter :: BC_SLIP_WALL = -15 integer, parameter :: BC_NO_SLIP_WALL = -16 integer, parameter :: BC_DIRICHLET = -17 + + ! Named values for enumerated case parameters (e.g. riemann_solver_hllc). + ! AUTO-GENERATED from "names" in toolchain/mfc/params/definitions.py. + #:include 'generated_constants.fpp' end module m_constants diff --git a/src/common/m_phase_change.fpp b/src/common/m_phase_change.fpp index 7f9131550d..6cfe012cb8 100644 --- a/src/common/m_phase_change.fpp +++ b/src/common/m_phase_change.fpp @@ -15,6 +15,7 @@ module m_phase_change use m_variables_conversion use ieee_arithmetic use m_helper_basic + use m_constants, only: model_eqns_6eq implicit none @@ -235,7 +236,7 @@ contains q_cons_vf(i + eqn_idx%adv%beg - 1)%sf(j, k, l) = q_cons_vf(i + eqn_idx%cont%beg - 1)%sf(j, k, l)/rhok(i) ! alpha*rho*e - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then q_cons_vf(i + eqn_idx%int_en%beg - 1)%sf(j, k, l) = q_cons_vf(i + eqn_idx%cont%beg - 1)%sf(j, k, & & l)*ek(i) end if diff --git a/src/common/m_variables_conversion.fpp b/src/common/m_variables_conversion.fpp index 19a3ce8728..97c9dd0c4a 100644 --- a/src/common/m_variables_conversion.fpp +++ b/src/common/m_variables_conversion.fpp @@ -13,6 +13,8 @@ module m_variables_conversion use m_mpi_proxy use m_helper_basic use m_helper + use m_constants, only: riemann_solver_hll, riemann_solver_hlld, model_eqns_gamma_law, model_eqns_5eq, model_eqns_6eq, & + & model_eqns_4eq use m_thermochem, only: num_species, get_temperature, get_pressure, gas_constant, get_mixture_molecular_weight, & & get_mixture_energy_mass @@ -69,7 +71,7 @@ contains real(wp), optional, intent(out) :: G_K real(wp), optional, dimension(num_fluids), intent(in) :: G - if (model_eqns == 1) then ! Gamma/pi_inf model + if (model_eqns == model_eqns_gamma_law) then ! Gamma/pi_inf model call s_convert_mixture_to_mixture_variables(q_vf, i, j, k, rho, gamma, pi_inf, qv) else ! Volume fraction model call s_convert_species_to_mixture_variables(q_vf, i, j, k, rho, gamma, pi_inf, qv, Re_K, G_K, G) @@ -104,10 +106,10 @@ contains if (mhd) then ! MHD pressure: subtract magnetic pressure from total energy pres = (energy - dyn_p - pi_inf - qv - pres_mag)/gamma - else if ((model_eqns /= 4) .and. (bubbles_euler .neqv. .true.)) then + else if ((model_eqns /= model_eqns_4eq) .and. (bubbles_euler .neqv. .true.)) then ! Gamma/pi_inf model or five-equation model (Allaire et al. JCP 2002): p from mixture EOS pres = (energy - dyn_p - pi_inf - qv)/gamma - else if ((model_eqns /= 4) .and. bubbles_euler) then + else if ((model_eqns /= model_eqns_4eq) .and. bubbles_euler) then ! Bubble-augmented pressure with void fraction correction pres = ((energy - dyn_p)/(1._wp - alf) - pi_inf - qv)/gamma else @@ -510,7 +512,7 @@ contains call s_compute_species_fraction(qK_cons_vf, j, k, l, alpha_rho_K, alpha_K) - if (model_eqns /= 4) then + if (model_eqns /= model_eqns_4eq) then #ifdef MFC_SIMULATION ! If in simulation, use acc mixture subroutines if (elasticity) then @@ -640,7 +642,7 @@ contains ! Recover velocity from momentum: u = rho*u / rho, and accumulate dynamic pressure 0.5*rho*|u|^2 $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%mom%beg, eqn_idx%mom%end - if (model_eqns /= 4) then + if (model_eqns /= model_eqns_4eq) then qK_prim_vf(i)%sf(j, k, l) = qK_cons_vf(i)%sf(j, k, l)/rho_K dyn_pres_K = dyn_pres_K + 5.e-1_wp*qK_cons_vf(i)%sf(j, k, l)*qK_prim_vf(i)%sf(j, k, l) else @@ -919,10 +921,10 @@ contains ! MHD energy includes magnetic pressure contribution q_cons_vf(eqn_idx%E)%sf(j, k, l) = gamma*q_prim_vf(eqn_idx%E)%sf(j, k, & & l) + dyn_pres + pres_mag + pi_inf + qv - else if ((model_eqns /= 4) .and. (bubbles_euler .neqv. .true.)) then + else if ((model_eqns /= model_eqns_4eq) .and. (bubbles_euler .neqv. .true.)) then ! Five-equation model (Allaire et al. JCP 2002): E = Gamma*p + 0.5*rho*|u|^2 + pi_inf + qv q_cons_vf(eqn_idx%E)%sf(j, k, l) = gamma*q_prim_vf(eqn_idx%E)%sf(j, k, l) + dyn_pres + pi_inf + qv - else if ((model_eqns /= 4) .and. (bubbles_euler)) then + else if ((model_eqns /= model_eqns_4eq) .and. (bubbles_euler)) then ! Bubble-augmented energy with void fraction correction q_cons_vf(eqn_idx%E)%sf(j, k, l) = dyn_pres + (1._wp - q_prim_vf(eqn_idx%alf)%sf(j, k, & & l))*(gamma*q_prim_vf(eqn_idx%E)%sf(j, k, l) + pi_inf) @@ -933,7 +935,7 @@ contains end if ! Six-equation model (Saurel et al. JCP 2009): compute per-phase internal energies - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then do i = 1, num_fluids q_cons_vf(i + eqn_idx%int_en%beg - 1)%sf(j, k, l) = q_cons_vf(i + eqn_idx%adv%beg - 1)%sf(j, k, & & l)*(gammas(i)*q_prim_vf(eqn_idx%E)%sf(j, k, & @@ -1145,7 +1147,7 @@ contains end do end if - if (riemann_solver == 1 .or. riemann_solver == 4) then + if (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_hlld) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end FK_vf(j, k, l, i) = 0._wp @@ -1277,14 +1279,14 @@ contains blkmod1 = ((gammas(1) + 1._wp)*pres + pi_infs(1))/gammas(1) blkmod2 = ((gammas(2) + 1._wp)*pres + pi_infs(2))/gammas(2) c = (1._wp/(rho*(adv(1)/blkmod1 + adv(2)/blkmod2))) - else if (model_eqns == 3) then ! Six-equation model sound speed + else if (model_eqns == model_eqns_6eq) then ! Six-equation model sound speed c = 0._wp $:GPU_LOOP(parallelism='[seq]') do q = 1, num_fluids c = c + adv(q)*gs_min(q)*(pres + pi_infs(q)/(gammas(q) + 1._wp)) end do c = c/rho - else if (((model_eqns == 4) .or. (model_eqns == 2 .and. bubbles_euler))) then + else if (((model_eqns == model_eqns_4eq) .or. (model_eqns == model_eqns_5eq .and. bubbles_euler))) then ! Sound speed for bubble mixture to order O(\alpha) if (mpp_lim .and. (num_fluids > 1)) then diff --git a/src/post_process/m_data_output.fpp b/src/post_process/m_data_output.fpp index 72087dee1b..1a189408ac 100644 --- a/src/post_process/m_data_output.fpp +++ b/src/post_process/m_data_output.fpp @@ -12,6 +12,7 @@ module m_data_output use m_compile_specific use m_helper use m_variables_conversion + use m_constants, only: model_eqns_gamma_law, model_eqns_5eq, model_eqns_6eq implicit none @@ -232,7 +233,7 @@ contains if (format == 2) then dbvars = 0 - if ((model_eqns == 2) .or. (model_eqns == 3)) then + if ((model_eqns == model_eqns_5eq) .or. (model_eqns == model_eqns_6eq)) then do i = 1, num_fluids if (alpha_rho_wrt(i) .or. (cons_vars_wrt .or. prim_vars_wrt)) then dbvars = dbvars + 1 @@ -240,7 +241,8 @@ contains end do end if - if ((rho_wrt .or. (model_eqns == 1 .and. (cons_vars_wrt .or. prim_vars_wrt))) .and. (.not. relativity)) then + if ((rho_wrt .or. (model_eqns == model_eqns_gamma_law .and. (cons_vars_wrt .or. prim_vars_wrt))) & + & .and. (.not. relativity)) then dbvars = dbvars + 1 end if @@ -273,7 +275,7 @@ contains end if end if - if ((model_eqns == 2) .or. (model_eqns == 3)) then + if ((model_eqns == model_eqns_5eq) .or. (model_eqns == model_eqns_6eq)) then do i = 1, num_fluids - 1 if (alpha_wrt(i) .or. (cons_vars_wrt .or. prim_vars_wrt)) then dbvars = dbvars + 1 @@ -285,13 +287,13 @@ contains end if end if - if (gamma_wrt .or. (model_eqns == 1 .and. (cons_vars_wrt .or. prim_vars_wrt))) then + if (gamma_wrt .or. (model_eqns == model_eqns_gamma_law .and. (cons_vars_wrt .or. prim_vars_wrt))) then dbvars = dbvars + 1 end if if (heat_ratio_wrt) dbvars = dbvars + 1 - if (pi_inf_wrt .or. (model_eqns == 1 .and. (cons_vars_wrt .or. prim_vars_wrt))) then + if (pi_inf_wrt .or. (model_eqns == model_eqns_gamma_law .and. (cons_vars_wrt .or. prim_vars_wrt))) then dbvars = dbvars + 1 end if diff --git a/src/post_process/m_derived_variables.fpp b/src/post_process/m_derived_variables.fpp index e70a117fa4..4145cab1a1 100644 --- a/src/post_process/m_derived_variables.fpp +++ b/src/post_process/m_derived_variables.fpp @@ -11,6 +11,7 @@ module m_derived_variables use m_mpi_proxy use m_helper_basic use m_variables_conversion + use m_constants, only: model_eqns_gamma_law implicit none @@ -488,7 +489,7 @@ contains ! model, the amplitude of the exponential's inside is also modulated with respect to the identity of the fluid in which the ! function is evaluated. For more information, refer to Marquina and Mulet (2003). - if (model_eqns == 1) then ! Gamma/pi_inf model + if (model_eqns == model_eqns_gamma_law) then ! Gamma/pi_inf model q_sf = -gm_rho_sf/gm_rho_max(1) else ! Volume fraction model do l = -offset_z%beg, p + offset_z%end diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index b9673f354c..82869f7709 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -14,6 +14,7 @@ module m_global_parameters use m_derived_types use m_helper_basic use m_thermochem, only: num_species, species_names + use m_constants, only: model_eqns_gamma_law, model_eqns_5eq, model_eqns_6eq, model_eqns_4eq implicit none @@ -368,7 +369,7 @@ contains if (n == 0) m_root = m_glb ! Gamma/Pi_inf Model - if (model_eqns == 1) then + if (model_eqns == model_eqns_gamma_law) then ! Setting number of fluids num_fluids = 1 @@ -386,7 +387,7 @@ contains sys_size = eqn_idx%adv%end ! Volume Fraction Model (5-equation model) - else if (model_eqns == 2) then + else if (model_eqns == model_eqns_5eq) then ! Annotating structure of the state and flux vectors belonging to the system of equations defined by the selected number ! of spatial dimensions and the volume fraction model eqn_idx%cont%beg = 1 @@ -485,7 +486,7 @@ contains end if ! Volume Fraction Model (6-equation model) - else if (model_eqns == 3) then + else if (model_eqns == model_eqns_6eq) then ! Annotating structure of the state and flux vectors belonging to the system of equations defined by the selected number ! of spatial dimensions and the volume fraction model eqn_idx%cont%beg = 1 @@ -499,7 +500,7 @@ contains eqn_idx%int_en%end = eqn_idx%adv%end + num_fluids sys_size = eqn_idx%int_en%end eqn_idx%alf = 1 ! dummy, cannot actually have a void fraction - else if (model_eqns == 4) then + else if (model_eqns == model_eqns_4eq) then eqn_idx%cont%beg = 1 ! one continuity equation eqn_idx%cont%end = 1 ! num_fluids eqn_idx%mom%beg = eqn_idx%cont%end + 1 ! one momentum equation in each @@ -552,7 +553,7 @@ contains end if end if - if (model_eqns == 2 .or. model_eqns == 3) then + if (model_eqns == model_eqns_5eq .or. model_eqns == model_eqns_6eq) then if (hypoelasticity .or. hyperelasticity) then elasticity = .true. eqn_idx%stress%beg = sys_size + 1 diff --git a/src/post_process/m_start_up.fpp b/src/post_process/m_start_up.fpp index 708234797b..9d0ad71c88 100644 --- a/src/post_process/m_start_up.fpp +++ b/src/post_process/m_start_up.fpp @@ -25,6 +25,7 @@ module m_start_up use m_checker use m_thermochem, only: num_species, species_names use m_finite_differences + use m_constants, only: model_eqns_gamma_law, model_eqns_5eq, model_eqns_6eq, model_eqns_4eq use m_chemistry #ifdef MFC_MPI @@ -224,11 +225,11 @@ contains call s_compute_finite_difference_coefficients(p, z_cc, fd_coeff_z, buff_size, fd_number, fd_order, offset_z) end if - if ((model_eqns == 2) .or. (model_eqns == 3) .or. (model_eqns == 4)) then + if ((model_eqns == model_eqns_5eq) .or. (model_eqns == model_eqns_6eq) .or. (model_eqns == model_eqns_4eq)) then do i = 1, num_fluids if (alpha_rho_wrt(i) .or. (cons_vars_wrt .or. prim_vars_wrt)) then q_sf(:,:,:) = q_cons_vf(i)%sf(x_beg:x_end,y_beg:y_end,z_beg:z_end) - if (model_eqns /= 4) then + if (model_eqns /= model_eqns_4eq) then write (varname, '(A,I0)') 'alpha_rho', i else write (varname, '(A,I0)') 'rho', i @@ -240,7 +241,8 @@ contains end do end if - if ((rho_wrt .or. (model_eqns == 1 .and. (cons_vars_wrt .or. prim_vars_wrt))) .and. (.not. relativity)) then + if ((rho_wrt .or. (model_eqns == model_eqns_gamma_law .and. (cons_vars_wrt .or. prim_vars_wrt))) .and. (.not. relativity)) & + & then q_sf(:,:,:) = rho_sf(x_beg:x_end,y_beg:y_end,z_beg:z_end) write (varname, '(A)') 'rho' call s_write_variable_to_formatted_database_file(varname, t_step) @@ -324,7 +326,7 @@ contains varname(:) = ' ' end if - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then do i = 1, num_fluids if (alpha_rho_e_wrt(i) .or. cons_vars_wrt) then q_sf = q_cons_vf(i + eqn_idx%int_en%beg - 1)%sf(x_beg:x_end,y_beg:y_end,z_beg:z_end) @@ -515,7 +517,7 @@ contains varname(:) = ' ' end if - if (((model_eqns == 2) .and. (bubbles_euler .neqv. .true.)) .or. (model_eqns == 3)) then + if (((model_eqns == model_eqns_5eq) .and. (bubbles_euler .neqv. .true.)) .or. (model_eqns == model_eqns_6eq)) then do i = 1, num_fluids - 1 if (alpha_wrt(i) .or. (cons_vars_wrt .or. prim_vars_wrt)) then q_sf(:,:,:) = q_cons_vf(i + eqn_idx%E)%sf(x_beg:x_end,y_beg:y_end,z_beg:z_end) @@ -548,7 +550,7 @@ contains end if end if - if (gamma_wrt .or. (model_eqns == 1 .and. (cons_vars_wrt .or. prim_vars_wrt))) then + if (gamma_wrt .or. (model_eqns == model_eqns_gamma_law .and. (cons_vars_wrt .or. prim_vars_wrt))) then q_sf(:,:,:) = gamma_sf(x_beg:x_end,y_beg:y_end,z_beg:z_end) write (varname, '(A)') 'gamma' call s_write_variable_to_formatted_database_file(varname, t_step) @@ -565,7 +567,7 @@ contains varname(:) = ' ' end if - if (pi_inf_wrt .or. (model_eqns == 1 .and. (cons_vars_wrt .or. prim_vars_wrt))) then + if (pi_inf_wrt .or. (model_eqns == model_eqns_gamma_law .and. (cons_vars_wrt .or. prim_vars_wrt))) then q_sf(:,:,:) = pi_inf_sf(x_beg:x_end,y_beg:y_end,z_beg:z_end) write (varname, '(A)') 'pi_inf' call s_write_variable_to_formatted_database_file(varname, t_step) diff --git a/src/pre_process/m_assign_variables.fpp b/src/pre_process/m_assign_variables.fpp index 667e360079..1325eaaf63 100644 --- a/src/pre_process/m_assign_variables.fpp +++ b/src/pre_process/m_assign_variables.fpp @@ -13,6 +13,7 @@ module m_assign_variables use m_variables_conversion use m_helper_basic use m_thermochem, only: num_species, gas_constant, get_mixture_molecular_weight + use m_constants, only: model_eqns_gamma_law, model_eqns_6eq, model_eqns_4eq implicit none @@ -60,7 +61,7 @@ contains ! Select procedure pointer based on multicomponent flow model - if (model_eqns == 1) then ! Gamma/pi_inf model + if (model_eqns == model_eqns_gamma_law) then ! Gamma/pi_inf model s_assign_patch_primitive_variables => s_assign_patch_mixture_primitive_variables else ! Volume fraction model s_assign_patch_primitive_variables => s_assign_patch_species_primitive_variables @@ -275,7 +276,7 @@ contains end do end if - if (model_eqns /= 4) then + if (model_eqns /= model_eqns_4eq) then do i = 1, eqn_idx%cont%end q_prim_vf(i)%sf(j, k, l) = patch_icpp(patch_id)%alpha_rho(i) end do @@ -284,7 +285,7 @@ contains call s_convert_to_mixture_variables(q_prim_vf, j, k, l, patch_icpp(patch_id)%rho, patch_icpp(patch_id)%gamma, & & patch_icpp(patch_id)%pi_inf, patch_icpp(patch_id)%qv) - if (model_eqns /= 4) then + if (model_eqns /= model_eqns_4eq) then do i = 1, eqn_idx%cont%end q_prim_vf(i)%sf(j, k, l) = patch_icpp(smooth_patch_id)%alpha_rho(i) end do @@ -416,7 +417,7 @@ contains end do end if - if (model_eqns /= 4) then + if (model_eqns /= model_eqns_4eq) then ! mixture density is an input do i = 1, eqn_idx%cont%end q_prim_vf(i)%sf(j, k, l) = eta*patch_icpp(patch_id)%alpha_rho(i) + (1._wp - eta)*orig_prim_vf(i) @@ -469,7 +470,7 @@ contains end if ! Set partial pressures to mixture pressure for the 6-eqn model - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then do i = eqn_idx%int_en%beg, eqn_idx%int_en%end q_prim_vf(i)%sf(j, k, l) = q_prim_vf(eqn_idx%E)%sf(j, k, l) end do diff --git a/src/pre_process/m_check_patches.fpp b/src/pre_process/m_check_patches.fpp index ddad7e5323..6c0c86eba5 100644 --- a/src/pre_process/m_check_patches.fpp +++ b/src/pre_process/m_check_patches.fpp @@ -22,6 +22,7 @@ module m_check_patches use m_compile_specific use m_helper_basic use m_helper + use m_constants, only: model_eqns_gamma_law, model_eqns_5eq implicit none @@ -472,15 +473,15 @@ contains @:PROHIBIT(p > 0 .and. f_is_default(patch_icpp(patch_id)%vel(3)), "Patch "//trim(iStr)//": vel(3) must be set when p > 0") @:PROHIBIT(mhd .and. (f_is_default(patch_icpp(patch_id)%vel(2)) .or. f_is_default(patch_icpp(patch_id)%vel(3))), & & "Patch " // trim(iStr) // ": All velocities (vel(1:3)) must be set when mhd = true") - @:PROHIBIT(model_eqns == 1 .and. patch_icpp(patch_id)%rho <= 0._wp, & + @:PROHIBIT(model_eqns == model_eqns_gamma_law .and. patch_icpp(patch_id)%rho <= 0._wp, & & "Patch " // trim(iStr) // ": rho must be greater than zero when model_eqns = 1") - @:PROHIBIT(model_eqns == 1 .and. patch_icpp(patch_id)%gamma <= 0._wp, & + @:PROHIBIT(model_eqns == model_eqns_gamma_law .and. patch_icpp(patch_id)%gamma <= 0._wp, & & "Patch " // trim(iStr) // ": gamma must be greater than zero when model_eqns = 1") - @:PROHIBIT(model_eqns == 1 .and. patch_icpp(patch_id)%pi_inf < 0._wp, & + @:PROHIBIT(model_eqns == model_eqns_gamma_law .and. patch_icpp(patch_id)%pi_inf < 0._wp, & & "Patch " // trim(iStr) // ": pi_inf must be greater than or equal to zero when model_eqns = 1") @:PROHIBIT(patch_icpp(patch_id)%geometry == 5 .and. patch_icpp(patch_id)%pi_inf > 0, & & "Patch " // trim(iStr) // ": pi_inf must be less than or equal to zero when geometry = 5") - @:PROHIBIT(model_eqns == 2 .and. any(patch_icpp(patch_id)%alpha_rho(1:num_fluids) < 0._wp), & + @:PROHIBIT(model_eqns == model_eqns_5eq .and. any(patch_icpp(patch_id)%alpha_rho(1:num_fluids) < 0._wp), & & "Patch " // trim(iStr) & & // ": alpha_rho(1:num_fluids) must be greater than or equal to zero when model_eqns = 2") @@ -493,7 +494,7 @@ contains @:PROHIBIT(mhd .and. n > 0 .and. .not. is_set_B(1), "Bx must be set in 2D/3D MHD simulations") @:PROHIBIT(mhd .and. .not. (is_set_B(2) .and. is_set_B(3)), "By and Bz must be set in all MHD simulations") - if (model_eqns == 2 .and. num_fluids < num_fluids_max) then + if (model_eqns == model_eqns_5eq .and. num_fluids < num_fluids_max) then @:PROHIBIT(.not. f_all_default(patch_icpp(patch_id)%alpha_rho(num_fluids + 1:)), & & "Patch " // trim(iStr) // ": alpha_rho(i) must not be set for i > num_fluids") @:PROHIBIT(.not. f_all_default(patch_icpp(patch_id)%alpha(num_fluids + 1:)), & diff --git a/src/pre_process/m_data_output.fpp b/src/pre_process/m_data_output.fpp index e8583242ad..9d58377214 100644 --- a/src/pre_process/m_data_output.fpp +++ b/src/pre_process/m_data_output.fpp @@ -21,6 +21,7 @@ module m_data_output use m_boundary_conditions use m_thermochem, only: species_names use m_helper + use m_constants, only: model_eqns_5eq implicit none @@ -162,7 +163,7 @@ contains if (cfl_dt) t_step = n_start if (n == 0 .and. p == 0) then - if (model_eqns == 2) then + if (model_eqns == model_eqns_5eq) then do i = 1, sys_size write (file_loc, '(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) // '/prim.', i, '.', proc_rank, '.', t_step, '.dat' diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index bd28e73326..04ddaf5d52 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -14,6 +14,7 @@ module m_global_parameters use m_derived_types ! Definitions of the derived types use m_helper_basic ! Functions to compare floating point numbers use m_thermochem, only: num_species + use m_constants, only: model_eqns_gamma_law, model_eqns_5eq, model_eqns_6eq, model_eqns_4eq implicit none @@ -465,7 +466,7 @@ contains ! choice of the equations of motion ! Gamma/Pi_inf Model - if (model_eqns == 1) then + if (model_eqns == model_eqns_gamma_law) then ! Setting number of fluids num_fluids = 1 @@ -483,7 +484,7 @@ contains sys_size = eqn_idx%adv%end ! Volume Fraction Model (5-equation model) - else if (model_eqns == 2) then + else if (model_eqns == model_eqns_5eq) then ! Annotating structure of the state and flux vectors belonging to the system of equations defined by the selected number ! of spatial dimensions and the volume fraction model eqn_idx%cont%beg = 1 @@ -583,7 +584,7 @@ contains end if ! Volume Fraction Model (6-equation model) - else if (model_eqns == 3) then + else if (model_eqns == model_eqns_6eq) then ! Annotating structure of the state and flux vectors belonging to the system of equations defined by the selected number ! of spatial dimensions and the volume fraction model eqn_idx%cont%beg = 1 @@ -596,7 +597,7 @@ contains eqn_idx%int_en%beg = eqn_idx%adv%end + 1 eqn_idx%int_en%end = eqn_idx%adv%end + num_fluids sys_size = eqn_idx%int_en%end - else if (model_eqns == 4) then + else if (model_eqns == model_eqns_4eq) then ! 4 equation model with subgrid bubbles_euler eqn_idx%cont%beg = 1 ! one continuity equation eqn_idx%cont%end = 1 ! num_fluids @@ -650,7 +651,7 @@ contains end if end if - if (model_eqns == 2 .or. model_eqns == 3) then + if (model_eqns == model_eqns_5eq .or. model_eqns == model_eqns_6eq) then if (hypoelasticity .or. hyperelasticity) then elasticity = .true. eqn_idx%stress%beg = sys_size + 1 diff --git a/src/pre_process/m_icpp_patches.fpp b/src/pre_process/m_icpp_patches.fpp index 42e9332c53..6805c261aa 100644 --- a/src/pre_process/m_icpp_patches.fpp +++ b/src/pre_process/m_icpp_patches.fpp @@ -15,7 +15,7 @@ module m_icpp_patches use m_model ! Subroutine(s) related to STL files use m_derived_types ! Definitions of the derived types use m_global_parameters - use m_constants, only: max_2d_fourier_modes, max_sph_harm_degree, small_radius + use m_constants, only: max_2d_fourier_modes, max_sph_harm_degree, small_radius, model_eqns_4eq use m_helper_basic use m_helper use m_mpi_common @@ -633,7 +633,7 @@ contains @:Hardcoded2D() end if - if ((q_prim_vf(1)%sf(i, j, 0) < 1.e-10) .and. (model_eqns == 4)) then + if ((q_prim_vf(1)%sf(i, j, 0) < 1.e-10) .and. (model_eqns == model_eqns_4eq)) then ! zero density, reassign according to Tait EOS q_prim_vf(1)%sf(i, j, 0) = (((q_prim_vf(eqn_idx%E)%sf(i, j, & & 0) + pi_inf)/(pref + pi_inf))**(1._wp/lit_gamma))*rhoref*(1._wp & diff --git a/src/simulation/include/inline_riemann.fpp b/src/simulation/include/inline_riemann.fpp index 0be830442e..70734870ad 100644 --- a/src/simulation/include/inline_riemann.fpp +++ b/src/simulation/include/inline_riemann.fpp @@ -69,14 +69,14 @@ #:enddef compute_average_state #:def compute_low_Mach_correction() - if (riemann_solver == 1 .or. riemann_solver == 5) then + if (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_lax_friedrichs) then zcoef = min(1._wp, max(vel_L_rms**5.e-1_wp/c_L, vel_R_rms**5.e-1_wp/c_R)) pcorr = 0._wp if (low_Mach == 1) then pcorr = -(s_P - s_M)*(rho_L + rho_R)/8._wp*(zcoef - 1._wp) end if - else if (riemann_solver == 2) then + else if (riemann_solver == riemann_solver_hllc) then zcoef = min(1._wp, max(vel_L_rms**5.e-1_wp/c_L, vel_R_rms**5.e-1_wp/c_R)) pcorr = 0._wp diff --git a/src/simulation/m_acoustic_src.fpp b/src/simulation/m_acoustic_src.fpp index 4de261864d..f007136f70 100644 --- a/src/simulation/m_acoustic_src.fpp +++ b/src/simulation/m_acoustic_src.fpp @@ -262,7 +262,8 @@ contains if (dipole(ai)) then ! Double amplitude & No momentum source term (only works for Planar) mass_src(j, k, l) = mass_src(j, k, l) + 2._wp*mom_src_diff/c - if (model_eqns /= 4) E_src(j, k, l) = E_src(j, k, l) + 2._wp*mom_src_diff*c/(small_gamma - 1._wp) + if (model_eqns /= model_eqns_4eq) E_src(j, k, l) = E_src(j, k, & + & l) + 2._wp*mom_src_diff*c/(small_gamma - 1._wp) cycle end if @@ -300,7 +301,7 @@ contains mass_src(j, k, l) = mass_src(j, k, l) + mass_src_diff ! Update energy source term - if (model_eqns /= 4) then + if (model_eqns /= model_eqns_4eq) then E_src(j, k, l) = E_src(j, k, l) + mass_src_diff*c**2._wp/(small_gamma - 1._wp) end if end do diff --git a/src/simulation/m_bubbles_EL.fpp b/src/simulation/m_bubbles_EL.fpp index b44eb617b1..ab6cc6c461 100644 --- a/src/simulation/m_bubbles_EL.fpp +++ b/src/simulation/m_bubbles_EL.fpp @@ -17,6 +17,7 @@ module m_bubbles_EL use m_helper_basic use m_sim_helpers use m_helper + use m_constants, only: time_stepper_rk1, time_stepper_rk2, time_stepper_rk3 implicit none @@ -969,7 +970,7 @@ contains integer, intent(in) :: stage integer :: k - if (time_stepper == 1) then ! 1st order TVD RK + if (time_stepper == time_stepper_rk1) then ! 1st order TVD RK $:GPU_PARALLEL_LOOP(private='[k]') do k = 1, nBubs ! u{1} = u{n} + dt * RHS{n} @@ -990,7 +991,7 @@ contains $:GPU_UPDATE(host='[gas_p, gas_mv, intfc_rad, intfc_vel]') call s_write_lag_particles(mytime) end if - else if (time_stepper == 2) then ! 2nd order TVD RK + else if (time_stepper == time_stepper_rk2) then ! 2nd order TVD RK if (stage == 1) then $:GPU_PARALLEL_LOOP(private='[k]') do k = 1, nBubs @@ -1025,7 +1026,7 @@ contains call s_write_lag_particles(mytime) end if end if - else if (time_stepper == 3) then ! 3rd order TVD RK + else if (time_stepper == time_stepper_rk3) then ! 3rd order TVD RK if (stage == 1) then $:GPU_PARALLEL_LOOP(private='[k]') do k = 1, nBubs diff --git a/src/simulation/m_cbc.fpp b/src/simulation/m_cbc.fpp index 6f1b041d49..7241c4ea6b 100644 --- a/src/simulation/m_cbc.fpp +++ b/src/simulation/m_cbc.fpp @@ -12,6 +12,7 @@ module m_cbc use m_global_parameters use m_variables_conversion use m_compute_cbc + use m_constants, only: riemann_solver_hll, model_eqns_gamma_law use m_thermochem, only: get_mixture_energy_mass, get_mixture_specific_heat_cv_mass, get_mixture_specific_heat_cp_mass, & & gas_constant, get_mixture_molecular_weight, get_species_enthalpies_rt, molecular_weights, get_species_specific_heats_r, & & get_mole_fractions, get_species_specific_heats_r @@ -832,7 +833,7 @@ contains drho_dt = 0._wp; dgamma_dt = 0._wp; dpi_inf_dt = 0._wp; dqv_dt = 0._wp - if (model_eqns == 1) then + if (model_eqns == model_eqns_gamma_law) then drho_dt = dalpha_rho_dt(1) dgamma_dt = dadv_dt(1) #:if not MFC_CASE_OPTIMIZATION or num_fluids > 1 @@ -884,7 +885,7 @@ contains & + rho*vel_dv_dt_sum + 5.e-1_wp*drho_dt*vel_K_sum) end if - if (riemann_solver == 1) then + if (riemann_solver == riemann_solver_hll) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end flux_rs${XYZ}$_vf_l(-1, k, r, i) = 0._wp @@ -998,7 +999,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (riemann_solver == 1) then + if (riemann_solver == riemann_solver_hll) then $:GPU_PARALLEL_LOOP(private='[i, j, k, r]', collapse=4) do i = eqn_idx%adv%beg, eqn_idx%adv%end do r = is3%beg, is3%end @@ -1072,7 +1073,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (riemann_solver == 1) then + if (riemann_solver == riemann_solver_hll) then $:GPU_PARALLEL_LOOP(private='[i, j, k, r]', collapse=4) do i = eqn_idx%adv%beg, eqn_idx%adv%end do r = is3%beg, is3%end @@ -1146,7 +1147,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (riemann_solver == 1) then + if (riemann_solver == riemann_solver_hll) then $:GPU_PARALLEL_LOOP(private='[i, j, k, r]', collapse=4) do i = eqn_idx%adv%beg, eqn_idx%adv%end do r = is3%beg, is3%end @@ -1211,7 +1212,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (riemann_solver == 1) then + if (riemann_solver == riemann_solver_hll) then $:GPU_PARALLEL_LOOP(private='[i, j, k, r]', collapse=4) do i = eqn_idx%adv%beg, eqn_idx%adv%end do r = is3%beg, is3%end @@ -1261,7 +1262,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (riemann_solver == 1) then + if (riemann_solver == riemann_solver_hll) then $:GPU_PARALLEL_LOOP(private='[i, j, k, r]', collapse=4) do i = eqn_idx%adv%beg, eqn_idx%adv%end do r = is3%beg, is3%end @@ -1312,7 +1313,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (riemann_solver == 1) then + if (riemann_solver == riemann_solver_hll) then $:GPU_PARALLEL_LOOP(private='[i, j, k, r]', collapse=4) do i = eqn_idx%adv%beg, eqn_idx%adv%end do r = is3%beg, is3%end diff --git a/src/simulation/m_data_output.fpp b/src/simulation/m_data_output.fpp index babd1eb665..3cc8d6e51b 100644 --- a/src/simulation/m_data_output.fpp +++ b/src/simulation/m_data_output.fpp @@ -19,6 +19,7 @@ module m_data_output use m_delay_file_access use m_ibm use m_boundary_common + use m_constants, only: model_eqns_5eq, model_eqns_4eq implicit none @@ -393,7 +394,7 @@ contains end if if (n == 0 .and. p == 0) then - if (model_eqns == 2 .and. (.not. igr)) then + if (model_eqns == model_eqns_5eq .and. (.not. igr)) then do i = 1, sys_size write (file_path, '(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) // '/prim.', i, '.', proc_rank, '.', t_step, '.dat' @@ -1217,7 +1218,7 @@ contains & dyn_p, pi_inf, gamma, rho, qv, rhoYks, pres, T) end if - if (model_eqns == 4) then + if (model_eqns == model_eqns_4eq) then lit_gamma = gammas(1) else if (elasticity) then tau_e(1) = q_cons_vf(eqn_idx%stress%end)%sf(j - 2, k, l)/rho @@ -1321,7 +1322,7 @@ contains & k - 2, l), dyn_p, pi_inf, gamma, rho, qv, rhoYks, pres, T) end if - if (model_eqns == 4) then + if (model_eqns == model_eqns_4eq) then lit_gamma = gs_min(1) else if (elasticity) then do s = 1, 3 diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index 1bd6ea26f8..77eb90a31d 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -14,6 +14,7 @@ module m_global_parameters use m_derived_types use m_helper_basic + use m_constants, only: model_eqns_gamma_law, model_eqns_5eq, model_eqns_6eq, model_eqns_4eq ! $:USE_GPU_MODULE() implicit none @@ -787,7 +788,7 @@ contains Re_size_max = 0 ! Gamma/Pi_inf Model - if (model_eqns == 1) then + if (model_eqns == model_eqns_gamma_law) then ! Annotating structure of the state and flux vectors belonging to the system of equations defined by the selected number ! of spatial dimensions and the gamma/pi_inf model eqn_idx%cont%beg = 1 @@ -805,7 +806,7 @@ contains else ! Annotating structure of the state and flux vectors belonging to the system of equations defined by the selected number ! of spatial dimensions and the volume fraction model - if (model_eqns == 2) then + if (model_eqns == model_eqns_5eq) then eqn_idx%cont%beg = 1 eqn_idx%cont%end = num_fluids eqn_idx%mom%beg = eqn_idx%cont%end + 1 @@ -896,7 +897,7 @@ contains end if sys_size = eqn_idx%B%end end if - else if (model_eqns == 3) then + else if (model_eqns == model_eqns_6eq) then eqn_idx%cont%beg = 1 eqn_idx%cont%end = num_fluids eqn_idx%mom%beg = eqn_idx%cont%end + 1 @@ -908,7 +909,7 @@ contains eqn_idx%int_en%beg = eqn_idx%adv%end + 1 eqn_idx%int_en%end = eqn_idx%adv%end + num_fluids sys_size = eqn_idx%int_en%end - else if (model_eqns == 4) then + else if (model_eqns == model_eqns_4eq) then eqn_idx%cont%beg = 1 ! one continuity equation eqn_idx%cont%end = 1 ! num_fluids eqn_idx%mom%beg = eqn_idx%cont%end + 1 ! one momentum equation in each direction @@ -982,7 +983,7 @@ contains end if end if - if (model_eqns == 2 .or. model_eqns == 3) then + if (model_eqns == model_eqns_5eq .or. model_eqns == model_eqns_6eq) then if (hypoelasticity .or. hyperelasticity) then elasticity = .true. eqn_idx%stress%beg = sys_size + 1 diff --git a/src/simulation/m_ibm.fpp b/src/simulation/m_ibm.fpp index 253123184d..99aeb1e382 100644 --- a/src/simulation/m_ibm.fpp +++ b/src/simulation/m_ibm.fpp @@ -268,7 +268,7 @@ contains end do end if - if (model_eqns /= 4) then + if (model_eqns /= model_eqns_4eq) then ! If in simulation, use acc mixture subroutines if (elasticity) then call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv_K, alpha_IP, alpha_rho_IP, Re_K, & @@ -378,7 +378,7 @@ contains end if end if - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then $:GPU_LOOP(parallelism='[seq]') do q = eqn_idx%int_en%beg, eqn_idx%int_en%end q_cons_vf(q)%sf(j, k, & diff --git a/src/simulation/m_pressure_relaxation.fpp b/src/simulation/m_pressure_relaxation.fpp index 8ca939de7d..8c16757450 100644 --- a/src/simulation/m_pressure_relaxation.fpp +++ b/src/simulation/m_pressure_relaxation.fpp @@ -11,6 +11,7 @@ module m_pressure_relaxation use m_derived_types use m_global_parameters + use m_constants, only: model_eqns_5eq implicit none @@ -237,14 +238,14 @@ contains pi_inf = 0._wp if (bubbles_euler) then - if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then + if (mpp_lim .and. (model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids rho = rho + alpha_rho(i) gamma = gamma + alpha(i)*gammas(i) pi_inf = pi_inf + alpha(i)*pi_infs(i) end do - else if ((model_eqns == 2) .and. (num_fluids > 2)) then + else if ((model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - 1 rho = rho + alpha_rho(i) diff --git a/src/simulation/m_rhs.fpp b/src/simulation/m_rhs.fpp index 6975729c3f..6ba0f67dbd 100644 --- a/src/simulation/m_rhs.fpp +++ b/src/simulation/m_rhs.fpp @@ -14,6 +14,7 @@ module m_rhs use m_mpi_proxy use m_variables_conversion use m_weno + use m_constants, only: riemann_solver_hll, riemann_solver_hlld, model_eqns_6eq use m_muscl use m_riemann_solvers use m_cbc @@ -211,7 +212,7 @@ contains @:ALLOCATE(flux_src_n(i)%vf(eqn_idx%adv%beg)%sf(idwbuff(1)%beg:idwbuff(1)%end, idwbuff(2)%beg:idwbuff(2)%end, & & idwbuff(3)%beg:idwbuff(3)%end)) - if (riemann_solver == 1 .or. riemann_solver == 4) then + if (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_hlld) then do l = eqn_idx%adv%beg + 1, eqn_idx%adv%end @:ALLOCATE(flux_src_n(i)%vf(l)%sf(idwbuff(1)%beg:idwbuff(1)%end, idwbuff(2)%beg:idwbuff(2)%end, & & idwbuff(3)%beg:idwbuff(3)%end)) @@ -239,7 +240,7 @@ contains @:ACC_SETUP_VFs(flux_src_n(i), flux_gsrc_n(i)) if (i == 1) then - if (riemann_solver /= 1) then + if (riemann_solver /= riemann_solver_hll) then do l = eqn_idx%adv%beg + 1, eqn_idx%adv%end flux_src_n(i)%vf(l)%sf => flux_src_n(i)%vf(eqn_idx%adv%beg)%sf $:GPU_ENTER_DATA(attach='[flux_src_n(i)%vf(l)%sf]') @@ -925,7 +926,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then $:GPU_PARALLEL_LOOP(collapse=4,private='[i_fluid_loop, k_loop, l_loop, q_loop, inv_ds, advected_qty_val, & & pressure_val, flux_face1, flux_face2]') do q_loop = 0, p @@ -971,7 +972,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then $:GPU_PARALLEL_LOOP(collapse=4,private='[i_fluid_loop, k, l, q, inv_ds, advected_qty_val, pressure_val, & & flux_face1, flux_face2]') do l = 0, p @@ -1069,7 +1070,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then $:GPU_PARALLEL_LOOP(collapse=4,private='[i_fluid_loop, k, l, q, inv_ds, advected_qty_val, pressure_val, & & flux_face1, flux_face2]') do k = 0, p @@ -1113,7 +1114,7 @@ contains select case (current_idir) case (1) ! x-direction - use_standard_riemann = (riemann_solver == 1 .or. riemann_solver == 4) + use_standard_riemann = (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_hlld) if (use_standard_riemann) then $:GPU_PARALLEL_LOOP(collapse=4,private='[j_adv, k_idx, l_idx, q_idx, local_inv_ds, local_term_coeff, & & local_flux1, local_flux2]') @@ -1181,7 +1182,7 @@ contains end if case (2) ! y-direction: loops q_idx (x), k_idx (y), l_idx (z); sf(q_idx, k_idx, l_idx); dy(k_idx); Kterm(q_idx,k_idx,l_idx) - use_standard_riemann = (riemann_solver == 1 .or. riemann_solver == 4) + use_standard_riemann = (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_hlld) if (use_standard_riemann) then $:GPU_PARALLEL_LOOP(collapse=4,private='[j_adv, k_idx, l_idx, q_idx, local_inv_ds, local_term_coeff, & & local_flux1, local_flux2]') @@ -1258,9 +1259,9 @@ contains case (3) ! z-direction: loops l_idx (x), q_idx (y), k_idx (z); sf(l_idx, q_idx, k_idx); dz(k_idx); Kterm(l_idx,q_idx,k_idx) if (grid_geometry == 3) then - use_standard_riemann = (riemann_solver == 1) + use_standard_riemann = (riemann_solver == riemann_solver_hll) else - use_standard_riemann = (riemann_solver == 1 .or. riemann_solver == 4) + use_standard_riemann = (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_hlld) end if if (use_standard_riemann) then @@ -1822,7 +1823,7 @@ contains @:DEALLOCATE(flux_src_n(i)%vf(eqn_idx%E)%sf) end if - if (riemann_solver == 1 .or. riemann_solver == 4) then + if (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_hlld) then do l = eqn_idx%adv%beg + 1, eqn_idx%adv%end @:DEALLOCATE(flux_src_n(i)%vf(l)%sf) end do diff --git a/src/simulation/m_riemann_solvers.fpp b/src/simulation/m_riemann_solvers.fpp index 0a8bc32212..3483df092e 100644 --- a/src/simulation/m_riemann_solvers.fpp +++ b/src/simulation/m_riemann_solvers.fpp @@ -15,6 +15,8 @@ module m_riemann_solvers use m_mpi_proxy use m_variables_conversion use m_bubbles + use m_constants, only: riemann_solver_hll, riemann_solver_hllc, riemann_solver_hlld, riemann_solver_lax_friedrichs, & + & model_eqns_5eq, model_eqns_6eq, model_eqns_4eq use m_bubbles_EE use m_surface_tension use m_helper_basic @@ -1777,7 +1779,7 @@ contains #:set SF = lambda offs: COORDS.format(STENCIL_IDX = SV + offs) if (norm_dir == ${NORM_DIR}$) then ! 6-EQUATION MODEL WITH HLLC HLLC star-state flux with contact wave speed s_S - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then ! 6-equation model (model_eqns=3): separate phasic internal energies $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, vel_L, vel_R, Re_L, Re_R, alpha_L, alpha_R, Ys_L, & & Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, Yi_avg, Phi_avg, h_iL, h_iR, & @@ -2192,7 +2194,7 @@ contains end do end do $:END_GPU_PARALLEL_LOOP() - else if (model_eqns == 4) then + else if (model_eqns == model_eqns_4eq) then ! 4-equation model (model_eqns=4): single pressure, velocity equilibrium $:GPU_PARALLEL_LOOP(collapse=3, private='[i, q, alpha_rho_L, alpha_rho_R, vel_L, vel_R, alpha_L, alpha_R, & & nbub_L, nbub_R, rho_L, rho_R, pres_L, pres_R, E_L, E_R, H_L, H_R, Cp_avg, Cv_avg, & @@ -2414,7 +2416,7 @@ contains end do end do $:END_GPU_PARALLEL_LOOP() - else if (model_eqns == 2 .and. bubbles_euler) then + else if (model_eqns == model_eqns_5eq .and. bubbles_euler) then ! 5-equation model with Euler-Euler bubble dynamics $:GPU_PARALLEL_LOOP(collapse=3, private='[i, q, R0_L, R0_R, V0_L, V0_R, P0_L, P0_R, pbw_L, pbw_R, vel_L, & & vel_R, rho_avg, alpha_L, alpha_R, h_avg, gamma_avg, Re_L, Re_R, pcorr, zcoef, rho_L, & @@ -4480,7 +4482,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (riemann_solver == 1 .or. riemann_solver == 4) then + if (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_hlld) then $:GPU_PARALLEL_LOOP(collapse=4) do i = eqn_idx%adv%beg + 1, eqn_idx%adv%end do l = is3%beg, is3%end @@ -4530,7 +4532,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (riemann_solver == 1 .or. riemann_solver == 4) then + if (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_hlld) then $:GPU_PARALLEL_LOOP(collapse=4) do i = eqn_idx%adv%beg + 1, eqn_idx%adv%end do j = is1%beg, is1%end @@ -4566,7 +4568,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (riemann_solver == 1 .or. riemann_solver == 4) then + if (riemann_solver == riemann_solver_hll .or. riemann_solver == riemann_solver_hlld) then $:GPU_PARALLEL_LOOP(collapse=4) do i = eqn_idx%adv%beg + 1, eqn_idx%adv%end do l = is3%beg, is3%end diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index bb5bdc05db..7a4a1a7df8 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -51,6 +51,7 @@ module m_start_up use m_body_forces use m_sim_helpers use m_igr + use m_constants, only: model_eqns_6eq, time_stepper_rk1, time_stepper_rk2, time_stepper_rk3 implicit none @@ -620,7 +621,7 @@ contains end if ! Total-variation-diminishing (TVD) Runge-Kutta (RK) time-steppers - if (any(time_stepper == (/1, 2, 3/))) then + if (any(time_stepper == (/time_stepper_rk1, time_stepper_rk2, time_stepper_rk3/))) then call s_tvd_rk(t_step, time_avg, time_stepper) end if @@ -710,7 +711,7 @@ contains stor = 1 - if (time_stepper /= 1) then + if (time_stepper /= time_stepper_rk1) then $:GPU_PARALLEL_LOOP(collapse=4, copyin='[idwbuff]') do i = 1, sys_size do l = idwbuff(3)%beg, idwbuff(3)%end @@ -869,7 +870,7 @@ contains call s_populate_grid_variables_buffers() - if (model_eqns == 3) call s_initialize_internal_energy_equations(q_cons_ts(1)%vf) + if (model_eqns == model_eqns_6eq) call s_initialize_internal_energy_equations(q_cons_ts(1)%vf) if (ib) then block type(ib_patch_parameters), allocatable :: particle_cloud_ibs(:) diff --git a/src/simulation/m_time_steppers.fpp b/src/simulation/m_time_steppers.fpp index 252301892a..9a59f955f2 100644 --- a/src/simulation/m_time_steppers.fpp +++ b/src/simulation/m_time_steppers.fpp @@ -26,6 +26,7 @@ module m_time_steppers use m_thermochem, only: num_species use m_body_forces use m_derived_variables + use m_constants, only: model_eqns_6eq, time_stepper_rk1, time_stepper_rk2, time_stepper_rk3 implicit none @@ -73,9 +74,9 @@ contains integer :: i, j !< Generic loop iterators ! Setting number of time-stages for selected time-stepping scheme - if (time_stepper == 1) then + if (time_stepper == time_stepper_rk1) then num_ts = 1 - else if (any(time_stepper == (/2, 3/))) then + else if (any(time_stepper == (/time_stepper_rk2, time_stepper_rk3/))) then num_ts = 2 end if @@ -278,7 +279,7 @@ contains @:ACC_SETUP_SFs(q_prim_vf(eqn_idx%psi)) end if - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then do i = eqn_idx%int_en%beg, eqn_idx%int_en%end @:ALLOCATE(q_prim_vf(i)%sf(idwbuff(1)%beg:idwbuff(1)%end, idwbuff(2)%beg:idwbuff(2)%end, & & idwbuff(3)%beg:idwbuff(3)%end)) @@ -422,9 +423,9 @@ contains end do end do - if (any(time_stepper == (/1, 2, 3/))) then + if (any(time_stepper == (/time_stepper_rk1, time_stepper_rk2, time_stepper_rk3/))) then ! temporary array index for TVD RK - if (time_stepper == 1) then + if (time_stepper == time_stepper_rk1) then stor = 1 else stor = 2 @@ -432,12 +433,12 @@ contains ! TVD RK coefficients @:ALLOCATE(rk_coef(time_stepper, 4)) - if (time_stepper == 1) then + if (time_stepper == time_stepper_rk1) then rk_coef(1,:) = (/1._wp, 0._wp, 1._wp, 1._wp/) - else if (time_stepper == 2) then + else if (time_stepper == time_stepper_rk2) then rk_coef(1,:) = (/1._wp, 0._wp, 1._wp, 1._wp/) rk_coef(2,:) = (/1._wp, 1._wp, 1._wp, 2._wp/) - else if (time_stepper == 3) then + else if (time_stepper == time_stepper_rk3) then rk_coef(1,:) = (/1._wp, 0._wp, 1._wp, 1._wp/) rk_coef(2,:) = (/1._wp, 3._wp, 1._wp, 4._wp/) rk_coef(3,:) = (/2._wp, 1._wp, 2._wp, 3._wp/) @@ -542,7 +543,7 @@ contains if (grid_geometry == 3) call s_apply_fourier_filter(q_cons_ts(1)%vf) - if (model_eqns == 3 .and. (.not. relax)) then + if (model_eqns == model_eqns_6eq .and. (.not. relax)) then call s_pressure_relaxation_procedure(q_cons_ts(1)%vf) end if @@ -942,7 +943,7 @@ contains end do end if - if (model_eqns == 3) then + if (model_eqns == model_eqns_6eq) then do i = eqn_idx%int_en%beg, eqn_idx%int_en%end @:DEALLOCATE(q_prim_vf(i)%sf) end do diff --git a/src/simulation/m_viscous.fpp b/src/simulation/m_viscous.fpp index 55cdcc343e..e689e90f48 100644 --- a/src/simulation/m_viscous.fpp +++ b/src/simulation/m_viscous.fpp @@ -13,6 +13,7 @@ module m_viscous use m_muscl use m_helper use m_finite_differences + use m_constants, only: model_eqns_5eq private; public s_get_viscous, s_compute_viscous_stress_cylindrical_boundary, s_initialize_viscous_module, & & s_reconstruct_cell_boundary_values_visc_deriv, s_finalize_viscous_module, s_compute_viscous_stress_tensor @@ -102,14 +103,14 @@ contains gamma_visc = 0._wp pi_inf_visc = 0._wp - if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then + if (mpp_lim .and. (model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids rho_visc = rho_visc + alpha_rho_visc(i) gamma_visc = gamma_visc + alpha_visc(i)*gammas(i) pi_inf_visc = pi_inf_visc + alpha_visc(i)*pi_infs(i) end do - else if ((model_eqns == 2) .and. (num_fluids > 2)) then + else if ((model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - 1 rho_visc = rho_visc + alpha_rho_visc(i) @@ -205,14 +206,14 @@ contains gamma_visc = 0._wp pi_inf_visc = 0._wp - if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then + if (mpp_lim .and. (model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids rho_visc = rho_visc + alpha_rho_visc(i) gamma_visc = gamma_visc + alpha_visc(i)*gammas(i) pi_inf_visc = pi_inf_visc + alpha_visc(i)*pi_infs(i) end do - else if ((model_eqns == 2) .and. (num_fluids > 2)) then + else if ((model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - 1 rho_visc = rho_visc + alpha_rho_visc(i) @@ -302,14 +303,14 @@ contains gamma_visc = 0._wp pi_inf_visc = 0._wp - if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then + if (mpp_lim .and. (model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids rho_visc = rho_visc + alpha_rho_visc(i) gamma_visc = gamma_visc + alpha_visc(i)*gammas(i) pi_inf_visc = pi_inf_visc + alpha_visc(i)*pi_infs(i) end do - else if ((model_eqns == 2) .and. (num_fluids > 2)) then + else if ((model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - 1 rho_visc = rho_visc + alpha_rho_visc(i) @@ -402,14 +403,14 @@ contains gamma_visc = 0._wp pi_inf_visc = 0._wp - if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then + if (mpp_lim .and. (model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids rho_visc = rho_visc + alpha_rho_visc(i) gamma_visc = gamma_visc + alpha_visc(i)*gammas(i) pi_inf_visc = pi_inf_visc + alpha_visc(i)*pi_infs(i) end do - else if ((model_eqns == 2) .and. (num_fluids > 2)) then + else if ((model_eqns == model_eqns_5eq) .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - 1 rho_visc = rho_visc + alpha_rho_visc(i) diff --git a/toolchain/mfc/analytic_expr.py b/toolchain/mfc/analytic_expr.py new file mode 100644 index 0000000000..6080135871 --- /dev/null +++ b/toolchain/mfc/analytic_expr.py @@ -0,0 +1,102 @@ +"""AST-based translation of analytic case expressions (Python syntax) to Fortran. + +Replaces the legacy regex token substitution: expressions are parsed, every +variable name is resolved through an explicit map, and anything unrecognized +is a load-time error instead of silently-wrong generated Fortran. +""" + +import ast +from typing import Dict + +# Fortran intrinsics permitted in analytic expressions; emitted unchanged. +INTRINSICS = { + "sin", + "cos", + "tan", + "asin", + "acos", + "atan", + "atan2", + "sinh", + "cosh", + "tanh", + "exp", + "log", + "log10", + "sqrt", + "abs", + "min", + "max", + "mod", + "sign", +} + +# Names with no mapping that resolve on the Fortran side (m_constants). +PASSTHROUGH = {"pi"} + +_BINOPS = {ast.Add: "+", ast.Sub: "-", ast.Mult: "*", ast.Div: "/", ast.Pow: "**"} +# Precedence: additive < multiplicative < unary minus < power. +_PREC = {ast.Add: 1, ast.Sub: 1, ast.Mult: 2, ast.Div: 2, ast.Pow: 4} +_UNARY_PREC = 3 + + +class AnalyticExprError(Exception): + """Raised when an analytic expression cannot be translated to Fortran.""" + + +def fortranize_expr(expr: str, var_map: Dict[str, str]) -> str: + """Translate a Python-syntax analytic expression into a Fortran expression. + + var_map maps case-file variable names (x, lx, r, ...) to the Fortran + entities they stand for. Intrinsics and PASSTHROUGH names are kept as-is. + """ + try: + tree = ast.parse(expr, mode="eval") + except SyntaxError as e: + raise AnalyticExprError(f"invalid analytic expression {expr!r}: {e.msg}") from e + return _emit(tree.body, expr, var_map, 0) + + +def _emit(node, expr: str, var_map: Dict[str, str], parent_prec: int) -> str: + if isinstance(node, ast.BinOp): + op = type(node.op) + if op not in _BINOPS: + raise AnalyticExprError(f"unsupported operator in {expr!r}") + prec = _PREC[op] + if op is ast.Pow: # right-associative + left = _emit(node.left, expr, var_map, prec + 1) + right = _emit(node.right, expr, var_map, prec) + else: + left = _emit(node.left, expr, var_map, prec) + right = _emit(node.right, expr, var_map, prec + 1) + s = f"{left} {_BINOPS[op]} {right}" + return f"({s})" if prec < parent_prec else s + if isinstance(node, ast.UnaryOp): + if not isinstance(node.op, (ast.USub, ast.UAdd)): + raise AnalyticExprError(f"unsupported operator in {expr!r}") + sign = "-" if isinstance(node.op, ast.USub) else "+" + s = f"{sign}{_emit(node.operand, expr, var_map, _UNARY_PREC)}" + # Fortran forbids an operator directly following another operator + # (`y * -x` is invalid), so parenthesize inside any binary context. + return f"({s})" if parent_prec > 1 else s + if isinstance(node, ast.Call): + if not isinstance(node.func, ast.Name) or node.func.id not in INTRINSICS or node.keywords: + name = node.func.id if isinstance(node.func, ast.Name) else ast.unparse(node.func) + raise AnalyticExprError(f"unknown function '{name}' in {expr!r}. Allowed: {', '.join(sorted(INTRINSICS))}") + args = ", ".join(_emit(a, expr, var_map, 0) for a in node.args) + return f"{node.func.id}({args})" + if isinstance(node, ast.Name): + if node.id in var_map: + return var_map[node.id] + if node.id in PASSTHROUGH: + return node.id + valid = ", ".join(sorted(var_map) + sorted(PASSTHROUGH)) + raise AnalyticExprError(f"unknown variable '{node.id}' in {expr!r}. Available: {valid} (plus intrinsics)") + if isinstance(node, ast.Constant): + if isinstance(node.value, (int, float)) and not isinstance(node.value, bool): + s = repr(node.value) + if isinstance(node.value, float) and ("e" in s or "E" in s): + s += "_wp" # exponent form defaults to single precision in Fortran + return s + raise AnalyticExprError(f"unsupported literal {node.value!r} in {expr!r}") + raise AnalyticExprError(f"unsupported syntax in {expr!r}: {type(node).__name__}") diff --git a/toolchain/mfc/case.py b/toolchain/mfc/case.py index 7aed9212dc..44a1da570e 100644 --- a/toolchain/mfc/case.py +++ b/toolchain/mfc/case.py @@ -8,6 +8,7 @@ import fastjsonschema from . import common +from .analytic_expr import AnalyticExprError, fortranize_expr from .printer import cons from .run import case_dicts from .state import ARG @@ -41,6 +42,27 @@ class Case: def __init__(self, params: dict) -> None: self.params = copy.deepcopy(params) + for key, val in self.params.items(): + self.params[key] = self.__normalize_named_value(key, val) + + @staticmethod + def __normalize_named_value(key: str, val): + """Convert a named enumerated value (e.g. "hllc") to its integer code.""" + from .params.errors import constraint_error + from .params.registry import REGISTRY + + if not isinstance(val, str) or common.is_number(val): + return val + param_def = REGISTRY.get_param_def(key) + if param_def is None or not param_def.constraints: + return val + names = param_def.constraints.get("names") + if not names: + return val + if val in names: + return names[val] + shown = ", ".join(f"{v} ({n})" for n, v in sorted(names.items(), key=lambda kv: kv[1])) + raise common.MFCException(constraint_error(key, "choices", shown, val)) def get_parameters(self) -> dict: return self.params @@ -185,30 +207,25 @@ def __get_analytic_ic_fpp(self, print: bool) -> str: if ptype not in DATA["ptypes"]: raise common.MFCException(f"Patch #{pid} of type {ptype} cannot be analytically defined.") - # function that defines how we will replace variable names with - # values from the case file - def rhs_replace(match): - return { - "x": "x_cc(i)", - "y": "y_cc(j)", - "z": "z_cc(k)", - "xc": f"patch_icpp({pid})%x_centroid", - "yc": f"patch_icpp({pid})%y_centroid", - "zc": f"patch_icpp({pid})%z_centroid", - "lx": f"patch_icpp({pid})%length_x", - "ly": f"patch_icpp({pid})%length_y", - "lz": f"patch_icpp({pid})%length_z", - "r": f"patch_icpp({pid})%radius", - "eps": f"patch_icpp({pid})%epsilon", - "beta": f"patch_icpp({pid})%beta", - "tau_e": f"patch_icpp({pid})%tau_e", - "radii": f"patch_icpp({pid})%radii", - "e": f"{math.e}", - }.get(match.group(), match.group()) + var_map = { + "x": "x_cc(i)", + "y": "y_cc(j)", + "z": "z_cc(k)", + "xc": f"patch_icpp({pid})%x_centroid", + "yc": f"patch_icpp({pid})%y_centroid", + "zc": f"patch_icpp({pid})%z_centroid", + "lx": f"patch_icpp({pid})%length_x", + "ly": f"patch_icpp({pid})%length_y", + "lz": f"patch_icpp({pid})%length_z", + "r": f"patch_icpp({pid})%radius", + "eps": f"patch_icpp({pid})%epsilon", + "beta": f"patch_icpp({pid})%beta", + "tau_e": f"patch_icpp({pid})%tau_e", + "radii": f"patch_icpp({pid})%radii", + } lines = [] - # perform the replacement of strings for each analytic function - # to generate some fortran string representing the code passed in + # translate each analytic expression to Fortran and emit an assignment for attribute, expr in items: if print: cons.print(f"* Codegen: {attribute} = {expr}") @@ -221,7 +238,10 @@ def rhs_replace(match): qpvf_idx = f"{qpvf_idx} + {idx}" lhs = f"q_prim_vf({qpvf_idx})%sf({DATA['sf_idx']})" - rhs = re.sub(r"[a-zA-Z]+", rhs_replace, expr) + try: + rhs = fortranize_expr(expr, var_map) + except AnalyticExprError as err: + raise common.MFCException(f"{attribute}: {err}") from err lines.append(f" {lhs} = {rhs}") @@ -267,27 +287,25 @@ def __get_analytic_mib_fpp(self, print: bool) -> str: # for each analytical patch that is required to be added, generate # the string that contains that function. for pid, items in ib_patches.items(): - # function that defines how we will replace variable names with - # values from the case file - def rhs_replace(match): - return { - "x": "x_cc(i)", - "y": "y_cc(j)", - "z": "z_cc(k)", - "t": "mytime", - "r": f"patch_ib({pid})%radius", - "e": f"{math.e}", - }.get(match.group(), match.group()) + var_map = { + "x": "x_cc(i)", + "y": "y_cc(j)", + "z": "z_cc(k)", + "t": "mytime", + "r": f"patch_ib({pid})%radius", + } lines = [] - # perform the replacement of strings for each analytic function - # to generate some fortran string representing the code passed in + # translate each analytic expression to Fortran and emit an assignment for attribute, expr in items: if print: cons.print(f"* Codegen: {attribute} = {expr}") lhs = attribute - rhs = re.sub(r"[a-zA-Z]+", rhs_replace, expr) + try: + rhs = fortranize_expr(expr, var_map) + except AnalyticExprError as err: + raise common.MFCException(f"{attribute}: {err}") from err lines.append(f" {lhs} = {rhs}") @@ -422,4 +440,4 @@ def __getitem__(self, key: str) -> str: return self.params[key] def __setitem__(self, key: str, val: str): - self.params[key] = val + self.params[key] = self.__normalize_named_value(key, val) diff --git a/toolchain/mfc/cli/commands.py b/toolchain/mfc/cli/commands.py index 069e3c9d12..2fce946693 100644 --- a/toolchain/mfc/cli/commands.py +++ b/toolchain/mfc/cli/commands.py @@ -550,9 +550,18 @@ completion=Completion(type=CompletionType.FILES_PY), ), ], + arguments=[ + Argument( + name="migrate", + help='Rewrite integer codes of enumerated parameters to named values (e.g. riemann_solver: 2 -> "hllc") in place.', + action=ArgAction.STORE_TRUE, + default=False, + ), + ], examples=[ Example("./mfc.sh validate case.py", "Check syntax and constraints"), Example("./mfc.sh validate case.py -d", "Validate with toolchain debug output"), + Example("./mfc.sh validate case.py --migrate", "Rewrite integer codes to named values"), ], key_options=[ ("-d, --debug-log", "Enable toolchain debug logging"), diff --git a/toolchain/mfc/lint_docs.py b/toolchain/mfc/lint_docs.py index 32f765651a..a5f88c7136 100644 --- a/toolchain/mfc/lint_docs.py +++ b/toolchain/mfc/lint_docs.py @@ -67,6 +67,30 @@ # Hardcoded Fortran constants (not case-file params) "init_dir", "zeros_default", + # Enumerated value names used as prose examples (not parameter names) + "hll", + "hllc", + # Analytic expression language: Fortran intrinsics and module name (not case params) + "m_constants", + "sin", + "cos", + "tan", + "asin", + "acos", + "atan", + "atan2", + "sinh", + "cosh", + "tanh", + "exp", + "log", + "log10", + "sqrt", + "abs", + "min", + "max", + "mod", + "sign", } # Docs to check for parameter references, with per-file skip sets diff --git a/toolchain/mfc/params/definitions.py b/toolchain/mfc/params/definitions.py index e22787089b..e87389c3e7 100644 --- a/toolchain/mfc/params/definitions.py +++ b/toolchain/mfc/params/definitions.py @@ -173,7 +173,7 @@ def _lookup_hint(name): # Schema Validation for Constraints and Dependencies # Uses rapidfuzz for "did you mean?" suggestions when typos are detected -_VALID_CONSTRAINT_KEYS = {"choices", "min", "max", "value_labels"} +_VALID_CONSTRAINT_KEYS = {"choices", "min", "max", "value_labels", "names"} _VALID_DEPENDENCY_KEYS = {"when_true", "when_set", "when_value"} _VALID_CONDITION_KEYS = {"requires", "recommends", "requires_value"} @@ -203,6 +203,19 @@ def _validate_constraint(param_name: str, constraint: Dict[str, Any]) -> None: for key in constraint["value_labels"]: if key not in constraint["choices"]: raise ValueError(f"value_labels key {key!r} for '{param_name}' not in choices {constraint['choices']}") + if "names" in constraint: + names = constraint["names"] + if not isinstance(names, dict): + raise ValueError(f"Constraint 'names' for '{param_name}' must be a dict") + for name, value in names.items(): + if not isinstance(name, str) or not re.match(r"^[a-z0-9][a-z0-9_]*$", name): + raise ValueError(f"names key {name!r} for '{param_name}' must be a lowercase identifier") + if not isinstance(value, int): + raise ValueError(f"names value for '{param_name}'/{name!r} must be an int") + if len(set(names.values())) != len(names): + raise ValueError(f"names for '{param_name}' map two names to the same value") + if "choices" in constraint and set(names.values()) != set(constraint["choices"]): + raise ValueError(f"names for '{param_name}' must cover exactly its choices {constraint['choices']}") def _validate_dependency(param_name: str, dependency: Dict[str, Any]) -> None: @@ -283,55 +296,67 @@ def get_value_label(param_name: str, value: int) -> str: "recon_type": { "choices": [1, 2], "value_labels": {1: "WENO", 2: "MUSCL"}, + "names": {"weno": 1, "muscl": 2}, }, "muscl_order": { "choices": [1, 2], "value_labels": {1: "1st order", 2: "2nd order"}, + "names": {"first_order": 1, "second_order": 2}, }, "muscl_lim": { "choices": [0, 1, 2, 3, 4, 5], "value_labels": {0: "unlimited", 1: "minmod", 2: "MC", 3: "Van Albada", 4: "Van Leer", 5: "SUPERBEE"}, + "names": {"unlimited": 0, "minmod": 1, "mc": 2, "van_albada": 3, "van_leer": 4, "superbee": 5}, }, "int_comp": { "choices": [0, 1, 2], "value_labels": {0: "off", 1: "THINC", 2: "MTHINC"}, + "names": {"off": 0, "thinc": 1, "mthinc": 2}, }, # Time stepping "time_stepper": { "choices": [1, 2, 3], "value_labels": {1: "RK1 (Forward Euler)", 2: "RK2", 3: "RK3 (SSP)"}, + "names": {"rk1": 1, "rk2": 2, "rk3": 3}, }, # Riemann solver "riemann_solver": { "choices": [1, 2, 4, 5], "value_labels": {1: "HLL", 2: "HLLC", 4: "HLLD", 5: "Lax-Friedrichs"}, + "names": {"hll": 1, "hllc": 2, "hlld": 4, "lax_friedrichs": 5}, }, "wave_speeds": { "choices": [1, 2], "value_labels": {1: "direct", 2: "pressure"}, + "names": {"direct": 1, "pressure": 2}, }, "avg_state": { "choices": [1, 2], "value_labels": {1: "Roe", 2: "arithmetic"}, + "names": {"roe": 1, "arithmetic": 2}, }, # Model equations "model_eqns": { "choices": [1, 2, 3, 4], "value_labels": {1: "Gamma-law", 2: "5-Equation", 3: "6-Equation", 4: "4-Equation"}, + "names": {"gamma_law": 1, "5eq": 2, "6eq": 3, "4eq": 4}, }, # Bubbles "bubble_model": { "choices": [1, 2, 3], "value_labels": {1: "Gilmore", 2: "Keller-Miksis", 3: "Rayleigh-Plesset"}, + "names": {"gilmore": 1, "keller_miksis": 2, "rayleigh_plesset": 3}, }, # Output "format": { "choices": [1, 2], "value_labels": {1: "Silo", 2: "binary"}, + "names": {"silo": 1, "binary": 2}, }, "precision": { "choices": [1, 2], "value_labels": {1: "single", 2: "double"}, + "names": {"single": 1, "double": 2}, }, # Time stepping (must be positive) "dt": {"min": 0}, @@ -504,7 +529,8 @@ def _r(name, ptype, tags=None, desc=None, hint=None, math=None, str_len=None, st constraint = CONSTRAINTS.get(name) if constraint and "value_labels" in constraint: labels = constraint["value_labels"] - suffix = ", ".join(f"{v}={labels[v]}" for v in sorted(labels)) + by_value = {v: n for n, v in constraint.get("names", {}).items()} + suffix = ", ".join(f"{v} ('{by_value[v]}')={labels[v]}" if v in by_value else f"{v}={labels[v]}" for v in sorted(labels)) desc = f"{desc} ({suffix})".strip() REGISTRY.register( ParamDef( diff --git a/toolchain/mfc/params/generators/docs_gen.py b/toolchain/mfc/params/generators/docs_gen.py index 6a6bfa4170..130dbc1613 100644 --- a/toolchain/mfc/params/generators/docs_gen.py +++ b/toolchain/mfc/params/generators/docs_gen.py @@ -113,8 +113,14 @@ def _format_constraints(param) -> str: c = param.constraints if "choices" in c: labels = c.get("value_labels", {}) - if labels: - items = [f"{v}={labels[v]}" if v in labels else str(v) for v in c["choices"]] + by_value = {v: n for n, v in c.get("names", {}).items()} + if labels or by_value: + items = [] + for v in c["choices"]: + item = f"{v} (`{by_value[v]}`)" if v in by_value else str(v) + if v in labels: + item += f"={labels[v]}" + items.append(item) parts.append(", ".join(items)) else: parts.append(f"Values: {c['choices']}") diff --git a/toolchain/mfc/params/generators/fortran_gen.py b/toolchain/mfc/params/generators/fortran_gen.py index e33bc40c17..c29a70d192 100644 --- a/toolchain/mfc/params/generators/fortran_gen.py +++ b/toolchain/mfc/params/generators/fortran_gen.py @@ -133,6 +133,20 @@ def generate_decls_fpp(target: str) -> str: return "\n".join(lines) + "\n" +def generate_constants_fpp() -> str: + """Named integer constants for enumerated parameters; identical for all targets.""" + from ..definitions import CONSTRAINTS + + lines = [_HEADER.rstrip()] + for param in sorted(CONSTRAINTS): + names = CONSTRAINTS[param].get("names") + if not names: + continue + for name, value in sorted(names.items(), key=lambda kv: kv[1]): + lines.append(f"integer, parameter :: {param}_{name} = {value}") + return "\n".join(lines) + "\n" + + def resolve_namelist_content(fpp_path: Path) -> str: """Return the namelist content for an fpp file. @@ -149,14 +163,15 @@ def resolve_namelist_content(fpp_path: Path) -> str: def get_generated_files(build_dir: Path) -> List[Tuple[Path, str]]: - """Return (path, content) for all 6 generated .fpp files under build_dir. + """Return (path, content) for all 9 generated .fpp files under build_dir. Paths match the cmake include directory structure: - build_dir/include/{full_target}/generated_{namelist,decls}.fpp + build_dir/include/{full_target}/generated_{namelist,decls,constants}.fpp """ result = [] for short, full in TARGETS: inc = build_dir / "include" / full result.append((inc / "generated_namelist.fpp", generate_namelist_fpp(short))) result.append((inc / "generated_decls.fpp", generate_decls_fpp(short))) + result.append((inc / "generated_constants.fpp", generate_constants_fpp())) return result diff --git a/toolchain/mfc/params/migrate.py b/toolchain/mfc/params/migrate.py new file mode 100644 index 0000000000..2558542388 --- /dev/null +++ b/toolchain/mfc/params/migrate.py @@ -0,0 +1,38 @@ +"""Rewrite numeric values of enumerated parameters in case-file text to their names.""" + +import re +from typing import Tuple + +from .definitions import CONSTRAINTS + + +def migrate_text(text: str) -> Tuple[str, int]: + """Replace integer codes with names for all parameters that define names. + + Only rewrites simple `"param": ` (or single-quoted) dict entries. + Returns (new_text, number_of_replacements). + + Note: operates on raw text, so occurrences inside comments or string + literals are also rewritten; the caller's reload-and-compare check + guards semantics but not comment text. + """ + total = 0 + for param, constraint in sorted(CONSTRAINTS.items()): + names = constraint.get("names") + if not names: + continue + by_value = {v: n for n, v in names.items()} + # Lookahead (not capture) for the terminator so values followed by an + # inline comment without a trailing comma are rewritten too. + pattern = re.compile(r"""(["']""" + re.escape(param) + r"""["']\s*:\s*)(\d+)(?=\s*(?:[,}\n#]|$))""") + + def repl(m, by_value=by_value): + nonlocal total + value = int(m.group(2)) + if value not in by_value: + return m.group(0) + total += 1 + return f'{m.group(1)}"{by_value[value]}"' + + text = pattern.sub(repl, text) + return text, total diff --git a/toolchain/mfc/params/schema.py b/toolchain/mfc/params/schema.py index 4abea5d824..3964ca6aea 100644 --- a/toolchain/mfc/params/schema.py +++ b/toolchain/mfc/params/schema.py @@ -91,7 +91,12 @@ def validate_value(self, value: Any) -> List[str]: if "choices" in self.constraints: choices = self.constraints["choices"] if value not in choices: - errors.append(constraint_error(self.name, "choices", choices, value)) + by_value = {v: n for n, v in self.constraints.get("names", {}).items()} + if by_value: + shown = ", ".join(f"{c} ({by_value[c]})" if c in by_value else str(c) for c in choices) + errors.append(constraint_error(self.name, "choices", shown, value)) + else: + errors.append(constraint_error(self.name, "choices", choices, value)) # Check numeric range constraints (only for numeric values, not analytic strings) if isinstance(value, (int, float)): diff --git a/toolchain/mfc/params_tests/test_fortran_gen.py b/toolchain/mfc/params_tests/test_fortran_gen.py index 7b3d77c3a5..6546f8b425 100644 --- a/toolchain/mfc/params_tests/test_fortran_gen.py +++ b/toolchain/mfc/params_tests/test_fortran_gen.py @@ -159,14 +159,37 @@ def test_check_target_raises_on_bad_target(): generate_decls_fpp("bad") -def test_get_generated_files_returns_six(): +def test_get_generated_files_returns_nine(): from pathlib import Path from mfc.params.generators.fortran_gen import get_generated_files files = get_generated_files(Path("/build")) - assert len(files) == 6 + assert len(files) == 9 paths = [str(p) for p, _ in files] assert any("pre_process/generated_namelist.fpp" in p for p in paths) assert any("simulation/generated_decls.fpp" in p for p in paths) assert any("post_process/generated_namelist.fpp" in p for p in paths) + + +def test_generate_constants_fpp_content(): + from mfc.params.generators.fortran_gen import generate_constants_fpp + + out = generate_constants_fpp() + assert "AUTO-GENERATED" in out + assert "integer, parameter :: riemann_solver_hllc = 2" in out + assert "integer, parameter :: model_eqns_5eq = 2" in out + assert "integer, parameter :: time_stepper_rk3 = 3" in out + # Deterministic: two calls produce identical output + assert out == generate_constants_fpp() + + +def test_get_generated_files_includes_constants(): + from pathlib import Path + + from mfc.params.generators.fortran_gen import get_generated_files + + files = get_generated_files(Path("/tmp/x")) + names = {p.name for p, _ in files} + assert names == {"generated_namelist.fpp", "generated_decls.fpp", "generated_constants.fpp"} + assert len(files) == 9 diff --git a/toolchain/mfc/params_tests/test_migrate.py b/toolchain/mfc/params_tests/test_migrate.py new file mode 100644 index 0000000000..6e4b4ddfd7 --- /dev/null +++ b/toolchain/mfc/params_tests/test_migrate.py @@ -0,0 +1,66 @@ +"""Tests for case-file migration to named parameter values.""" + +SAMPLE = """print(json.dumps({ + "riemann_solver": 2, + "model_eqns": 2, + "weno_order": 5, + "num_fluids": 1, + 'time_stepper': 3, +})) +""" + + +def test_migrate_text_rewrites_named_params(): + from mfc.params.migrate import migrate_text + + out, n = migrate_text(SAMPLE) + assert '"riemann_solver": "hllc",' in out + assert '"model_eqns": "5eq",' in out + assert "'time_stepper': \"rk3\"," in out + assert '"weno_order": 5,' in out # not an enumerated vocabulary - untouched + assert '"num_fluids": 1,' in out # has min/max but no names - untouched + assert n == 3 + + +def test_migrate_text_is_idempotent(): + from mfc.params.migrate import migrate_text + + once, _ = migrate_text(SAMPLE) + twice, n = migrate_text(once) + assert twice == once + assert n == 0 + + +def test_migrate_text_leaves_unknown_codes(): + from mfc.params.migrate import migrate_text + + out, n = migrate_text('"riemann_solver": 9,') + assert out == '"riemann_solver": 9,' + assert n == 0 + + +def test_migrate_text_rewrites_comments_too(): + # Known limitation of text-based migration: commented-out parameter + # lines are rewritten as well. Semantics are unaffected (comments do + # not execute); this test documents the behavior. + from mfc.params.migrate import migrate_text + + out, n = migrate_text('# "riemann_solver": 2,\n"riemann_solver": 2,\n') + assert out == '# "riemann_solver": "hllc",\n"riemann_solver": "hllc",\n' + assert n == 2 + + +def test_migrate_text_handles_inline_comment_without_comma(): + from mfc.params.migrate import migrate_text + + out, n = migrate_text('"time_stepper": 3 # final entry, no trailing comma\n') + assert out == '"time_stepper": "rk3" # final entry, no trailing comma\n' + assert n == 1 + + +def test_migrate_text_handles_end_of_string(): + from mfc.params.migrate import migrate_text + + out, n = migrate_text('"format": 1') + assert out == '"format": "silo"' + assert n == 1 diff --git a/toolchain/mfc/params_tests/test_names.py b/toolchain/mfc/params_tests/test_names.py new file mode 100644 index 0000000000..b4d6cb6039 --- /dev/null +++ b/toolchain/mfc/params_tests/test_names.py @@ -0,0 +1,95 @@ +"""Tests for named parameter values (the "names" key in CONSTRAINTS).""" + +import re + + +def test_names_are_wellformed_and_cover_choices(): + from mfc.params.definitions import CONSTRAINTS + + name_re = re.compile(r"^[a-z0-9][a-z0-9_]*$") + for param, c in CONSTRAINTS.items(): + names = c.get("names") + if names is None: + continue + assert isinstance(names, dict), param + for name, value in names.items(): + assert name_re.match(name), f"{param}: bad name {name!r}" + assert isinstance(value, int), f"{param}: {name} -> {value!r} is not int" + assert len(set(names.values())) == len(names), f"{param}: duplicate values in names" + if "choices" in c: + assert set(names.values()) == set(c["choices"]), f"{param}: names do not cover choices" + assert any("names" in c for c in CONSTRAINTS.values()), "no CONSTRAINTS entry defines names" + + +def test_riemann_solver_names(): + from mfc.params.definitions import CONSTRAINTS + + assert CONSTRAINTS["riemann_solver"]["names"] == {"hll": 1, "hllc": 2, "hlld": 4, "lax_friedrichs": 5} + + +def test_invalid_names_rejected(): + import pytest + + from mfc.params.definitions import _validate_constraint + + with pytest.raises(ValueError): + _validate_constraint("x", {"choices": [1, 2], "names": {"BadName": 1, "ok": 2}}) + with pytest.raises(ValueError): + _validate_constraint("x", {"choices": [1, 2], "names": {"a": 1, "b": 3}}) + with pytest.raises(ValueError): + _validate_constraint("x", {"choices": [1, 2], "names": ["a", "b"]}) + with pytest.raises(ValueError): + _validate_constraint("x", {"choices": [1, 2], "names": {1: "a", 2: "b"}}) + + +def test_case_normalizes_named_values(): + from mfc.case import Case + + case = Case({"riemann_solver": "hllc", "model_eqns": "5eq", "time_stepper": 3, "dt": 1e-5}) + assert case.params["riemann_solver"] == 2 + assert case.params["model_eqns"] == 2 + assert case.params["time_stepper"] == 3 + + +def test_case_leaves_numeric_strings_and_unnamed_params_alone(): + from mfc.case import Case + + case = Case({"riemann_solver": "2", "viscous": "T"}) + assert case.params["riemann_solver"] == "2" + assert case.params["viscous"] == "T" + + +def test_case_rejects_unknown_name_listing_valid_ones(): + import pytest + + from mfc.case import Case + from mfc.common import MFCException + + with pytest.raises(MFCException, match="hllc"): + Case({"riemann_solver": "hlcc"}) + + +def test_setitem_normalizes_named_values(): + from mfc.case import Case + + case = Case({}) + case["riemann_solver"] = "hllc" + assert case.params["riemann_solver"] == 2 + + +def test_choices_error_mentions_names(): + from mfc.params.registry import REGISTRY + + errs = REGISTRY.get_param_def("riemann_solver").validate_value(3) + assert len(errs) == 1 + assert "hllc" in errs[0] + + +def test_docs_constraints_show_names(): + from mfc.params.generators.docs_gen import _format_constraints + from mfc.params.registry import REGISTRY + + s = _format_constraints(REGISTRY.get_param_def("riemann_solver")) + assert "hllc" in s + assert "`hllc`" in s # name is rendered in backtick syntax, not just bare + assert "HLLC" in s diff --git a/toolchain/mfc/test_analytic_expr.py b/toolchain/mfc/test_analytic_expr.py new file mode 100644 index 0000000000..268fc93e51 --- /dev/null +++ b/toolchain/mfc/test_analytic_expr.py @@ -0,0 +1,148 @@ +"""Tests for AST-based analytic expression translation.""" + +import math +import re + +import pytest + +IC_MAP = { + "x": "x_cc(i)", + "y": "y_cc(j)", + "z": "z_cc(k)", + "lx": "patch_icpp(1)%length_x", + "ly": "patch_icpp(1)%length_y", + "r": "patch_icpp(1)%radius", + "tau_e": "patch_icpp(1)%tau_e", +} + + +def test_simple_expression(): + from mfc.analytic_expr import fortranize_expr + + out = fortranize_expr("0.5 + 0.2*sin(2.0*pi*x/lx)", IC_MAP) + assert out.replace(" ", "") == "0.5+0.2*sin(2.0*pi*x_cc(i)/patch_icpp(1)%length_x)" + + +def test_parentheses_regenerated_by_precedence(): + from mfc.analytic_expr import fortranize_expr + + out = fortranize_expr("2.0 * (x / lx + y / ly)", IC_MAP) + assert out.replace(" ", "") == "2.0*(x_cc(i)/patch_icpp(1)%length_x+y_cc(j)/patch_icpp(1)%length_y)" + + +def test_power_and_unary_minus(): + from mfc.analytic_expr import fortranize_expr + + assert fortranize_expr("x**2", IC_MAP).replace(" ", "") == "x_cc(i)**2" + assert fortranize_expr("-x + y", IC_MAP).replace(" ", "") == "-x_cc(i)+y_cc(j)" + assert fortranize_expr("y * -x", IC_MAP).replace(" ", "") == "y_cc(j)*(-x_cc(i))" + + +def test_underscore_variable_maps_correctly(): + # The legacy regex could never match tau_e (it tokenized through the underscore, + # corrupting the trailing e); the AST path must handle it. + from mfc.analytic_expr import fortranize_expr + + out = fortranize_expr("tau_e * 2", IC_MAP) + assert out.replace(" ", "") == "patch_icpp(1)%tau_e*2" + + +def test_scientific_notation_is_safe(): + # Legacy regex corrupted the 'e' in 2e-3 inside larger expressions. + from mfc.analytic_expr import fortranize_expr + + # 2e-3 constant-folds to 0.002 (no exponent in repr), unlike 1e20 below which keeps e-form and gains _wp. + out = fortranize_expr("1.0 + 2e-3*x", IC_MAP) + assert out.replace(" ", "") == "1.0+0.002*x_cc(i)" + + +def test_unknown_variable_raises_listing_valid(): + from mfc.analytic_expr import AnalyticExprError, fortranize_expr + + with pytest.raises(AnalyticExprError) as excinfo: + fortranize_expr("x0 + 1", IC_MAP) + assert "x0" in str(excinfo.value) + assert "lx" in str(excinfo.value) # the message lists the valid names + + +def test_unknown_function_raises(): + from mfc.analytic_expr import AnalyticExprError, fortranize_expr + + with pytest.raises(AnalyticExprError, match="frobnicate"): + fortranize_expr("frobnicate(x)", IC_MAP) + + +def test_syntax_error_raises(): + from mfc.analytic_expr import AnalyticExprError, fortranize_expr + + with pytest.raises(AnalyticExprError, match="invalid"): + fortranize_expr("0.5 + * 2", IC_MAP) + + +def test_intrinsics_and_pi_pass_through(): + from mfc.analytic_expr import fortranize_expr + + out = fortranize_expr("exp(-x**2) + cos(pi*y) + min(x, y)", IC_MAP) + assert out.replace(" ", "") == "exp(-x_cc(i)**2)+cos(pi*y_cc(j))+min(x_cc(i),y_cc(j))" + + +def test_exponent_literal_gets_wp_suffix(): + from mfc.analytic_expr import fortranize_expr + + assert fortranize_expr("1e20", IC_MAP) == "1e+20_wp" + assert fortranize_expr("1e20 * x", IC_MAP).replace(" ", "") == "1e+20_wp*x_cc(i)" + + +# Corpus-equivalence gate: AST translator vs legacy regex substitution +# NOTE: intrinsics (sin, cos, ...) and pi must NOT be var_map keys, or the legacy reference's pass-through behavior diverges and the gate silently degrades. +# Harvested 2026-06-09 from examples/*/case.py with: +# grep -rhoE '"patch_icpp\([0-9]+\)%(alpha_rho|vel|pres|alpha|tau_e|Y|cf_val|Bx|By|Bz)(\([0-9]+\))?"\s*:\s*"[^"]+"' examples/*/case.py | sort -u +# grep -rhoE '"patch_ib\([0-9]+\)%(vel|angular_vel)\([0-9]+\)"\s*:\s*"[^"]+"' examples/*/case.py | sort -u +# Excluded: pure-number values (e.g. "0"), T/F booleans, file paths, and enum +# strings (e.g. "hllc", "weno", "5eq"); no patch_ib analytic expressions found. + + +def _legacy_fortranize(expr, var_map): + def rhs_replace(match): + return var_map.get(match.group(), {"e": f"{math.e}"}.get(match.group(), match.group())) + + return re.sub(r"[a-zA-Z]+", rhs_replace, expr) + + +CORPUS = [ + # harvested 2026-06-09 from examples/*/case.py (see plan Task 2 Step 1) + "0.5 + 0.2 * sin(2.0 * pi * x / lx)", + "0.5 - 0.5*sin(2*pi*x)", + "0.5 + 0.5*sin(2*pi*x)", + "0.5 - 0.2 * sin(2.0 * pi * x / lx)", + "1.0 + 0.2 * sin(2.0 * pi * (x / lx + y / ly + z / lz))", + "1.0 + 0.2 * sin(2.0 * pi * (x / lx + y / ly))", + "1.0 + 0.2 * sin(2.0 * pi * x / lx)", + "1 + 0.1*sin(20*x*pi)", + "1 + 0.2*sin(5*x)", +] + + +def test_corpus_equivalence_with_legacy(): + from mfc.analytic_expr import fortranize_expr + + var_map = { # representative IC map, patch 1 + "x": "x_cc(i)", + "y": "y_cc(j)", + "z": "z_cc(k)", + "xc": "patch_icpp(1)%x_centroid", + "yc": "patch_icpp(1)%y_centroid", + "zc": "patch_icpp(1)%z_centroid", + "lx": "patch_icpp(1)%length_x", + "ly": "patch_icpp(1)%length_y", + "lz": "patch_icpp(1)%length_z", + "r": "patch_icpp(1)%radius", + "eps": "patch_icpp(1)%epsilon", + "beta": "patch_icpp(1)%beta", + "tau_e": "patch_icpp(1)%tau_e", + "radii": "patch_icpp(1)%radii", + } + for expr in CORPUS: + new = fortranize_expr(expr, var_map).replace(" ", "") + old = _legacy_fortranize(expr, var_map).replace(" ", "") + assert new == old, f"divergence for {expr!r}:\n legacy: {old}\n ast: {new}" diff --git a/toolchain/mfc/validate.py b/toolchain/mfc/validate.py index c07ffec8b3..8e16688aaf 100644 --- a/toolchain/mfc/validate.py +++ b/toolchain/mfc/validate.py @@ -58,6 +58,34 @@ def validate(): cons.print("[bold yellow]Case validation complete with warnings.[/bold yellow]") cons.print("[dim]Note: Some constraint violations may be OK if you're not using that stage.[/dim]") + if ARG("migrate") and not all_passed: + cons.print("[yellow]Skipping --migrate: fix the validation issues above first.[/yellow]") + elif ARG("migrate"): + from .params.migrate import migrate_text + + with open(input_file, "r") as f: + original = f.read() + new_text, n = migrate_text(original) + if n == 0: + cons.print("No integer codes to migrate.") + return + with open(input_file, "w") as f: + f.write(new_text) + # Safety: the migrated file must load to the same normalized parameters. + try: + re_case = run_input.load(input_file, do_print=False) + except MFCException: + with open(input_file, "w") as f: + f.write(original) + cons.print("[bold red]Error:[/bold red] Migrated file failed to load; original restored.") + sys.exit(1) + if re_case.params != case.params: + with open(input_file, "w") as f: + f.write(original) + cons.print("[bold red]Error:[/bold red] Migration changed case semantics; file restored.") + sys.exit(1) + cons.print(f"[bold green]✓[/bold green] Migrated {n} value(s) to named syntax") + except MFCException as e: cons.print("\n[bold red]✗ Validation failed:[/bold red]") cons.print(f"{e}")