Skip to content

Commit

Permalink
Merge branch 'main' into spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
zhichen3 authored Jul 14, 2024
2 parents aaba469 + f612aee commit 6c5c619
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 83 deletions.
83 changes: 44 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ https://python-hydro.github.io/pyro2
- We require `numpy`, `numba`, `matplotlib`, and `h5py` for running pyro
and `setuptools_scm` for the install.

- There are several ways to install pyro. The simplest way is via PyPI/pip:
- There are several ways to install pyro. The simplest way is via
PyPI/pip:

```
pip install pyro-hydro
Expand Down Expand Up @@ -85,7 +86,8 @@ https://python-hydro.github.io/pyro2
print matplotlib.pyplot.get_backend()
```
- If you want to run the unit tests, you need to have `pytest` installed.
- If you want to run the unit tests, you need to have `pytest`
installed.
- Finally, you can run a quick test of the advection solver:
Expand All @@ -105,8 +107,8 @@ on the grid are described in a jupyter notebook:
https://github.com/python-hydro/pyro2/blob/main/pyro/mesh/mesh-examples.ipynb
Many of the methods here rely on multigrid. The basic multigrid solver is
demonstrated in the juputer notebook:
Many of the methods here rely on multigrid. The basic multigrid
solver is demonstrated in the juputer notebook:
https://github.com/python-hydro/pyro2/blob/main/pyro/multigrid/multigrid-constant-coefficients.ipynb
Expand All @@ -123,7 +125,8 @@ pyro provides the following solvers (all in 2-d):
- `advection_fv4`: a fourth-order accurate finite-volume advection
solver that uses RK4 time integration.
- `advection_nonuniform`: a solver for advection with a non-uniform velocity field.
- `advection_nonuniform`: a solver for advection with a non-uniform
velocity field.
- `advection_rk`: a second-order unsplit solver for linear advection
that uses Runge-Kutta integration instead of characteristic
Expand All @@ -132,27 +135,28 @@ pyro provides the following solvers (all in 2-d):
- `advection_weno`: a method-of-lines WENO solver for linear
advection.
- `burgers`: a second-order unsplit solver for invsicid Burgers' equation.
- `burgers`: a second-order unsplit solver for invsicid Burgers'
equation.
- `viscous_burgers`: a second-order unsplit solver for viscous Burgers' equation
with constant-coefficient diffusion. It uses Crank-Nicolson time-discretized
solver for solving diffusion.
- `viscous_burgers`: a second-order unsplit solver for viscous
Burgers' equation with constant-coefficient diffusion. It uses
Crank-Nicolson time-discretized solver for solving diffusion.
- `compressible`: a second-order unsplit solver for the Euler
equations of compressible hydrodynamics. This uses characteristic
tracing and corner coupling for the prediction of the interface
states and a 2-shock or HLLC approximate Riemann solver.
- `compressible_fv4`: a fourth-order accurate finite-volume compressible
hydro solver that uses RK4 time integration. This is built from the
method of McCourquodale and Colella (2011).
- `compressible_fv4`: a fourth-order accurate finite-volume
compressible hydro solver that uses RK4 time integration. This
is built from the method of McCourquodale and Colella (2011).
- `compressible_rk`: a second-order unsplit solver for Euler
equations that uses Runge-Kutta integration instead of
characteristic tracing.
equations that uses Runge-Kutta integration instead of
characteristic tracing.
- `compressible_sdc`: a fourth-order compressible solver,
using spectral-deferred correction (SDC) for the time integration.
- `compressible_sdc`: a fourth-order compressible solver, using
spectral-deferred correction (SDC) for the time integration.
- `diffusion`: a Crank-Nicolson time-discretized solver for the
constant-coefficient diffusion equation.
Expand Down Expand Up @@ -188,29 +192,30 @@ of the simulation specifying the analysis routines that can be used
with their data.
- `pyro/util/compare.py`: this takes two simulation output files as
input and compares zone-by-zone for exact agreement. This is used as
part of the regression testing.
input and compares zone-by-zone for exact agreement. This is used
as part of the regression testing.
usage: `./compare.py file1 file2`
- `pyro/plot.py`: this takes the an output file as input and plots the
data using the solver's dovis method.
- `pyro/plot.py`: this takes the an output file as input and plots
the data using the solver's dovis method.
usage: `./plot.py file`
- `pyro/analysis/`
* `dam_compare.py`: this takes an output file from the
shallow water dam break problem and plots a slice through the domain
together with the analytic solution (calculated in the script).
* `dam_compare.py`: this takes an output file from the shallow
water dam break problem and plots a slice through the domain
together with the analytic solution (calculated in the
script).
usage: `./dam_compare.py file`
* `gauss_diffusion_compare.py`: this is for the diffusion solver's
Gaussian diffusion problem. It takes a sequence of output
files as arguments, computes the angle-average, and the plots
the resulting points over the analytic solution for comparison
with the exact result.
* `gauss_diffusion_compare.py`: this is for the diffusion
solver's Gaussian diffusion problem. It takes a sequence of
output files as arguments, computes the angle-average, and the
plots the resulting points over the analytic solution for
comparison with the exact result.
usage: `./gauss_diffusion_compare.py file*`
Expand All @@ -233,9 +238,9 @@ with their data.
usage: `./sedov_compare.py file`
* `smooth_error.py`: this takes an output file from the advection
solver's smooth problem and compares to the analytic solution,
outputting the L2 norm of the error.
* `smooth_error.py`: this takes an output file from the
advection solver's smooth problem and compares to the analytic
solution, outputting the L2 norm of the error.
usage: `./smooth_error.py file`
Expand All @@ -248,8 +253,8 @@ with their data.
## Understanding the algorithms
There is a set of notes that describe the background and details of the
algorithms that pyro implements:
There is a set of notes that describe the background and details of
the algorithms that pyro implements:
http://open-astrophysics-bookshelf.github.io/numerical_exercises/
Expand All @@ -260,10 +265,10 @@ with their data.
## Regression and unit testing
The `pyro/test.py` script will run several of the problems (as well as
some stand-alone multigrid tests) and compare the solution to stored
benchmarks (in each solver's `tests/` subdirectory). The return value
of the script is the number of tests that failed.
The `pyro/test.py` script will run several of the problems (as well
as some stand-alone multigrid tests) and compare the solution to
stored benchmarks (in each solver's `tests/` subdirectory). The
return value of the script is the number of tests that failed.
Unit tests are controlled by pytest and can be run simply via
Expand All @@ -273,8 +278,8 @@ with their data.
## Acknowledgements
If you use pyro in a class or workshop, please e-mail us to let us know
(we'd like to start listing these on the website).
If you use pyro in a class or workshop, please e-mail us to let us
know (we'd like to start listing these on the website).
If pyro was used for a publication, please cite the article found in
the `CITATION` file.
Expand Down
1 change: 0 additions & 1 deletion docs/source/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ @article{ZALESAK1979335
year = "1979",
issn = "0021-9991",
doi = "https://doi.org/10.1016/0021-9991(79)90051-2",
url = "http://www.sciencedirect.com/science/article/pii/0021999179900512",
author = "Steven T Zalesak",
abstract = "The theory of flux-corrected transport (FCT) developed by Boris and Book [J. Comput. Phys. 11 (1973) 38; 18 (1975) 248; 20 (1976) 397] is placed in a simple, generalized format, and a new algorithm for implementing the critical flux limiting stage' in multidimensions without resort to time splitting is presented. The new flux limiting algorithm allows the use of FCT techniques in multidimensional fluid problems for which time splitting would produce unacceptable numerical results, such as those involving incompressible or nearly incompressible flow fields. The “clipping” problem associated with the original one dimensional flux limiter is also eliminated or alleviated. Test results and applications to a two dimensional fluid plasma problem are presented."
}
Expand Down
1 change: 1 addition & 0 deletions pyro/compressible/unsplit_fluxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def unsplit_fluxes(my_data, my_aux, rp, ivars, solid, tc, dt):

riemann = rp.get_param("compressible.riemann")

riemannFunc = None
if riemann == "HLLC":
riemannFunc = ifc.riemann_hllc
elif riemann == "CGF":
Expand Down
1 change: 1 addition & 0 deletions pyro/compressible_rk/fluxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def fluxes(my_data, rp, ivars, solid, tc):

riemann = rp.get_param("compressible.riemann")

riemannFunc = None
if riemann == "HLLC":
riemannFunc = interface.riemann_hllc
elif riemann == "CGF":
Expand Down
1 change: 1 addition & 0 deletions pyro/compressible_sr/unsplit_fluxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def unsplit_fluxes(my_data, my_aux, rp, ivars, solid, tc, dt):

riemann = rp.get_param("compressible.riemann")

riemannFunc = None
if riemann == "HLLC":
riemannFunc = ifc.riemann_hllc
elif riemann == "CGF":
Expand Down
1 change: 1 addition & 0 deletions pyro/incompressible/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def initialize(self, other_bc=False, aux_vars=()):

# phi -- used for the projections. Has neumann BC's if v is dirichlet
# Assuming BC's are either all periodic or all dirichlet
phi_bc = None
if bc.xlb == "periodic":
phi_bc = bc
elif bc.xlb == "dirichlet":
Expand Down
1 change: 1 addition & 0 deletions pyro/lm_atm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def initialize(self):
self.rp.get_param("mesh.xrboundary"),
self.rp.get_param("mesh.ylboundary"),
self.rp.get_param("mesh.yrboundary")]:
bctype = None
if bc == "periodic":
bctype = "periodic"
elif bc in ["reflect", "slipwall"]:
Expand Down
3 changes: 3 additions & 0 deletions pyro/mesh/array_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ def pretty_print(self, n=0, fmt=None, show_ghost=True):

# print j descending, so it looks like a grid (y increasing
# with height)
ilo = ihi = jlo = jhi = -1
if show_ghost:
if self.idir == 1:
ilo = 0
Expand Down Expand Up @@ -534,6 +535,8 @@ def pretty_print(self, n=0, fmt=None, show_ghost=True):
for j in reversed(range(jlo, jhi+1)):
for i in range(ilo, ihi+1):

gc = None

if self.idir == 1:
if (j < self.g.jlo or j > self.g.jhi or
i < self.g.ilo or i > self.g.ihi+1):
Expand Down
68 changes: 27 additions & 41 deletions pyro/mesh/mesh-examples.ipynb

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pyro/mesh/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,12 @@ def create(self):
if self.idir == 1:
_tmp = np.zeros((self.grid.qx+1, self.grid.qy, self.nvar),
dtype=self.dtype)
self.data = ArrayIndexerFC(_tmp, idir=self.idir, grid=self.grid)

elif self.idir == 2:
_tmp = np.zeros((self.grid.qx, self.grid.qy+1, self.nvar),
dtype=self.dtype)

self.data = ArrayIndexerFC(_tmp, idir=self.idir, grid=self.grid)
self.data = ArrayIndexerFC(_tmp, idir=self.idir, grid=self.grid)

self.initialized = 1

Expand Down
1 change: 1 addition & 0 deletions pyro/swe/unsplit_fluxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def unsplit_fluxes(my_data, rp, ivars, solid, tc, dt):

riemann = rp.get_param("swe.riemann")

riemannFunc = None
if riemann == "HLLC":
riemannFunc = ifc.riemann_hllc
elif riemann == "Roe":
Expand Down

0 comments on commit 6c5c619

Please sign in to comment.