Skip to content

Commit beac53d

Browse files
authored
Merge branch 'development' into joss_paper
2 parents aff4225 + bb3b040 commit beac53d

File tree

107 files changed

+4357
-4312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+4357
-4312
lines changed

.github/workflows/cuda.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
cd ../..
2727
2828
- name: Dependencies
29-
run: .github/workflows/dependencies/dependencies_nvcc11.sh
29+
run: .github/workflows/dependencies/dependencies_nvcc.sh 11.7
3030

3131
- name: compile test_react (aprox13)
3232
run: |

.github/workflows/dependencies/dependencies_hip.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ echo 'export PATH=/opt/rocm/llvm/bin:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/r
4040

4141
# we should not need to export HIP_PATH=/opt/rocm/hip with those installs
4242

43+
sudo apt-get clean
4344
sudo apt-get update
4445

4546
# Ref.: https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html#installing-development-packages-for-cross-compilation
@@ -56,7 +57,9 @@ sudo apt-get install -y --no-install-recommends \
5657
roctracer-dev \
5758
rocprofiler-dev \
5859
rocrand-dev \
59-
rocprim-dev
60+
rocfft-dev \
61+
rocprim-dev \
62+
rocsparse-dev
6063

6164
# hiprand-dev is a new package that does not exist in old versions
6265
sudo apt-get install -y --no-install-recommends hiprand-dev || true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2020-2022 Axel Huebl
4+
#
5+
# License: BSD-3-Clause-LBNL
6+
7+
set -eu -o pipefail
8+
9+
# `man apt.conf`:
10+
# Number of retries to perform. If this is non-zero APT will retry
11+
# failed files the given number of times.
12+
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries
13+
14+
sudo apt-get -qqq update
15+
sudo apt-get install -y \
16+
build-essential \
17+
ca-certificates \
18+
cmake \
19+
g++ \
20+
gfortran \
21+
gnupg \
22+
libopenmpi-dev \
23+
openmpi-bin \
24+
pkg-config \
25+
wget
26+
27+
VERSION_DOTTED=${1-12.0} && VERSION_DASHED=$(sed 's/\./-/' <<< $VERSION_DOTTED)
28+
curl -O https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
29+
sudo dpkg -i cuda-keyring_1.0-1_all.deb
30+
sudo apt-get update
31+
sudo apt-get install -y \
32+
cuda-command-line-tools-$VERSION_DASHED \
33+
cuda-compiler-$VERSION_DASHED \
34+
cuda-cupti-dev-$VERSION_DASHED \
35+
cuda-minimal-build-$VERSION_DASHED \
36+
cuda-nvml-dev-$VERSION_DASHED \
37+
cuda-nvtx-$VERSION_DASHED \
38+
libcufft-dev-$VERSION_DASHED \
39+
libcurand-dev-$VERSION_DASHED \
40+
libcusparse-dev-$VERSION_DASHED
41+
sudo ln -s cuda-$VERSION_DOTTED /usr/local/cuda

.github/workflows/dependencies/dependencies_nvcc11.sh

-34
This file was deleted.

.github/workflows/docs-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535

3636
- name: Build docs
3737
run: |
38-
cd sphinx_docs/
38+
cd Docs/
3939
make SPHINXOPTS='-v -W --keep-going' html
4040
4141
- name: Link check
4242
run: |
43-
cd sphinx_docs/
43+
cd Docs/
4444
make SPHINXOPTS=-v linkcheck

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ extern.f90
7878
# sphinx
7979
build/
8080
doxy_files
81-
sphinx_docs/source/runtime_parameters.rst
81+
Docs/source/runtime_parameters.rst
8282

8383

8484
# C++ parameters

CHANGES.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 25.01
2+
3+
* update HIP/CUDA dependences to include sparse libraries (#1686)
4+
5+
* rename `Opacity_dir` -> `OPACITY_DIR` (#1679)
6+
7+
* update the integration and NSE docs (#1682)
8+
19
# 24.12
210

311
* documentation improvements (#1661, #1667, #1670)

sphinx_docs/Doxyfile Docs/Doxyfile

File renamed without changes.

sphinx_docs/Makefile Docs/Makefile

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

sphinx_docs/rp.py Docs/rp.py

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

sphinx_docs/source/design.rst Docs/source/design.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ and the generic solvers:
1212

1313
* ``constants``: fundamental constants
1414

15+
* ``Docs``: the sphinx source for this documentation
16+
1517
* ``EOS/``: the various equations of state
1618

1719
* ``integration/``: the ODE integration routines used for the
@@ -34,8 +36,6 @@ and the generic solvers:
3436
* ``screening/``: common electron screening factors used by some of the
3537
reaction networks.
3638

37-
* ``sphinx_docs``: the sphinx source for this documentation
38-
3939
* ``unit_test/``: self-contained unit tests for Microphysics. These don’t
4040
need any application code to build, but will require AMReX.
4141

File renamed without changes.
File renamed without changes.
File renamed without changes.

sphinx_docs/source/index.rst Docs/source/index.rst

+8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ of state routines.
6060
networks
6161
templated_networks
6262
screening
63+
neutrinos
6364

6465
.. toctree::
6566
:maxdepth: 1
@@ -71,6 +72,13 @@ of state routines.
7172
nse
7273
sdc
7374

75+
.. toctree::
76+
:maxdepth: 1
77+
:caption: Util / external libraries
78+
:hidden:
79+
80+
util
81+
7482
.. toctree::
7583
:maxdepth: 1
7684
:caption: Unit tests

sphinx_docs/source/integrators.rst Docs/source/integrators.rst

+70-37
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ The equations we integrate to do a nuclear burn are:
1414
:label: eq:spec_integrate
1515
1616
.. math::
17-
\frac{de}{dt} = f(\rho,X_k,T)
17+
\frac{de}{dt} = \epsilon(\rho,X_k,T)
1818
:label: eq:enuc_integrate
1919
2020
Here, :math:`X_k` is the mass fraction of species :math:`k`, :math:`e`
2121
is the specific nuclear energy created through reactions. Also needed
2222
are density :math:`\rho`, temperature :math:`T`, and the specific
23-
heat. The function :math:`f` provides the energy release from
23+
heat. The function :math:`\epsilon` provides the energy release from
2424
reactions and can often be expressed in terms of the instantaneous
2525
reaction terms, :math:`\dot{X}_k`. As noted in the previous section,
2626
this is implemented in a network-specific manner.
@@ -46,7 +46,7 @@ energy. This allows us to easily call the EOS during the burn to obtain the temp
4646
:label: eq:spec_n_integrate
4747
4848
.. math::
49-
\frac{de}{dt} = f(\rho,n_k,T)
49+
\frac{de}{dt} = \epsilon(\rho,n_k,T)
5050
:label: eq:enuc_n_integrate
5151
5252
The effect of this flag in the integrators is that we don't worry
@@ -105,30 +105,50 @@ passed into the integration routines. For this reason, we often need
105105
to pass both the specific integrator's type (e.g. ``dvode_t``) and
106106
``burn_t`` objects into the lower-level network routines.
107107

108-
The overall flow of the integrator is (using VODE as the example):
108+
Below we outline the overall flow of the integrator (using VODE as the
109+
example). Most of the setup and cleanup after calling the particular
110+
integration routine is the same for all integrators, and is handled by
111+
the functions ``integrator_setup()`` and ``integrator_cleanup()``.
109112

110-
#. Call the EOS directly on the input ``burn_t`` state using :math:`\rho` and :math:`T` as inputs.
113+
.. index:: integrator.scale_system, burn_to_integrator, integrator_to_burn
114+
.. index:: integrator.call_eos_in_rhs, integrator.subtract_internal_energy, integrator.burner_verbose
115+
116+
#. Call the EOS directly on the input ``burn_t`` state using
117+
:math:`\rho` and :math:`T` as inputs.
118+
119+
#. Scale the absolute energy tolerance if we are using
120+
``integrator.scale_system``
111121

112122
#. Fill the integrator type by calling ``burn_to_integrator()`` to create a
113123
``dvode_t``.
114124

115-
#. call the ODE integrator, ``dvode()``, passing in the ``dvode_t`` _and_ the
125+
#. Save the initial thermodynamic state for diagnostics and optionally
126+
subtracting off the initial energy later.
127+
128+
#. Call the ODE integrator, ``dvode()``, passing in the ``dvode_t`` *and* the
116129
``burn_t`` --- as noted above, the auxiliary information that is
117130
not part of the integration state will be obtained from the
118131
``burn_t``.
119132

120-
#. subtract off the energy offset---we now store just the energy released
121-
in the ``dvode_t`` integration state.
133+
#. Convert back to a ``burn_t`` by calling ``integrator_to_burn``
122134

123-
#. convert back to a ``burn_t`` by calling ``integrator_to_burn``
135+
#. Recompute the temperature if we are using ``integrator.call_eos_in_rhs``.
124136

125-
#. normalize the abundances so they sum to 1.
137+
#. If we set ``integrator.subtract_internal_energy``, then subtract
138+
off the energy offset, the energy stored is now just that generated
139+
by reactions.
140+
141+
#. Normalize the abundances so they sum to 1 (except if ``integrator.use_number_density`` is set).
142+
143+
#. Output statistics on the integration if we set ``integrator.burner_verbose``.
144+
This is not recommended for big simulations, as it will output information
145+
for every zone's burn.
126146

127147
.. index:: integrator.subtract_internal_energy
128148

129-
.. note::
149+
.. important::
130150

131-
Upon exit, ``burn_t burn_state.e`` is the energy *released* during
151+
By default, upon exit, ``burn_t burn_state.e`` is the energy *released* during
132152
the burn, and not the actual internal energy of the state.
133153

134154
Optionally, by setting ``integrator.subtract_internal_energy=0``
@@ -155,7 +175,8 @@ The righthand side of the network is implemented by
155175

156176
.. code-block:: c++
157177

158-
void actual_rhs(burn_t& state, Array1D<Real, 1, neqs>& ydot)
178+
AMREX_GPU_HOST_DEVICE AMREX_INLINE
179+
void actual_rhs(burn_t& state, amrex::Array1D<amrex::Real, 1, neqs>& ydot)
159180

160181
All of the necessary integration data comes in through state, as:
161182

@@ -245,7 +266,11 @@ The analytic Jacobian is specific to each network and is provided by
245266

246267
.. code-block:: c++
247268

248-
void actual_jac(burn_t& state, MathArray2D<1, neqs, 1, neqs>& jac)
269+
template<class MatrixType>
270+
AMREX_GPU_HOST_DEVICE AMREX_INLINE
271+
void actual_jac(const burn_t& state, MatrixType& jac)
272+
273+
where the ``MatrixType`` is most commonly ``MathArray2D<1, neqs, 1, neqs>``
249274

250275
The Jacobian matrix elements are stored in ``jac`` as:
251276

@@ -316,13 +341,9 @@ Thermodynamics and :math:`e` Evolution
316341
======================================
317342

318343
The thermodynamic equation in our system is the evolution of the internal energy,
319-
:math:`e`.
320-
321-
.. note::
322-
323-
When the system is integrated in an operator-split approach, the
324-
energy equation accounts for only the nuclear energy release and
325-
not pdV work.
344+
:math:`e`. During the course of the integration, we ensure that the temperature stay
345+
below the value ``integrator.MAX_TEMP`` (defaulting to ``1.e11``) by clamping the
346+
temperature if necessary.
326347

327348
At initialization, :math:`e` is set to the value from the EOS consistent
328349
with the initial temperature, density, and composition:
@@ -331,28 +352,40 @@ with the initial temperature, density, and composition:
331352
332353
e_0 = e(\rho_0, T_0, {X_k}_0)
333354
334-
In the integration routines, this is termed the *energy offset*.
335-
336355
As the system is integrated, :math:`e` is updated to account for the
337-
nuclear energy release,
356+
nuclear energy release (and thermal neutrino losses),
357+
358+
.. math:: e(t) = e_0 + \int_{t_0}^t \epsilon(\dot{Y}_k) dt
359+
360+
.. note::
338361

339-
.. math:: e(t) = e_0 + \int_{t_0}^t f(\dot{Y}_k) dt
362+
When the system is integrated in an operator-split approach, the
363+
energy equation accounts for only the nuclear energy release and
364+
not pdV work.
340365

341-
As noted above, upon exit, we subtract off this initial offset, so ``state.e`` in
342-
the returned ``burn_t`` type from the ``actual_integrator``
343-
call represents the energy *release* during the burn.
366+
If ``integrator.subtract_internal_energy`` is set, then, on exit, we
367+
subtract off this initial $e_0$, so ``state.e`` in the returned
368+
``burn_t`` type from the ``actual_integrator`` call represents the
369+
energy *release* during the burn.
344370

345-
Integration of Equation :eq:`eq:enuc_integrate`
346-
requires an evaluation of the temperature at each integration step
347-
(since the RHS for the species is given in terms of :math:`T`, not :math:`e`).
348-
This involves an EOS call and is the default behavior of the integration.
349-
Note also that for the Jacobian, we need the specific heat, :math:`c_v`, since we
350-
usually calculate derivatives with respect to temperature (as this is the form
351-
the rates are commonly provided in).
371+
Integration of Equation :eq:`eq:enuc_integrate` requires an evaluation
372+
of the temperature at each integration step (since the RHS for the
373+
species is given in terms of :math:`T`, not :math:`e`). This involves
374+
an EOS call and is the default behavior of the integration.
375+
376+
Note also that for the Jacobian, we need the specific heat,
377+
:math:`c_v`, since we usually calculate derivatives with respect to
378+
temperature (as this is the form the rates are commonly provided in).
352379

353380
.. index:: integrator.call_eos_in_rhs
354381

355382
.. note::
356383

357-
If desired, the EOS call can be skipped and the temperature and $c_v$ kept
358-
frozen over the entire time interval of the integration by setting ``integrator.call_eos_in_rhs=0``.
384+
If desired, the EOS call can be skipped and the temperature and
385+
$c_v$ kept frozen over the entire time interval of the integration
386+
by setting ``integrator.call_eos_in_rhs=0``.
387+
388+
.. index:: integrator.integrate_energy
389+
390+
We also provide the option to completely remove the energy equation from
391+
the system by setting ``integrator.integrate_energy=0``.
File renamed without changes.
File renamed without changes.

sphinx_docs/source/networks.rst Docs/source/networks.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ is stored as ``mion(:)`` in the network.
2626

2727
The energy release per gram is converted from the rates as:
2828

29-
.. math:: \edot = -N_A c^2 \sum_k \frac{dY_k}{dt} M_k - \edotnu
29+
.. math:: \epsilon = -N_A c^2 \sum_k \frac{dY_k}{dt} M_k - \epsilon_\nu
3030

3131
where :math:`N_A` is Avogadro’s number (to convert this to “per gram”)
32-
and :math:`\edotnu` is the neutrino loss term.
32+
and :math:`\edotnu` is the neutrino loss term (see :ref:`neutrino_loss`).
3333

3434

3535
``general_null``
@@ -137,7 +137,7 @@ network is interpolated based on the density. It is stored as the
137137
binding energy (ergs/g) *per nucleon*, with a sign convention that
138138
binding energies are negative. The energy generation rate is then:
139139

140-
.. math:: \edot = q \frac{dX(\isotm{C}{12})}{dt} = q A_{\isotm{C}{12}} \frac{dY(\isotm{C}{12})}{dt}
140+
.. math:: \epsilon = q \frac{dX(\isotm{C}{12})}{dt} = q A_{\isotm{C}{12}} \frac{dY(\isotm{C}{12})}{dt}
141141

142142
(this is positive since both :math:`q` and :math:`dY/dt` are negative)
143143

@@ -244,7 +244,7 @@ Finally, for the
244244
energy generation, we take our reaction to release a specific energy,
245245
:math:`[\mathrm{erg~g^{-1}}]`, of :math:`\qburn`, and our energy source is
246246

247-
.. math:: \edot = -\qburn \frac{dX_f}{dt}
247+
.. math:: \epsilon = -\qburn \frac{dX_f}{dt}
248248

249249
There are a number of parameters we use to control the constants in
250250
this network. This is one of the few networks that was designed

0 commit comments

Comments
 (0)