Skip to content

Commit

Permalink
add docstrings to all the compressible problem setups (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Sep 15, 2024
1 parent 903285e commit 7e2f49f
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 3 deletions.
9 changes: 8 additions & 1 deletion pyro/compressible/problems/acoustic_pulse.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""The acoustic pulse problem described in McCorquodale & Colella
2011. This uses a uniform background and a small pressure
perturbation that drives a low Mach number soundwave. This problem is
useful for testing convergence of a compressible solver.
"""

import numpy as np

from pyro.util import msg
Expand All @@ -10,7 +17,7 @@

def init_data(myd, rp):
"""initialize the acoustic_pulse problem. This comes from
McCourquodale & Coella 2011"""
McCorquodale & Coella 2011"""

if rp.get_param("driver.verbose"):
msg.bold("initializing the acoustic pulse problem...")
Expand Down
7 changes: 7 additions & 0 deletions pyro/compressible/problems/advect.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""A simple advection test. A density perturbation is set with a
constant pressure in the domain and a velocity field is set to advect
the profile across the domain. This is useful for testing
convergence.
"""

import numpy as np

from pyro.util import msg
Expand Down
4 changes: 4 additions & 0 deletions pyro/compressible/problems/bubble.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""A buoyant perturbation (bubble) is placed in an isothermal
hydrostatic atmosphere (plane-parallel). It will rise and deform (due
to shear)"""

import numpy as np

from pyro.util import msg
Expand Down
5 changes: 5 additions & 0 deletions pyro/compressible/problems/gresho.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""The Gresho vortex problem sets up a toroidal velocity field that is
balanced by a radial pressure gradient. This is in equilibrium and
the state should remain unchanged in time. This version of the problem
is based on Miczek, Roepke, and Edelmann 2014."""

import numpy as np

from pyro.util import msg
Expand Down
4 changes: 4 additions & 0 deletions pyro/compressible/problems/hse.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""Initialize an isothermal hydrostatic atmosphere. It should remain
static. This is a test of our treatment of the gravitational source
term."""

import numpy as np

from pyro.util import msg
Expand Down
5 changes: 4 additions & 1 deletion pyro/compressible/problems/kh.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""A Kelvin-Helmholtz shear problem. There are 2 shear layers, with the and an optional
vertical bulk velocity. This can be used to test the numerical dissipation in the solver.
This setup is based on McNally et al. 2012."""

import numpy as np

from pyro.util import msg
Expand Down Expand Up @@ -68,7 +72,6 @@ def init_data(my_data, rp):
dens[idx4] = rho_1 - rhom*np.exp((0.75 - myg.y2d[idx4])/dy)
xmom[idx4] = u_1 - vm*np.exp((0.75 - myg.y2d[idx4])/dy)

# upper half
xmom[:, :] *= dens
ymom[:, :] = dens * (bulk_velocity + w0 * np.sin(4*np.pi*myg.x2d))

Expand Down
6 changes: 6 additions & 0 deletions pyro/compressible/problems/logo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""Generate the pyro logo! The word "pyro" is written in the center
of the domain and perturbations are placed in the 4 corners to drive
converging shocks inward to scramble the logo.
"""

import matplotlib.pyplot as plt
import numpy as np

Expand Down
6 changes: 6 additions & 0 deletions pyro/compressible/problems/quad.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""The quadrant problem from Shulz-Rinne et al. 1993; Lax and Lui 1998.
Four different states are initialized in the quadrants of the domain, driving
shocks and other hydrodynamic waves at the interfaces. This can be used to
test the symmetry of the solver.
"""

import numpy as np

from pyro.util import msg
Expand Down
3 changes: 3 additions & 0 deletions pyro/compressible/problems/ramp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""A shock hitting a ramp at an oblique angle. This is based on
Woodward & Colella 1984."""

import math

import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/rt.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""A single-mode Rayleigh-Taylor instability."""

import numpy as np

from pyro.util import msg
Expand Down
2 changes: 1 addition & 1 deletion pyro/compressible/problems/rt2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""A RT problem with two distinct modes: short wave length on the
"""A RT problem with two distinct modes: short wavelength on the
left and long wavelength on the right. This allows one to see
how the growth rate depends on wavenumber.
"""
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/sedov.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""The classic Sedov problem."""

import math

import numpy as np
Expand Down
3 changes: 3 additions & 0 deletions pyro/compressible/problems/sod.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""A general shock tube problem for comparing the solver to an exact
Riemann solution."""

from pyro.util import msg

DEFAULT_INPUTS = "inputs.sod.x"
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""A setup intended for unit testing."""

DEFAULT_INPUTS = None

PROBLEM_PARAMS = {}
Expand Down

0 comments on commit 7e2f49f

Please sign in to comment.