Skip to content

Commit 93a0281

Browse files
committed
Merge branch 'master' of ssh://github.com/zingale/pyro2
2 parents 840f19a + 1d4d312 commit 93a0281

15 files changed

Lines changed: 135 additions & 1 deletion

File tree

compressible_fv4/fluxes.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def flux_cons(ivars, idir, gamma, q):
4040

4141
def fluxes(myd, rp, ivars, solid, tc):
4242

43+
alpha = 0.3
44+
beta = 0.3
45+
4346
myg = myd.grid
4447

4548
gamma = rp.get_param("eos.gamma")
@@ -156,4 +159,38 @@ def fluxes(myd, rp, ivars, solid, tc):
156159
2*F_avg.v(n=n, buf=1) +
157160
F_avg.ip(-1, n=n, buf=1))
158161

162+
# artificial viscosity McCorquodale & Colella Eq. 35, 36
163+
# first find face-centered div
164+
lam = myg.scratch_array()
165+
166+
if idir == 1:
167+
lam.v(buf=1)[:, :] = (q_bar.v(buf=1, n=ivars.iu) -
168+
q_bar.ip(-1, buf=1, n=ivars.iu))/myg.dx + \
169+
0.25*(q_bar.jp(1, buf=1, n=ivars.iv) -
170+
q_bar.jp(-1, buf=1, n=ivars.iv) +
171+
q_bar.ip_jp(-1, 1, buf=1, n=ivars.iv) -
172+
q_bar.ip_jp(-1, -1, buf=1, n=ivars.iv))/myg.dy
173+
else:
174+
lam.v(buf=1)[:, :] = (q_bar.v(buf=1, n=ivars.iv) -
175+
q_bar.jp(-1, buf=1, n=ivars.iv))/myg.dy + \
176+
0.25*(q_bar.ip(1, buf=1, n=ivars.iu) -
177+
q_bar.ip(-1, buf=1, n=ivars.iu) +
178+
q_bar.ip_jp(1, -1, buf=1, n=ivars.iu) -
179+
q_bar.ip_jp(-1, -1, buf=1, n=ivars.iu))/myg.dx
180+
181+
test = myg.scratch_array()
182+
test.v(buf=1)[:, :] = (myg.dx*lam.v(buf=1))**2 / \
183+
(beta * gamma * q_bar.v(buf=1, n=ivars.ip) /
184+
q_bar.v(buf=1, n=ivars.irho))
185+
186+
nu = myg.dx * lam * np.minimum(test, 1.0)
187+
nu[lam >= 0.0] = 0.0
188+
189+
if idir == 1:
190+
for n in range(ivars.nvar):
191+
F_x.v(buf=1, n=n)[:, :] += alpha * nu.v(buf=1) * (U_avg.v(buf=1, n=n) - U_avg.ip(-1, buf=1, n=n))
192+
else:
193+
for n in range(ivars.nvar):
194+
F_y.v(buf=1, n=n)[:, :] += alpha * nu.v(buf=1) * (U_avg.v(buf=1, n=n) - U_avg.jp(-1, buf=1, n=n))
195+
159196
return F_x, F_y
Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,102 @@
11
Compressible solver comparisons
22
===============================
33

4+
We run various problems run with the different compressible solvers in pyro (standard Riemann, Runge-Kutta, fourth order).
5+
6+
47
Kelvin-Helmholtz
5-
----------------
8+
^^^^^^^^^^^^^^^^
9+
The McNally Kelvin-Helmholtz problem sets up a heavier fluid moving in the negative x-direction sandwiched between regions of lighter fluid moving in the positive x-direction.
10+
11+
The image below shows the KH problem initialized with McNally's test. It ran on a 128 x 128 grid, with gamma = 1.7, and ran until t = 2.0. This is run with:
12+
13+
.. code-block:: none
14+
15+
./pyro.py compressible kh inputs.kh kh.vbulk=0
16+
./pyro.py compressible_rk kh inputs.kh kh.vbulk=0
17+
./pyro.py compressible_fv4 kh inputs.kh kh.vbulk=0
18+
19+
.. image:: ./solver_comparisons/kh.png
20+
:align: center
21+
22+
23+
We vary the velocity in the positive y-direction (vbulk) to see how effective the solvers are at preserving the initial shape.
24+
25+
26+
Sedov
27+
^^^^^
28+
The Sedov problem ran on a 128 x 128 grid, with gamma = 1.4, and until t = 0.1, which can be run as:
29+
30+
.. code-block:: none
31+
32+
./pyro.py compressible sedov inputs.sedov
33+
./pyro.py compressible_rk sedov inputs.sedov
34+
./pyro.py compressible_fv4 sedov inputs.sedov
35+
36+
.. image:: ./solver_comparisons/sedov.png
37+
:align: center
38+
39+
.. image:: ./solver_comparisons/sedov_rk.png
40+
:align: center
41+
42+
.. image:: ./solver_comparisons/sedov_fv4.png
43+
:align: center
44+
45+
Quad
46+
^^^^
47+
The quad problem ran on a 256 x 256 grid until t = 0.8, which can be run as:
48+
49+
.. code-block:: none
50+
51+
./pyro.py compressible quad inputs.quad
52+
./pyro.py compressible_rk quad inputs.quad
53+
./pyro.py compressible_fv4 quad inputs.quad
54+
55+
.. image:: ./solver_comparisons/quad.png
56+
:align: center
57+
58+
.. image:: ./solver_comparisons/quad_rk.png
59+
:align: center
60+
61+
.. image:: ./solver_comparisons/quad_fv4.png
62+
:align: center
63+
64+
65+
Bubble
66+
^^^^^^
67+
The bubble problem ran on a 128 x 256 grid until t = 3.0, which can be run as:
68+
69+
.. code-block:: none
70+
71+
./pyro.py compressible bubble inputs.bubble
72+
./pyro.py compressible_rk bubble inputs.bubble
73+
./pyro.py compressible_fv4 bubble inputs.bubble
74+
75+
.. image:: ./solver_comparisons/bubble.png
76+
:align: center
77+
78+
.. image:: ./solver_comparisons/bubble_rk.png
79+
:align: center
80+
81+
.. image:: ./solver_comparisons/bubble_fv4.png
82+
:align: center
83+
84+
85+
Rayleigh-Taylor
86+
^^^^^^^^^^^^^^^
87+
The Rayleigh-Taylor problem ran on a 64 x 192 grid until t = 3.0, which can be run as:
88+
89+
.. code-block:: none
90+
91+
./pyro.py compressible rt inputs.rt
92+
./pyro.py compressible_rk rt inputs.rt
93+
./pyro.py compressible_fv4 rt inputs.rt
94+
95+
.. image:: ./solver_comparisons/rt.png
96+
:align: center
97+
98+
.. image:: ./solver_comparisons/rt_rk.png
99+
:align: center
100+
101+
.. image:: ./solver_comparisons/rt_fv4.png
102+
:align: center
33.9 KB
Loading
35 KB
Loading
34.6 KB
Loading
149 KB
Loading
72 KB
Loading
73.7 KB
Loading
72.9 KB
Loading
49.4 KB
Loading

0 commit comments

Comments
 (0)