Skip to content

Commit b0dbbbe

Browse files
committed
merged with MFlowCode
2 parents b15f477 + a2a8800 commit b0dbbbe

File tree

94 files changed

+7117
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+7117
-288
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ They are organized below.
132132
* Ideal and stiffened gas equations of state
133133
* Body forces
134134
* Acoustic wave generation (one- and two-way sound sources)
135+
* Magnetohydrodynamics (MHD)
136+
* Relativistic Magnetohydrodynamics (RMHD)
135137
</details>
136138

137139
### Numerics
@@ -142,7 +144,7 @@ They are organized below.
142144
* WENO variants: WENO-JS, WENO-M, WENO-Z, TENO
143145
* Monotonicity-preserving reconstructions
144146
* Reliable handling of large density ratios
145-
* Exact and approximate (e.g., HLL, HLLC) Riemann solvers
147+
* Exact and approximate (e.g., HLL, HLLC, HLLD) Riemann solvers
146148
* Boundary conditions
147149
* Periodic, reflective, extrapolation/Neumann
148150
* Slip and no-slip

docs/documentation/case.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ MPI topology is automatically optimized to maximize the parallel efficiency for
164164
| `alpha_rho(i)` * | Real | Supported | Partial density of fluid $i$. |
165165
| `pres` * | Real | Supported | Pressure. |
166166
| `vel(i)` * | Real | Supported | Velocity in direction $i$. |
167+
| `tau_e(i)` * | Real | Supported | Elastic stresses. |
167168
| `hcid` * | Integer | N/A | Hard coded patch id |
168169
| `cf_val` * | Real | Supported | Surface tension color function value |
169170
| `model_filepath` | String | Not Supported | Path to an STL or OBJ file (not all OBJs are supported). |
@@ -180,6 +181,8 @@ The parameters define the geometries and physical parameters of fluid components
180181
Note that the domain must be fully filled with patche(s).
181182
The code outputs error messages when an empty region is left in the domain.
182183

184+
- `tau_e(i)` is the `i`-th component of the elastic stress tensor, ordered as `tau_xx`, `tau_xy`, `tau_yy`, `tau_xz`, `tau_yz`, and `tau_zz`. 1D simulation requires `tau(1)`, 2D `tau(1:3)`, and 3D `tau(1:6)`.
185+
183186
#### Analytical Definition of Primitive Variables
184187

185188
Some parameters, as described above, can be defined by analytical functions in the input file. For example, one can define the following patch:
@@ -330,6 +333,7 @@ Additional details on this specification can be found in [The Naca Airfoil Serie
330333
| `qv` ** | Real | Stiffened-gas parameter $q$ of fluid. |
331334
| `qvp` ** | Real | Stiffened-gas parameter $q'$ of fluid. |
332335
| `sigma` | Real | Surface tension coefficient |
336+
| `G` | Real | Shear modulus of solid. |
333337

334338
Fluid material's parameters. All parameters except for sigma should be prepended with `fluid_pp(i)` where $i$ is the fluid index.
335339

@@ -349,6 +353,8 @@ Details of implementation of viscosity in MFC can be found in [Coralic (2015)](r
349353

350354
- `fluid_pp(i)%%cv`, `fluid_pp(i)%%qv`, and `fluid_pp(i)%%qvp` define $c_v$, $q$, and $q'$ as parameters of $i$-th fluid that are used in stiffened gas equation of state.
351355

356+
- `fluid_pp(i)%%G` is required for `hypoelasticity`.
357+
352358
### 6. Simulation Algorithm
353359

354360
| Parameter | Type | Description |
@@ -372,7 +378,7 @@ Details of implementation of viscosity in MFC can be found in [Coralic (2015)](r
372378
| `teno_CT` | Real | TENO threshold for smoothness detection |
373379
| `null_weights` | Logical | Null WENO weights at boundaries |
374380
| `mp_weno` | Logical | Monotonicity preserving WENO |
375-
| `riemann_solver` | Integer | Riemann solver algorithm: [1] HLL*; [2] HLLC; [3] Exact* |
381+
| `riemann_solver` | Integer | Riemann solver algorithm: [1] HLL*; [2] HLLC; [3] Exact*; [4] HLLD (only for MHD) |
376382
| `low_Mach` | Integer | Low Mach number correction for HLLC Riemann solver: [0] None; [1] Pressure (Chen et al. 2022); [2] Velocity (Thornber et al. 2008) |
377383
| `avg_state` | Integer | Averaged state evaluation method: [1] Roe average*; [2] Arithmetic mean |
378384
| `wave_speeds` | Integer | Wave-speed estimation: [1] Direct (Batten et al. 1997); [2] Pressure-velocity* (Toro 1999) |
@@ -391,6 +397,7 @@ Details of implementation of viscosity in MFC can be found in [Coralic (2015)](r
391397
| `t_stop` | Real | Simulation stop time |
392398
| `surface_tension` | Logical | Activate surface tension |
393399
| `viscous` | Logical | Activate viscosity |
400+
| `hypoelasticity` | Logical | Activate hypoelasticity* |
394401

395402
- \* Options that work only with `model_eqns = 2`.
396403
- † Options that work only with ``cyl_coord = 'F'``.
@@ -450,6 +457,7 @@ It is recommended to set `weno_eps` to $10^{-6}$ for WENO-JS, and to $10^{-40}$
450457

451458
- `riemann_solver` specifies the choice of the Riemann solver that is used in simulation by an integer from 1 through 3.
452459
`riemann_solver = 1`, `2`, and `3` correspond to HLL, HLLC, and Exact Riemann solver, respectively ([Toro, 2013](references.md#Toro13)).
460+
`riemann_solver = 4` is only for MHD simulations. It resolves 5 of the full seven-wave structure of the MHD equations ([Miyoshi and Kusano, 2005](references.md#Miyoshi05)).
453461

454462
- `low_Mach` specifies the choice of the low Mach number correction scheme for the HLLC Riemann solver. `low_Mach = 0` is default value and does not apply any correction scheme. `low_Mach = 1` and `2` apply the anti-dissipation pressure correction method ([Chen et al., 2022](references.md#Chen22)) and the improved velocity reconstruction method ([Thornber et al., 2008](references.md#Thornber08)). This feature requires `riemann_solver = 2` and `model_eqns = 2`.
455463

@@ -469,6 +477,8 @@ This option requires `weno_Re_flux` to be true because cell boundary values are
469477

470478
- `viscous` activates viscosity when set to ``'T'``. Requires `Re(1)` and `Re(2)` to be set.
471479

480+
- `hypoelasticity` activates elastic stress calculations for fluid-solid interactions. Requires `G` to be set in the fluid material's parameters.
481+
472482
#### Constant Time-Stepping
473483

474484
- `dt` specifies the constant time step size used in the simulation.
@@ -523,6 +533,7 @@ To restart the simulation from $k$-th time step, see [Restarting Cases](running.
523533
| `omega_wrt(i)` | Logical | Add the $i$-direction vorticity to the database |
524534
| `schlieren_wrt` | Logical | Add the numerical schlieren to the database|
525535
| `qm_wrt` | Logical | Add the Q-criterion to the database|
536+
| `tau_wrt` | Logical | Add the elastic stress components to the database|
526537
| `fd_order` | Integer | Order of finite differences for computing the vorticity and the numerical Schlieren function [1,2,4] |
527538
| `schlieren_alpha(i)` | Real | Intensity of the numerical Schlieren computed via `alpha(i)` |
528539
| `probe_wrt` | Logical | Write the flow chosen probes data files for each time step |
@@ -849,7 +860,34 @@ $$ a_{x[y,z]} = g_{x[y,z]} + k_{x[y,z]}\sin\left(w_{x[y,z]}t + p_{x[y,z]}\right)
849860

850861
By convention, positive accelerations in the `x[y,z]` direction are in the positive `x[y,z]` direction.
851862

852-
### 14. Cylindrical Coordinates
863+
### 14. Magnetohydrodynamics (MHD)
864+
865+
| Parameter | Type | Description |
866+
| ---: | :---: | :--- |
867+
| `mhd` | Logical | Enable ideal MHD simulation |
868+
| `relativity` | Logical | Enable relativistic MHD simulation |
869+
| `powell` | Logical | Enable Powell's method for solenoidal constraint |
870+
| `fd_order` | Integer | Finite difference order for Powell's method |
871+
| `Bx[y,z]` | Real | Initial magnetic field in the x[y,z] direction |
872+
| `Bx0` | Real | Constant magnetic field in the x direction (1D only)|
873+
874+
- `mhd` is currently only available for single-component flows and 5-equation model. Its compatibility with most other features is work in progress.
875+
876+
- `relativity` only works for `mhd` enabled and activates relativistic MHD (RMHD) simulation.
877+
878+
- `powell` activates Powell's eight-wave method to impose the solenoidal constraint in the MHD simulation [Powell (1994)](references.md#Powell94). It should not be used in conjunction with HLLD (`riemann_solver = 4`).
879+
880+
- `fd_order` specifies the finite difference order for computing the RHS of the Powell's method. `fd_order = 1`, `2`, and `4` are allowed.
881+
882+
- `Bx0` is only used in 1D simulations to specify the constant magnetic field in the x direction. It must be specified in 1D simulations. `Bx` must not be used in 1D simulations.
883+
884+
- `Bx`, `By`, and `Bz` are used to specify the initial magnetic field in the x, y, and z directions, respectively. They must be specified in all 1D/2D/3D MHD simulations, with the exception of `Bx` in 1D simulations.
885+
886+
Note: In 1D/2D/3D simulations, all three velocity components are treated as state variables and must be specified in the case file.
887+
888+
Note: For relativistic flow, the conservative and primitive densities are different. `rho_wrt` outputs the primitive (rest mass) density.
889+
890+
### 15. Cylindrical Coordinates
853891

854892
When ``cyl_coord = 'T'`` is set in 3D the following constraints must be met:
855893

docs/documentation/references.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@
5757
- <a id="Tiwari13">Tiwari, A., Freund, J. B., and Pantano, C. (2013). A diffuse interface model with immiscibility preservation. Journal of computational physics, 252:290–309.</a>
5858

5959
- <a id="Toro13">Toro, E. F. (2013). Riemann solvers and numerical methods for fluid dynamics: a practical introduction. Springer Science & Business Media.</a>
60+
61+
- <a id="Miyoshi05">Miyoishi, T., and Kusano, K. (2005). A multi-state HLL approximate Riemann solver for ideal magnetohydrodynamics. Journal of Computational Physics, 208(1), 315-344.</a>
62+
63+
- <a id="Powell94">Powell, K. G. (1994). An approximate Riemann solver for magnetohydrodynamics: (That works in more than one dimension). In Upwind and high-resolution schemes (pp. 570-583). Springer.</a>

examples/1D_brio_wu/case.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env python3
2+
import json
3+
4+
# An upwind differencing scheme for the equations of ideal magnetohydrodynamics
5+
# M. Brio and C. C. Wu
6+
7+
# Configuring case dictionary
8+
print(
9+
json.dumps(
10+
{
11+
# Logistics
12+
"run_time_info": "T",
13+
# Computational Domain Parameters
14+
"x_domain%beg": 0,
15+
"x_domain%end": 1.0,
16+
"m": 800,
17+
"n": 0,
18+
"p": 0,
19+
"dt": 0.0002,
20+
"t_step_start": 0,
21+
"t_step_stop": 1000,
22+
"t_step_save": 100,
23+
# Simulation Algorithm Parameters
24+
"num_patches": 2,
25+
"model_eqns": 2,
26+
"alt_soundspeed": "F",
27+
"num_fluids": 1,
28+
"mpp_lim": "F",
29+
"mixture_err": "F",
30+
"time_stepper": 3,
31+
"weno_order": 5,
32+
"mapped_weno": "T",
33+
"weno_eps": 1.0e-16,
34+
"null_weights": "F",
35+
"mp_weno": "F",
36+
"riemann_solver": 1,
37+
"wave_speeds": 1,
38+
"avg_state": 2,
39+
"bc_x%beg": -3,
40+
"bc_x%end": -3,
41+
# Formatted Database Files Structure Parameters
42+
"format": 1,
43+
"precision": 2,
44+
"prim_vars_wrt": "T",
45+
"rho_wrt": "T",
46+
"parallel_io": "T",
47+
# MHD
48+
"mhd": "T",
49+
"Bx0": 0.75,
50+
# Patch 1 Left
51+
"patch_icpp(1)%geometry": 1,
52+
"patch_icpp(1)%x_centroid": 0.25,
53+
"patch_icpp(1)%length_x": 0.5,
54+
"patch_icpp(1)%vel(1)": 0.0,
55+
"patch_icpp(1)%vel(2)": 0.0,
56+
"patch_icpp(1)%vel(3)": 0.0,
57+
"patch_icpp(1)%pres": 1.0,
58+
"patch_icpp(1)%By": 1.0,
59+
"patch_icpp(1)%Bz": 0.0,
60+
"patch_icpp(1)%alpha_rho(1)": 1.0,
61+
"patch_icpp(1)%alpha(1)": 1.0,
62+
# Patch 2 Right
63+
"patch_icpp(2)%geometry": 1,
64+
"patch_icpp(2)%x_centroid": 0.75,
65+
"patch_icpp(2)%length_x": 0.5,
66+
"patch_icpp(2)%vel(1)": 0.0,
67+
"patch_icpp(2)%vel(2)": 0.0,
68+
"patch_icpp(2)%vel(3)": 0.0,
69+
"patch_icpp(2)%pres": 0.1,
70+
"patch_icpp(2)%By": -1.0,
71+
"patch_icpp(2)%Bz": 0.0,
72+
"patch_icpp(2)%alpha_rho(1)": 0.125,
73+
"patch_icpp(2)%alpha(1)": 1.0,
74+
# Fluids Physical Parameters
75+
"fluid_pp(1)%gamma": 1.0e00 / (2.0e00 - 1.0e00),
76+
"fluid_pp(1)%pi_inf": 0.0,
77+
}
78+
)
79+
)

examples/1D_brio_wu_hlld/case.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env python3
2+
import json
3+
4+
# An upwind differencing scheme for the equations of ideal magnetohydrodynamics
5+
# M. Brio and C. C. Wu
6+
# Note: HLLD is not used in the paper
7+
8+
# Configuring case dictionary
9+
print(
10+
json.dumps(
11+
{
12+
# Logistics
13+
"run_time_info": "T",
14+
# Computational Domain Parameters
15+
"x_domain%beg": 0,
16+
"x_domain%end": 1.0,
17+
"m": 800,
18+
"n": 0,
19+
"p": 0,
20+
"dt": 0.0002,
21+
"t_step_start": 0,
22+
"t_step_stop": 1000,
23+
"t_step_save": 100,
24+
# Simulation Algorithm Parameters
25+
"num_patches": 2,
26+
"model_eqns": 2,
27+
"alt_soundspeed": "F",
28+
"num_fluids": 1,
29+
"mpp_lim": "F",
30+
"mixture_err": "F",
31+
"time_stepper": 3,
32+
"weno_order": 5,
33+
"mapped_weno": "T",
34+
"weno_eps": 1.0e-16,
35+
"null_weights": "F",
36+
"mp_weno": "F",
37+
"riemann_solver": 4,
38+
"wave_speeds": 1,
39+
"avg_state": 2,
40+
"bc_x%beg": -3,
41+
"bc_x%end": -3,
42+
# Formatted Database Files Structure Parameters
43+
"format": 1,
44+
"precision": 2,
45+
"prim_vars_wrt": "T",
46+
"rho_wrt": "T",
47+
"parallel_io": "T",
48+
# MHD
49+
"mhd": "T",
50+
"Bx0": 0.75,
51+
# Patch 1 Left
52+
"patch_icpp(1)%geometry": 1,
53+
"patch_icpp(1)%x_centroid": 0.25,
54+
"patch_icpp(1)%length_x": 0.5,
55+
"patch_icpp(1)%vel(1)": 0.0,
56+
"patch_icpp(1)%vel(2)": 0.0,
57+
"patch_icpp(1)%vel(3)": 0.0,
58+
"patch_icpp(1)%pres": 1.0,
59+
"patch_icpp(1)%By": 1.0,
60+
"patch_icpp(1)%Bz": 0.0,
61+
"patch_icpp(1)%alpha_rho(1)": 1.0,
62+
"patch_icpp(1)%alpha(1)": 1.0,
63+
# Patch 2 Right
64+
"patch_icpp(2)%geometry": 1,
65+
"patch_icpp(2)%x_centroid": 0.75,
66+
"patch_icpp(2)%length_x": 0.5,
67+
"patch_icpp(2)%vel(1)": 0.0,
68+
"patch_icpp(2)%vel(2)": 0.0,
69+
"patch_icpp(2)%vel(3)": 0.0,
70+
"patch_icpp(2)%pres": 0.1,
71+
"patch_icpp(2)%By": -1.0,
72+
"patch_icpp(2)%Bz": 0.0,
73+
"patch_icpp(2)%alpha_rho(1)": 0.125,
74+
"patch_icpp(2)%alpha(1)": 1.0,
75+
# Fluids Physical Parameters
76+
"fluid_pp(1)%gamma": 1.0e00 / (2.0e00 - 1.0e00),
77+
"fluid_pp(1)%pi_inf": 0.0,
78+
}
79+
)
80+
)

examples/1D_brio_wu_rmhd/case.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env python3
2+
import json
3+
4+
# An HLLC Riemann solver for relativistic flows – II. Magnetohydrodynamics
5+
# A. Mignone and G. Bodo
6+
# Problem 1 Figure 3
7+
8+
# Configuring case dictionary
9+
print(
10+
json.dumps(
11+
{
12+
# Logistics
13+
"run_time_info": "T",
14+
# Computational Domain Parameters
15+
"x_domain%beg": 0,
16+
"x_domain%end": 1.0,
17+
"m": 1600,
18+
"n": 0,
19+
"p": 0,
20+
"dt": 0.0002,
21+
"t_step_start": 0,
22+
"t_step_stop": 2000,
23+
"t_step_save": 100,
24+
# Simulation Algorithm Parameters
25+
"num_patches": 2,
26+
"model_eqns": 2,
27+
"alt_soundspeed": "F",
28+
"num_fluids": 1,
29+
"mpp_lim": "F",
30+
"mixture_err": "F",
31+
"time_stepper": 3,
32+
"weno_order": 5,
33+
"mapped_weno": "T",
34+
"weno_eps": 1.0e-16,
35+
"null_weights": "F",
36+
"mp_weno": "F",
37+
"riemann_solver": 1,
38+
"wave_speeds": 1,
39+
"avg_state": 2,
40+
"bc_x%beg": -3,
41+
"bc_x%end": -3,
42+
# Formatted Database Files Structure Parameters
43+
"format": 1,
44+
"precision": 2,
45+
"prim_vars_wrt": "T",
46+
"rho_wrt": "T",
47+
"parallel_io": "T",
48+
# RMHD
49+
"mhd": "T",
50+
"relativity": "T",
51+
"Bx0": 0.5,
52+
# Patch 1 Left
53+
"patch_icpp(1)%geometry": 1,
54+
"patch_icpp(1)%x_centroid": 0.25,
55+
"patch_icpp(1)%length_x": 0.5,
56+
"patch_icpp(1)%vel(1)": 0.0,
57+
"patch_icpp(1)%vel(2)": 0.0,
58+
"patch_icpp(1)%vel(3)": 0.0,
59+
"patch_icpp(1)%pres": 1.0,
60+
"patch_icpp(1)%By": 1.0,
61+
"patch_icpp(1)%Bz": 0.0,
62+
"patch_icpp(1)%alpha_rho(1)": 1.0,
63+
"patch_icpp(1)%alpha(1)": 1.0,
64+
# Patch 2 Right
65+
"patch_icpp(2)%geometry": 1,
66+
"patch_icpp(2)%x_centroid": 0.75,
67+
"patch_icpp(2)%length_x": 0.5,
68+
"patch_icpp(2)%vel(1)": 0.0,
69+
"patch_icpp(2)%vel(2)": 0.0,
70+
"patch_icpp(2)%vel(3)": 0.0,
71+
"patch_icpp(2)%pres": 0.1,
72+
"patch_icpp(2)%By": -1.0,
73+
"patch_icpp(2)%Bz": 0.0,
74+
"patch_icpp(2)%alpha_rho(1)": 0.125,
75+
"patch_icpp(2)%alpha(1)": 1.0,
76+
# Fluids Physical Parameters
77+
"fluid_pp(1)%gamma": 1.0e00 / (2.0e00 - 1.0e00),
78+
"fluid_pp(1)%pi_inf": 0.0,
79+
}
80+
)
81+
)

0 commit comments

Comments
 (0)