Skip to content

Commit

Permalink
Merge branch 'main' into new_convection_bcs
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Jan 25, 2025
2 parents 1aae9fd + c2ecf50 commit 22e8988
Show file tree
Hide file tree
Showing 23 changed files with 181 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/regtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down
14 changes: 12 additions & 2 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,30 @@
"name": "Chen, Zhi",
"orcid": "0000-0002-2839-107X"
},
{
"affiliation": "McGill University",
"name": "Guichandut, Simon",
"orcid": "0000-0002-5211-2122"
},
{
"affiliation": "University of Southampton",
"name": "Hawke, Ian",
"orcid": "0000-0003-4805-0309"
},
{
"affiliation": "Department of Physics and Astronomy, Stony Brook University",
"name": "Harpole, Alice",
"orcid": "0000-0002-1530-781X"
},
{ "affiliation": "Department of Physics and Astronomy, Stony Brook University",
{
"affiliation": "Department of Physics and Astronomy, Stony Brook University",
"name": "Johnson, Eric",
"orcid": "0000-0003-3603-6868"
},
{
"affiliation": "Department of Physics and Astronomy, Stony Brook University",
"name": "Smith Clark, Alexander",
"orcid": "0000-0001-5961-1680"
},
{
"affiliation": "Department of Physics and Astronomy, Stony Brook University",
"name": "Zingale, Michael",
Expand Down
17 changes: 0 additions & 17 deletions CITATION

This file was deleted.

46 changes: 46 additions & 0 deletions CITATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
If you use pyro, please cite the pyro JOSS paper *and* the latest Zenodo DOI.

## JOSS

The pyro JOSS paper is at: https://joss.theoj.org/papers/10.21105/joss.01265

You can cite it as:

```bibtex
@article{pyro_joss,
doi = {10.21105/joss.01265},
url = {https://doi.org/10.21105/joss.01265},
year = {2019},
publisher = {The Open Journal},
volume = {4},
number = {34},
pages = {1265},
author = {Alice Harpole and Michael Zingale and Ian Hawke and Taher Chegini},
title = {pyro: a framework for hydrodynamics explorations and prototyping},
journal = {Journal of Open Source Software}
}
```

## Astronomy and Computing

You can also additionally cite the paper from *Astronomy and Computing*:

```bibtex
@article{pyro_ac,
author = {{Zingale}, M.},
title = "{pyro: A teaching code for computational astrophysical hydrodynamics}",
journal = {Astronomy and Computing},
year = 2014,
month = {oct},
volume = 6,
pages = {52-62},
doi = {10.1016/j.ascom.2014.07.003}
}
```

## Zenodo

The latest pyro Zenodo record is at https://doi.org/10.5281/zenodo.2575564



1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ help:
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
./document_problems.py
curl -L -H 'Accept: application/x-bibtex' https://zenodo.org/api/records/2575564 > source/zenodo.bibtex.txt
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
39 changes: 0 additions & 39 deletions docs/source/ack.rst
Original file line number Diff line number Diff line change
@@ -1,44 +1,5 @@
Acknowledgments
===============

The current pyro developers are listed in the `.zenodo.json` file that
is used for releases.

You are free to use this code and the accompanying notes in your
classes. Please credit "pyro development team" for the code, and
*please send a note to the pyro-help e-mail list describing how you
use it, so we can keep track of it (and help justify the development
effort).*

If you use pyro in a publication, please cite it using this bibtex
citation::

@article{pyro,
doi = {10.21105/joss.01265},
url = {https://doi.org/10.21105/joss.01265},
year = {2019},
publisher = {The Open Journal},
volume = {4},
number = {34},
pages = {1265},
author = {Alice Harpole and Michael Zingale and Ian Hawke and Taher Chegini},
title = {pyro: a framework for hydrodynamics explorations and prototyping},
journal = {Journal of Open Source Software}
}

pyro benefited from numerous useful discussions with Ann Almgren, John
Bell, and Andy Nonaka.


History
=======

The original pyro code was written in 2003-4 to help developer
Zingale understand these methods for himself. It was originally written
using the Numeric array package and handwritten C extensions for the
compute-intensive kernels. It was ported to numarray when that
replaced Numeric, and continued to use C extensions. This version
"pyro2" was resurrected beginning in 2012 and rewritten for numpy
using f2py, and brought up to date. Most recently we've dropped
f2py and are using numba for the compute-intensive kernels.

17 changes: 17 additions & 0 deletions docs/source/citing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Citing pyro
===========

You are free to use this code and the accompanying notes in your
classes. Please credit "pyro development team" for the code, and
*please make a post to the pyro github discussions describing how you
use it, so we can keep track of it (and help justify the development
effort).*

.. mdinclude:: ../../CITATION.md

The bibtex for the latest version is included below (updated automatically):

.. literalinclude:: ./zenodo.bibtex.txt
:language: bibtex


4 changes: 4 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
'sphinx_copybutton',
'sphinx_math_dollar',
'sphinx-prompt',
'sphinx_mdinclude',
'IPython.sphinxext.ipython_console_highlighting',
'sphinx.ext.githubpages']

Expand Down Expand Up @@ -182,6 +183,9 @@
r"https://doi.org/10.1061/(ASCE)0733-9429(1999)125:11(1210)",
r"https://pubs.aip.org/physicstoday/article/11/8/28/927415/Water-Waves"]

linkcheck_retries = 3
linkcheck_timeout = 100
linkcheck_allow_unauthorized = True

# -- Options for HTMLHelp output ------------------------------------------

Expand Down
12 changes: 12 additions & 0 deletions docs/source/history.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
History
=======

The original pyro code was written in 2003-4 to help developer
Zingale understand these methods for himself. It was originally written
using the Numeric array package and handwritten C extensions for the
compute-intensive kernels. It was ported to numarray when that
replaced Numeric, and continued to use C extensions. This version
"pyro2" was resurrected beginning in 2012 and rewritten for numpy
using f2py, and brought up to date. Most recently we've dropped
f2py and are using numba for the compute-intensive kernels.

2 changes: 2 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ new ideas.
:hidden:

help
history
ack
citing

.. toctree::
:maxdepth: 1
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/_defaults
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ grav = 0.0 ; gravitational acceleration (in y-direction)

riemann = HLLC ; HLLC or CGF

small_dens = -1.e200 ; minimum allowed density
small_eint = -1.e200 ; minimum allowed specific internal energy

[sponge]
do_sponge = 0 ; do we include a sponge source term
Expand Down
3 changes: 3 additions & 0 deletions pyro/compressible/derives.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def derive_primitives(myd, varnames):
elif var == "soundspeed":
derived_vars.append(np.sqrt(gamma*p/dens))

elif var == "machnumber":
derived_vars.append(np.sqrt(u**2 + v**2) / np.sqrt(gamma*p/dens))

elif var == "vorticity":
derived_vars.append(vort)

Expand Down
14 changes: 12 additions & 2 deletions pyro/compressible/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ def cons_to_prim(U, gamma, ivars, myg):
out=np.zeros_like(U[:, :, ivars.iener]),
where=(U[:, :, ivars.idens] != 0.0))

assert e.v().min() > 0.0
assert q.v(n=ivars.irho).min() > 0.0
e_min = e.v().min()
rho_min = q.v(n=ivars.irho).min()

assert e_min > 0.0 and rho_min > 0.0, f"invalid state, min(rho) = {rho_min}, min(e) = {e_min}"

q[:, :, ivars.ip] = eos.pres(gamma, q[:, :, ivars.irho], e)

Expand Down Expand Up @@ -291,6 +293,8 @@ def evolve(self):
timestep dt.
"""

self.clean_state(self.cc_data.data)

tm_evolve = self.tc.timer("evolve")
tm_evolve.begin()

Expand Down Expand Up @@ -435,6 +439,12 @@ def evolve(self):

tm_evolve.end()

def clean_state(self, U):
"""enforce minimum density and eint on the conserved state U"""

U.v(n=self.ivars.idens)[:, :] = np.maximum(U.v(n=self.ivars.idens),
self.rp.get_param("compressible.small_dens"))

def dovis(self):
"""
Do runtime visualization.
Expand Down
1 change: 1 addition & 0 deletions pyro/compressible_fv4/_defaults
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ grav = 0.0 ; gravitational acceleration (in y-direction)

riemann = CGF

small_dens = -1.e200 ; minimum allowed density

[sponge]
do_sponge = 0 ; do we include a sponge source term
Expand Down
38 changes: 3 additions & 35 deletions pyro/compressible_fv4/simulation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pyro.compressible_fv4.fluxes as flx
from pyro import compressible_rk
from pyro.compressible import get_external_sources, get_sponge_factor
from pyro.mesh import fv, integration
from pyro.mesh import fv


class Simulation(compressible_rk.Simulation):
Expand All @@ -19,6 +19,8 @@ def substep(self, myd):
compute the advective source term for the given state
"""

self.clean_state(myd.data)

myg = myd.grid

# compute the source terms -- we need to do this first
Expand Down Expand Up @@ -66,37 +68,3 @@ def preevolve(self):
# we just initialized cell-centers, but we need to store averages
for var in self.cc_data.names:
self.cc_data.from_centers(var)

def evolve(self):

"""
Evolve the equations of compressible hydrodynamics through a
timestep dt.
"""

tm_evolve = self.tc.timer("evolve")
tm_evolve.begin()

myd = self.cc_data

method = self.rp.get_param("compressible.temporal_method")

rk = integration.RKIntegrator(myd.t, self.dt, method=method)
rk.set_start(myd)

for s in range(rk.nstages()):
ytmp = rk.get_stage_start(s)
ytmp.fill_BC_all()
k = self.substep(ytmp)
rk.store_increment(s, k)

rk.compute_final_update()

if self.particles is not None:
self.particles.update_particles(self.dt)

# increment the time
myd.t += self.dt
self.n += 1

tm_evolve.end()
1 change: 1 addition & 0 deletions pyro/compressible_rk/_defaults
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ riemann = HLLC ; HLLC or CGF

well_balanced = 0 ; use a well-balanced scheme to keep the model in hydrostatic equilibrium

small_dens = -1.e200 ; minimum allowed density

[sponge]
do_sponge = 0 ; do we include a sponge source term
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible_rk/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def substep(self, myd):
conservative state defined as part of myd
"""

self.clean_state(myd.data)

myg = myd.grid

# source terms -- note: this dt is the entire dt, not the
Expand Down
5 changes: 1 addition & 4 deletions pyro/compressible_sdc/_defaults
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ delta = 0.33 ; flattening delta parameter

cvisc = 0.1 ; artificial viscosity coefficient

limiter = 2 ; limiter (0 = none, 1 = 2nd order, 2 = 4th order)

temporal_method = RK4 ; integration method (see mesh/integration.py)

grav = 0.0 ; gravitational acceleration (in y-direction)

riemann = CGF

small_dens = -1.e200 ; minimum allowed density

[sponge]
do_sponge = 0 ; do we include a sponge source term
Expand Down
Loading

0 comments on commit 22e8988

Please sign in to comment.