Skip to content

Commit f612aee

Browse files
authored
formatting, mainly to force numpy 2.0 github actions (#202)
1 parent d5920a3 commit f612aee

File tree

11 files changed

+83
-83
lines changed

11 files changed

+83
-83
lines changed

README.md

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ https://python-hydro.github.io/pyro2
5656
- We require `numpy`, `numba`, `matplotlib`, and `h5py` for running pyro
5757
and `setuptools_scm` for the install.
5858

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

6162
```
6263
pip install pyro-hydro
@@ -85,7 +86,8 @@ https://python-hydro.github.io/pyro2
8586
print matplotlib.pyplot.get_backend()
8687
```
8788
88-
- If you want to run the unit tests, you need to have `pytest` installed.
89+
- If you want to run the unit tests, you need to have `pytest`
90+
installed.
8991
9092
- Finally, you can run a quick test of the advection solver:
9193
@@ -105,8 +107,8 @@ on the grid are described in a jupyter notebook:
105107
https://github.com/python-hydro/pyro2/blob/main/pyro/mesh/mesh-examples.ipynb
106108
107109
108-
Many of the methods here rely on multigrid. The basic multigrid solver is
109-
demonstrated in the juputer notebook:
110+
Many of the methods here rely on multigrid. The basic multigrid
111+
solver is demonstrated in the juputer notebook:
110112
111113
https://github.com/python-hydro/pyro2/blob/main/pyro/multigrid/multigrid-constant-coefficients.ipynb
112114
@@ -123,7 +125,8 @@ pyro provides the following solvers (all in 2-d):
123125
- `advection_fv4`: a fourth-order accurate finite-volume advection
124126
solver that uses RK4 time integration.
125127
126-
- `advection_nonuniform`: a solver for advection with a non-uniform velocity field.
128+
- `advection_nonuniform`: a solver for advection with a non-uniform
129+
velocity field.
127130
128131
- `advection_rk`: a second-order unsplit solver for linear advection
129132
that uses Runge-Kutta integration instead of characteristic
@@ -132,27 +135,28 @@ pyro provides the following solvers (all in 2-d):
132135
- `advection_weno`: a method-of-lines WENO solver for linear
133136
advection.
134137
135-
- `burgers`: a second-order unsplit solver for invsicid Burgers' equation.
138+
- `burgers`: a second-order unsplit solver for invsicid Burgers'
139+
equation.
136140
137-
- `viscous_burgers`: a second-order unsplit solver for viscous Burgers' equation
138-
with constant-coefficient diffusion. It uses Crank-Nicolson time-discretized
139-
solver for solving diffusion.
141+
- `viscous_burgers`: a second-order unsplit solver for viscous
142+
Burgers' equation with constant-coefficient diffusion. It uses
143+
Crank-Nicolson time-discretized solver for solving diffusion.
140144
141145
- `compressible`: a second-order unsplit solver for the Euler
142146
equations of compressible hydrodynamics. This uses characteristic
143147
tracing and corner coupling for the prediction of the interface
144148
states and a 2-shock or HLLC approximate Riemann solver.
145149
146-
- `compressible_fv4`: a fourth-order accurate finite-volume compressible
147-
hydro solver that uses RK4 time integration. This is built from the
148-
method of McCourquodale and Colella (2011).
150+
- `compressible_fv4`: a fourth-order accurate finite-volume
151+
compressible hydro solver that uses RK4 time integration. This
152+
is built from the method of McCourquodale and Colella (2011).
149153
150154
- `compressible_rk`: a second-order unsplit solver for Euler
151-
equations that uses Runge-Kutta integration instead of
152-
characteristic tracing.
155+
equations that uses Runge-Kutta integration instead of
156+
characteristic tracing.
153157
154-
- `compressible_sdc`: a fourth-order compressible solver,
155-
using spectral-deferred correction (SDC) for the time integration.
158+
- `compressible_sdc`: a fourth-order compressible solver, using
159+
spectral-deferred correction (SDC) for the time integration.
156160
157161
- `diffusion`: a Crank-Nicolson time-discretized solver for the
158162
constant-coefficient diffusion equation.
@@ -188,29 +192,30 @@ of the simulation specifying the analysis routines that can be used
188192
with their data.
189193
190194
- `pyro/util/compare.py`: this takes two simulation output files as
191-
input and compares zone-by-zone for exact agreement. This is used as
192-
part of the regression testing.
195+
input and compares zone-by-zone for exact agreement. This is used
196+
as part of the regression testing.
193197
194198
usage: `./compare.py file1 file2`
195199
196-
- `pyro/plot.py`: this takes the an output file as input and plots the
197-
data using the solver's dovis method.
200+
- `pyro/plot.py`: this takes the an output file as input and plots
201+
the data using the solver's dovis method.
198202
199203
usage: `./plot.py file`
200204
201205
- `pyro/analysis/`
202206
203-
* `dam_compare.py`: this takes an output file from the
204-
shallow water dam break problem and plots a slice through the domain
205-
together with the analytic solution (calculated in the script).
207+
* `dam_compare.py`: this takes an output file from the shallow
208+
water dam break problem and plots a slice through the domain
209+
together with the analytic solution (calculated in the
210+
script).
206211
207212
usage: `./dam_compare.py file`
208213
209-
* `gauss_diffusion_compare.py`: this is for the diffusion solver's
210-
Gaussian diffusion problem. It takes a sequence of output
211-
files as arguments, computes the angle-average, and the plots
212-
the resulting points over the analytic solution for comparison
213-
with the exact result.
214+
* `gauss_diffusion_compare.py`: this is for the diffusion
215+
solver's Gaussian diffusion problem. It takes a sequence of
216+
output files as arguments, computes the angle-average, and the
217+
plots the resulting points over the analytic solution for
218+
comparison with the exact result.
214219
215220
usage: `./gauss_diffusion_compare.py file*`
216221
@@ -233,9 +238,9 @@ with their data.
233238
234239
usage: `./sedov_compare.py file`
235240
236-
* `smooth_error.py`: this takes an output file from the advection
237-
solver's smooth problem and compares to the analytic solution,
238-
outputting the L2 norm of the error.
241+
* `smooth_error.py`: this takes an output file from the
242+
advection solver's smooth problem and compares to the analytic
243+
solution, outputting the L2 norm of the error.
239244
240245
usage: `./smooth_error.py file`
241246
@@ -248,8 +253,8 @@ with their data.
248253
249254
## Understanding the algorithms
250255
251-
There is a set of notes that describe the background and details of the
252-
algorithms that pyro implements:
256+
There is a set of notes that describe the background and details of
257+
the algorithms that pyro implements:
253258
254259
http://open-astrophysics-bookshelf.github.io/numerical_exercises/
255260
@@ -260,10 +265,10 @@ with their data.
260265
261266
## Regression and unit testing
262267
263-
The `pyro/test.py` script will run several of the problems (as well as
264-
some stand-alone multigrid tests) and compare the solution to stored
265-
benchmarks (in each solver's `tests/` subdirectory). The return value
266-
of the script is the number of tests that failed.
268+
The `pyro/test.py` script will run several of the problems (as well
269+
as some stand-alone multigrid tests) and compare the solution to
270+
stored benchmarks (in each solver's `tests/` subdirectory). The
271+
return value of the script is the number of tests that failed.
267272
268273
Unit tests are controlled by pytest and can be run simply via
269274
@@ -273,8 +278,8 @@ with their data.
273278
274279
## Acknowledgements
275280
276-
If you use pyro in a class or workshop, please e-mail us to let us know
277-
(we'd like to start listing these on the website).
281+
If you use pyro in a class or workshop, please e-mail us to let us
282+
know (we'd like to start listing these on the website).
278283
279284
If pyro was used for a publication, please cite the article found in
280285
the `CITATION` file.

docs/source/refs.bib

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ @article{ZALESAK1979335
3232
year = "1979",
3333
issn = "0021-9991",
3434
doi = "https://doi.org/10.1016/0021-9991(79)90051-2",
35-
url = "http://www.sciencedirect.com/science/article/pii/0021999179900512",
3635
author = "Steven T Zalesak",
3736
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."
3837
}

pyro/compressible/unsplit_fluxes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ def unsplit_fluxes(my_data, my_aux, rp, ivars, solid, tc, dt):
287287

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

290+
riemannFunc = None
290291
if riemann == "HLLC":
291292
riemannFunc = ifc.riemann_hllc
292293
elif riemann == "CGF":

pyro/compressible_rk/fluxes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def fluxes(my_data, rp, ivars, solid, tc):
166166

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

169+
riemannFunc = None
169170
if riemann == "HLLC":
170171
riemannFunc = interface.riemann_hllc
171172
elif riemann == "CGF":

pyro/compressible_sr/unsplit_fluxes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def unsplit_fluxes(my_data, my_aux, rp, ivars, solid, tc, dt):
270270

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

273+
riemannFunc = None
273274
if riemann == "HLLC":
274275
riemannFunc = ifc.riemann_hllc
275276
elif riemann == "CGF":

pyro/incompressible/simulation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def initialize(self, other_bc=False, aux_vars=()):
3737

3838
# phi -- used for the projections. Has neumann BC's if v is dirichlet
3939
# Assuming BC's are either all periodic or all dirichlet
40+
phi_bc = None
4041
if bc.xlb == "periodic":
4142
phi_bc = bc
4243
elif bc.xlb == "dirichlet":

pyro/lm_atm/simulation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def initialize(self):
7575
self.rp.get_param("mesh.xrboundary"),
7676
self.rp.get_param("mesh.ylboundary"),
7777
self.rp.get_param("mesh.yrboundary")]:
78+
bctype = None
7879
if bc == "periodic":
7980
bctype = "periodic"
8081
elif bc in ["reflect", "slipwall"]:

pyro/mesh/array_indexer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ def pretty_print(self, n=0, fmt=None, show_ghost=True):
507507

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

538+
gc = None
539+
537540
if self.idir == 1:
538541
if (j < self.g.jlo or j > self.g.jhi or
539542
i < self.g.ilo or i > self.g.ihi+1):

pyro/mesh/mesh-examples.ipynb

Lines changed: 27 additions & 41 deletions
Large diffs are not rendered by default.

pyro/mesh/patch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,11 +703,12 @@ def create(self):
703703
if self.idir == 1:
704704
_tmp = np.zeros((self.grid.qx+1, self.grid.qy, self.nvar),
705705
dtype=self.dtype)
706+
self.data = ArrayIndexerFC(_tmp, idir=self.idir, grid=self.grid)
707+
706708
elif self.idir == 2:
707709
_tmp = np.zeros((self.grid.qx, self.grid.qy+1, self.nvar),
708710
dtype=self.dtype)
709-
710-
self.data = ArrayIndexerFC(_tmp, idir=self.idir, grid=self.grid)
711+
self.data = ArrayIndexerFC(_tmp, idir=self.idir, grid=self.grid)
711712

712713
self.initialized = 1
713714

0 commit comments

Comments
 (0)