From 7e2f49fcd8468cdee80ec1415e068a5c9ff78772 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sat, 14 Sep 2024 21:00:22 -0400 Subject: [PATCH] add docstrings to all the compressible problem setups (#272) --- pyro/compressible/problems/acoustic_pulse.py | 9 ++++++++- pyro/compressible/problems/advect.py | 7 +++++++ pyro/compressible/problems/bubble.py | 4 ++++ pyro/compressible/problems/gresho.py | 5 +++++ pyro/compressible/problems/hse.py | 4 ++++ pyro/compressible/problems/kh.py | 5 ++++- pyro/compressible/problems/logo.py | 6 ++++++ pyro/compressible/problems/quad.py | 6 ++++++ pyro/compressible/problems/ramp.py | 3 +++ pyro/compressible/problems/rt.py | 2 ++ pyro/compressible/problems/rt2.py | 2 +- pyro/compressible/problems/sedov.py | 2 ++ pyro/compressible/problems/sod.py | 3 +++ pyro/compressible/problems/test.py | 2 ++ 14 files changed, 57 insertions(+), 3 deletions(-) diff --git a/pyro/compressible/problems/acoustic_pulse.py b/pyro/compressible/problems/acoustic_pulse.py index 3e00bb05e..ceb43f10d 100644 --- a/pyro/compressible/problems/acoustic_pulse.py +++ b/pyro/compressible/problems/acoustic_pulse.py @@ -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 @@ -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...") diff --git a/pyro/compressible/problems/advect.py b/pyro/compressible/problems/advect.py index 516ec71e8..8d01fbfb0 100644 --- a/pyro/compressible/problems/advect.py +++ b/pyro/compressible/problems/advect.py @@ -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 diff --git a/pyro/compressible/problems/bubble.py b/pyro/compressible/problems/bubble.py index bc72676f9..4e403c1b7 100644 --- a/pyro/compressible/problems/bubble.py +++ b/pyro/compressible/problems/bubble.py @@ -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 diff --git a/pyro/compressible/problems/gresho.py b/pyro/compressible/problems/gresho.py index a11af9e39..74212a9d8 100644 --- a/pyro/compressible/problems/gresho.py +++ b/pyro/compressible/problems/gresho.py @@ -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 diff --git a/pyro/compressible/problems/hse.py b/pyro/compressible/problems/hse.py index 4d50b9d83..aed15441d 100644 --- a/pyro/compressible/problems/hse.py +++ b/pyro/compressible/problems/hse.py @@ -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 diff --git a/pyro/compressible/problems/kh.py b/pyro/compressible/problems/kh.py index 191d3b434..6d3771c53 100644 --- a/pyro/compressible/problems/kh.py +++ b/pyro/compressible/problems/kh.py @@ -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 @@ -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)) diff --git a/pyro/compressible/problems/logo.py b/pyro/compressible/problems/logo.py index 8f27c263a..9045f63a4 100644 --- a/pyro/compressible/problems/logo.py +++ b/pyro/compressible/problems/logo.py @@ -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 diff --git a/pyro/compressible/problems/quad.py b/pyro/compressible/problems/quad.py index ffbe38840..d3e872f84 100644 --- a/pyro/compressible/problems/quad.py +++ b/pyro/compressible/problems/quad.py @@ -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 diff --git a/pyro/compressible/problems/ramp.py b/pyro/compressible/problems/ramp.py index 55d872344..33a081e23 100644 --- a/pyro/compressible/problems/ramp.py +++ b/pyro/compressible/problems/ramp.py @@ -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 diff --git a/pyro/compressible/problems/rt.py b/pyro/compressible/problems/rt.py index f22dec200..6f0dad5d2 100644 --- a/pyro/compressible/problems/rt.py +++ b/pyro/compressible/problems/rt.py @@ -1,3 +1,5 @@ +"""A single-mode Rayleigh-Taylor instability.""" + import numpy as np from pyro.util import msg diff --git a/pyro/compressible/problems/rt2.py b/pyro/compressible/problems/rt2.py index b738f347e..8360afcf7 100644 --- a/pyro/compressible/problems/rt2.py +++ b/pyro/compressible/problems/rt2.py @@ -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. """ diff --git a/pyro/compressible/problems/sedov.py b/pyro/compressible/problems/sedov.py index cafd1591a..50a707895 100644 --- a/pyro/compressible/problems/sedov.py +++ b/pyro/compressible/problems/sedov.py @@ -1,3 +1,5 @@ +"""The classic Sedov problem.""" + import math import numpy as np diff --git a/pyro/compressible/problems/sod.py b/pyro/compressible/problems/sod.py index 23ca97b5d..487a471e9 100644 --- a/pyro/compressible/problems/sod.py +++ b/pyro/compressible/problems/sod.py @@ -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" diff --git a/pyro/compressible/problems/test.py b/pyro/compressible/problems/test.py index b2b5b2bf2..bbc6c6ebb 100644 --- a/pyro/compressible/problems/test.py +++ b/pyro/compressible/problems/test.py @@ -1,3 +1,5 @@ +"""A setup intended for unit testing.""" + DEFAULT_INPUTS = None PROBLEM_PARAMS = {}