Skip to content

Commit c532738

Browse files
authored
add more docs on compressible, including sources (#317)
1 parent 51fbff1 commit c532738

File tree

6 files changed

+439
-178
lines changed

6 files changed

+439
-178
lines changed

docs/source/compressible_basics.rst

Lines changed: 33 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,37 @@
22
Compressible hydrodynamics
33
**************************
44

5-
The Euler equations of compressible hydrodynamics take the form:
5+
6+
7+
The Euler equations of compressible hydrodynamics express conservation of mass, momentum, and energy.
8+
For the conserved state, $\Uc = (\rho, \rho \Ub, \rho E)^\intercal$, the conserved system can be written
9+
as:
610

711
.. math::
812
9-
\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho U) &= 0 \\
10-
\frac{\partial (\rho U)}{\partial t} + \nabla \cdot (\rho U U) + \nabla p &= \rho g \\
11-
\frac{\partial (\rho E)}{\partial t} + \nabla \cdot [(\rho E + p ) U] &= \rho U \cdot g
13+
\Uc_t + \nabla \cdot {\bf F}(\Uc) = {\bf S}
14+
15+
where ${\bf F}$ are the fluxes and ${\bf S}$ are any source terms. In terms of components,
16+
they take the form (with a gravity source term):
17+
18+
.. math::
19+
20+
\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \Ub) &= 0 \\
21+
\frac{\partial (\rho \Ub)}{\partial t} + \nabla \cdot (\rho \Ub \Ub) + \nabla p &= \rho {\bf g} \\
22+
\frac{\partial (\rho E)}{\partial t} + \nabla \cdot [(\rho E + p ) \Ub] &= \rho \Ub \cdot {\bf g}
23+
24+
with :math:`\rho E = \rho e + \frac{1}{2} \rho |\Ub|^2`. The system is closed with an equation
25+
of state of the form:
26+
27+
.. math::
1228
13-
with :math:`\rho E = \rho e + \frac{1}{2} \rho |U|^2` and :math:`p =
14-
p(\rho, e)`. Note these do not include any dissipation terms, since
15-
they are usually negligible in astrophysics.
29+
p = p(\rho, e)
30+
31+
32+
.. note::
33+
34+
The Euler equations do not include any dissipation terms, since
35+
they are usually negligible in astrophysics.
1636

1737
pyro has several compressible solvers to solve this equation set.
1838
The implementations here have flattening at shocks, artificial
@@ -81,176 +101,11 @@ The parameters for this solver are:
81101

82102
.. include:: compressible_sdc_problems.inc
83103

84-
Example problems
85-
================
86-
87-
.. note::
88-
89-
The 4th-order accurate solver (:py:mod:`pyro.compressible_fv4`) requires that
90-
the initialization create cell-averages accurate to 4th-order. To
91-
allow for all the solvers to use the same problem setups, we assume
92-
that the initialization routines initialize cell-centers (which is
93-
fine for 2nd-order accuracy), and the
94-
:func:`preevolve() <pyro.compressible_fv4.simulation.Simulation.preevolve>` method will convert
95-
these to cell-averages automatically after initialization.
96-
97-
98-
Sod
99-
---
100-
101-
The Sod problem is a standard hydrodynamics problem. It is a
102-
one-dimensional shock tube (two states separated by an interface),
103-
that exhibits all three hydrodynamic waves: a shock, contact, and
104-
rarefaction. Furthermore, there are exact solutions for a gamma-law
105-
equation of state, so we can check our solution against these exact
106-
solutions. See Toro's book for details on this problem and the exact
107-
Riemann solver.
108-
109-
Because it is one-dimensional, we run it in narrow domains in the x- or y-directions. It can be run as:
110-
111-
.. prompt:: bash
112-
113-
pyro_sim.py compressible sod inputs.sod.x
114-
pyro_sim.py compressible sod inputs.sod.y
115-
116-
A simple script, ``sod_compare.py`` in ``analysis/`` will read a pyro output
117-
file and plot the solution over the exact Sod solution. Below we see
118-
the result for a Sod run with 128 points in the x-direction, gamma =
119-
1.4, and run until t = 0.2 s.
120-
121-
.. image:: sod_compare.png
122-
:align: center
123-
124-
We see excellent agreement for all quantities. The shock wave is very
125-
steep, as expected. The contact wave is smeared out over ~5 zones—this
126-
is discussed in the notes above, and can be improved in the PPM method
127-
with contact steepening.
128-
129-
Sedov
130-
-----
131-
132-
The Sedov blast wave problem is another standard test with an analytic
133-
solution (Sedov 1959). A lot of energy is point into a point in a
134-
uniform medium and a blast wave propagates outward. The Sedov problem
135-
is run as:
136-
137-
.. prompt:: bash
138-
139-
pyro_sim.py compressible sedov inputs.sedov
140-
141-
The video below shows the output from a 128 x 128 grid with the energy
142-
put in a radius of 0.0125 surrounding the center of the domain. A
143-
gamma-law EOS with gamma = 1.4 is used, and we run until 0.1
144-
145-
.. raw:: html
146-
147-
<div style="position: relative; padding-bottom: 75%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
148-
<iframe src="https://www.youtube.com/embed/1JO6By78p9E?rel=0" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
149-
</div><br>
150-
151-
We see some grid effects because it is hard to initialize a small
152-
circular explosion on a rectangular grid. To compare to the analytic
153-
solution, we need to radially bin the data. Since this is a 2-d
154-
explosion, the physical geometry it represents is a cylindrical blast
155-
wave, so we compare to Sedov's cylindrical solution. The radial
156-
binning is done with the ``sedov_compare.py`` script in ``analysis/``
157-
158-
.. image:: sedov_compare.png
159-
:align: center
160-
161-
This shows good agreement with the analytic solution.
162-
163-
164-
quad
165-
----
166-
167-
The quad problem sets up different states in four regions of the
168-
domain and watches the complex interfaces that develop as shocks
169-
interact. This problem has appeared in several places (and a `detailed
170-
investigation
171-
<http://planets.utsc.utoronto.ca/~pawel/Riemann.hydro.html>`_ is
172-
online by Pawel Artymowicz). It is run as:
173-
174-
.. prompt:: bash
175-
176-
pyro_sim.py compressible quad inputs.quad
177-
178-
.. image:: quad.png
179-
:align: center
180-
181-
182-
rt
183-
--
184-
185-
The Rayleigh-Taylor problem puts a dense fluid over a lighter one and
186-
perturbs the interface with a sinusoidal velocity. Hydrostatic
187-
boundary conditions are used to ensure any initial pressure waves can
188-
escape the domain. It is run as:
189-
190-
.. prompt:: bash
191-
192-
pyro_sim.py compressible rt inputs.rt
193-
194-
.. raw:: html
195-
196-
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
197-
<iframe src="https://www.youtube.com/embed/P4zmObEYCOs?rel=0" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
198-
</div><br>
199-
200-
201-
202-
bubble
203-
------
204-
205-
The bubble problem initializes a hot spot in a stratified domain and
206-
watches it buoyantly rise and roll up. This is run as:
207-
208-
.. prompt:: bash
209-
210-
pyro_sim.py compressible bubble inputs.bubble
211-
212-
213-
.. image:: bubble.png
214-
:align: center
215-
216-
The shock at the top of the domain is because we cut off the
217-
stratified atmosphere at some low density and the resulting material
218-
above that rains down on our atmosphere. Also note the acoustic signal
219-
propagating outward from the bubble (visible in the U and e panels).
220-
221-
Exercises
222-
=========
223-
224-
Explorations
225-
------------
226-
227-
* Measure the growth rate of the Rayleigh-Taylor instability for
228-
different wavenumbers.
229-
230-
* There are multiple Riemann solvers in the compressible
231-
algorithm. Run the same problem with the different Riemann solvers
232-
and look at the differences. Toro's text is a good book to help
233-
understand what is happening.
234-
235-
* Run the problems with and without limiting—do you notice any overshoots?
236-
237-
238-
Extensions
239-
----------
240-
241-
* Limit on the characteristic variables instead of the primitive
242-
variables. What changes do you see? (the notes show how to implement
243-
this change.)
244-
245-
* Add passively advected species to the solver.
246-
247-
* Add an external heating term to the equations.
248104

249-
* Add 2-d axisymmetric coordinates (r-z) to the solver. This is
250-
discussed in the notes. Run the Sedov problem with the explosion on
251-
the symmetric axis—now the solution will behave like the spherical
252-
sedov explosion instead of the cylindrical explosion.
105+
.. toctree::
106+
:maxdepth: 1
107+
:hidden:
253108

254-
* Swap the piecewise linear reconstruction for piecewise parabolic
255-
(PPM). The notes and the Miller and Colella paper provide a good basis
256-
for this. Research the Roe Riemann solver and implement it in pyro.
109+
compressible_problems
110+
compressible_sources
111+
compressible_exercises
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
**********************
2+
Compressible exercises
3+
**********************
4+
5+
Explorations
6+
============
7+
8+
* Measure the growth rate of the Rayleigh-Taylor instability for
9+
different wavenumbers.
10+
11+
* There are multiple Riemann solvers in the compressible
12+
algorithm. Run the same problem with the different Riemann solvers
13+
and look at the differences. Toro's text is a good book to help
14+
understand what is happening.
15+
16+
* Run the problems with and without limiting—do you notice any overshoots?
17+
18+
19+
Extensions
20+
==========
21+
22+
* Limit on the characteristic variables instead of the primitive
23+
variables. What changes do you see? (the notes show how to implement
24+
this change.)
25+
26+
* Add passively advected species to the solver.
27+
28+
* Add an external heating term to the equations.
29+
30+
* Add 2-d axisymmetric coordinates (r-z) to the solver. This is
31+
discussed in the notes. Run the Sedov problem with the explosion on
32+
the symmetric axis—now the solution will behave like the spherical
33+
sedov explosion instead of the cylindrical explosion.
34+
35+
* Swap the piecewise linear reconstruction for piecewise parabolic
36+
(PPM). The notes and the Miller and Colella paper provide a good basis
37+
for this. Research the Roe Riemann solver and implement it in pyro.

0 commit comments

Comments
 (0)