Skip to content

Commit 9aff213

Browse files
committed
Merge branch 'doc_burn_cell_sdc' of github.com:zingale/Microphysics into doc_burn_cell_sdc
2 parents 8feb066 + cf10ab0 commit 9aff213

File tree

50 files changed

+437
-479
lines changed

Some content is hidden

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

50 files changed

+437
-479
lines changed

.github/workflows/dependencies/dependencies_hip.sh

+11-9
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ sudo apt-key add rocm.gpg.key
3333

3434
source /etc/os-release # set UBUNTU_CODENAME: focal or jammy or ...
3535

36-
echo "deb [arch=amd64] https://repo.radeon.com/rocm/apt/${1-latest} ${UBUNTU_CODENAME} main" \
36+
VERSION=${1-6.3.2}
37+
38+
echo "deb [arch=amd64] https://repo.radeon.com/rocm/apt/${VERSION} ${UBUNTU_CODENAME} main" \
3739
| sudo tee /etc/apt/sources.list.d/rocm.list
3840
echo 'export PATH=/opt/rocm/llvm/bin:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin:$PATH' \
3941
| sudo tee -a /etc/profile.d/rocm.sh
@@ -53,16 +55,16 @@ sudo apt-get install -y --no-install-recommends \
5355
libnuma-dev \
5456
libopenmpi-dev \
5557
openmpi-bin \
56-
rocm-dev \
57-
roctracer-dev \
58-
rocprofiler-dev \
59-
rocrand-dev \
60-
rocfft-dev \
61-
rocprim-dev \
62-
rocsparse-dev
58+
rocm-dev${VERSION} \
59+
roctracer-dev${VERSION} \
60+
rocprofiler-dev${VERSION} \
61+
rocrand-dev${VERSION} \
62+
rocfft-dev${VERSION} \
63+
rocprim-dev${VERSION} \
64+
rocsparse-dev${VERSION}
6365

6466
# hiprand-dev is a new package that does not exist in old versions
65-
sudo apt-get install -y --no-install-recommends hiprand-dev || true
67+
sudo apt-get install -y --no-install-recommends hiprand-dev${VERSION} || true
6668

6769
# activate
6870
#

.github/workflows/hip.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ concurrency:
88

99
jobs:
1010
hip-compile:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-24.04
1212
steps:
1313
- uses: actions/checkout@v4
1414
with:
@@ -27,7 +27,7 @@ jobs:
2727
cd ../..
2828
2929
- name: Dependencies
30-
run: .github/workflows/dependencies/dependencies_hip.sh
30+
run: .github/workflows/dependencies/dependencies_hip.sh 6.3.2
3131

3232
- name: compile test_react with HIP (iso7)
3333
run: |

Docs/source/comprehensive_tests.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _sec:comprehensive_tests:
2+
13
************************
24
Comprehensive Unit Tests
35
************************

Docs/source/integrators.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ routine (at the moment this can be ``VODE``, ``BackwardEuler``, ``ForwardEuler``
8888
.. code-block:: c++
8989

9090
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
91-
void burner (burn_t& state, Real dt)
91+
void burner (burn_t& state, amrex::Real dt)
9292

9393
The input is a ``burn_t``.
9494

@@ -198,7 +198,7 @@ be computed as:
198198

199199
.. code-block:: c++
200200

201-
Array1D<Real, 1, NumSpec> y;
201+
amrex::Array1D<amrex::Real, 1, NumSpec> y;
202202
...
203203
for (int i = 1; i <= NumSpec; ++i) {
204204
y(i) = state.xn[i-1] * aion_inv[i-1];

Docs/source/one_zone_tests.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _sec:one_zone_tests:
2+
13
**************
24
One Zone Tests
35
**************

Docs/source/templated_networks.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ The main logic for constructing RHS is contained in ``Microphysics/networks/rhs.
312312
.. code:: c++
313313

314314
AMREX_GPU_HOST_DEVICE AMREX_INLINE
315-
void rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
315+
void rhs (burn_t& state, amrex::Array1D<amrex::Real, 1, neqs>& ydot)
316316

317317
The basic flow is:
318318

Docs/source/transport.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ The interface for these opacities is:
8585
.. code:: c++
8686

8787
AMREX_GPU_HOST_DEVICE AMREX_INLINE
88-
void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu,
88+
void actual_opacity (amrex::Real& kp, amrex::Real& kr,
89+
amrex::Real rho, amrex::Real temp, amrex::Real rhoYe, amrex::Real nu,
8990
bool get_Planck_mean, bool get_Rosseland_mean)
9091

9192
where the boolean ``get_Planck_mean`` and ``get_Rosseland_mean`` specify where those

Docs/source/unit_test_runtime_parameters.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ Most of the unit tests require a composition to be defined (for the
2525
initial mass-fractions, $X_k$). There are a few ways this can be done
2626
(depending on the test).
2727

28-
* One-zone (``*_cell``) tests usually do one of:
28+
29+
* One-zone (``*_cell``) tests (see :ref:`sec:one_zone_tests`) usually do one of:
2930

3031
* *Explicitly setting the individual mass fractions.* This is
3132
controlled by the parameters ``unit_test.X1``, ``unit_test.X2``, ..., ``unit_test.X35``,
@@ -45,7 +46,8 @@ initial mass-fractions, $X_k$). There are a few ways this can be done
4546
``unit_test.uniform_xn``. If this is set to ``1``, then each mass fraction
4647
is initialized to ``1 / NumSpec``.
4748

48-
* Comprehensive tests need many different compositions, since they are creating a cube
49+
* Comprehensive tests (see :ref:`sec:comprehensive_tests`) need many different compositions, since they are creating a cube
50+
4951
of varying thermodynamic properties, and thus require a prescription
5052
to create the composition. This is done by setting ``unit_test.primary_species_1``,
5153
``unit_test.primary_species_2``, and ``unit_test.primary_species_3`` to one of the

EOS/multigamma/eos_composition.H

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
using namespace amrex::literals;
99

1010
struct eos_xderivs_t {
11-
Real dedX[NumSpec];
12-
Real dpdX[NumSpec];
13-
Real dhdX[NumSpec];
11+
amrex::Real dedX[NumSpec];
12+
amrex::Real dpdX[NumSpec];
13+
amrex::Real dhdX[NumSpec];
1414
};
1515

1616
// Given a set of mass fractions, calculate quantities that depend
@@ -32,7 +32,7 @@ void subroutine (T& state)
3232
}
3333
state.mu_e = 1.0_rt / state.y_e;
3434

35-
Real sum = 0.0_rt;
35+
amrex::Real sum = 0.0_rt;
3636
for (int n = 0; n < NumSpec; ++n) {
3737
sum = sum + state.xn[n] * aion_inv[n];
3838
}
@@ -51,7 +51,7 @@ eos_x_derivs_t composition_derivatives (const T& state)
5151
eos_xderivs_t state_xderivs;
5252

5353
// Get the mass of a nucleon from Avogadro's number.
54-
const Real m_nucleon = 1.0_rt / n_A;
54+
const amrex::Real m_nucleon = 1.0_rt / n_A;
5555

5656
// Composition derivatives
5757

EOS/ztwd/actual_eos.H

+21-21
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ using namespace amrex::literals;
2727

2828
const std::string eos_name = "ztwd";
2929

30-
const Real A = M_PI * amrex::Math::powi<4>(C::m_e) * amrex::Math::powi<5>(C::c_light) / (3.0_rt * amrex::Math::powi<3>(C::hplanck));
31-
const Real B2 = 8.0_rt * M_PI * amrex::Math::powi<3>(C::m_e) * amrex::Math::powi<3>(C::c_light) * C::m_p / (3.0_rt * amrex::Math::powi<3>(C::hplanck));
32-
const Real iter_tol = 1.e-10_rt;
30+
const amrex::Real A = M_PI * amrex::Math::powi<4>(C::m_e) * amrex::Math::powi<5>(C::c_light) / (3.0_rt * amrex::Math::powi<3>(C::hplanck));
31+
const amrex::Real B2 = 8.0_rt * M_PI * amrex::Math::powi<3>(C::m_e) * amrex::Math::powi<3>(C::c_light) * C::m_p / (3.0_rt * amrex::Math::powi<3>(C::hplanck));
32+
const amrex::Real iter_tol = 1.e-10_rt;
3333
const int max_iter = 1000;
3434

3535
inline
@@ -43,7 +43,7 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
4343
bool is_input_valid (I input)
4444
{
4545
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
46-
46+
amrex::ignore_unused(input);
4747
bool valid = true;
4848

4949
return valid;
@@ -52,23 +52,23 @@ bool is_input_valid (I input)
5252

5353

5454
AMREX_GPU_HOST_DEVICE AMREX_INLINE
55-
Real pressure (Real x)
55+
amrex::Real pressure (amrex::Real x)
5656
{
5757
return A * (x * (2.0_rt * x * x - 3.0_rt) * std::sqrt(x * x + 1.0_rt) + 3.0_rt * std::asinh(x));
5858
}
5959

6060

6161

6262
AMREX_GPU_HOST_DEVICE AMREX_INLINE
63-
Real enthalpy (Real x, Real B)
63+
amrex::Real enthalpy (amrex::Real x, amrex::Real B)
6464
{
6565
return (8.0_rt * A / B) * std::sqrt(1.0_rt + x * x);
6666
}
6767

6868

6969

7070
AMREX_GPU_HOST_DEVICE AMREX_INLINE
71-
Real dpdx (Real x)
71+
amrex::Real dpdx (amrex::Real x)
7272
{
7373
return A * ((2.0_rt * x * x - 3.0_rt) * std::sqrt(x * x + 1.0_rt) +
7474
x * (4.0_rt * x) * std::sqrt(x * x + 1.0_rt) +
@@ -79,7 +79,7 @@ Real dpdx (Real x)
7979

8080

8181
AMREX_GPU_HOST_DEVICE AMREX_INLINE
82-
Real dhdx (Real x, Real B)
82+
amrex::Real dhdx (amrex::Real x, amrex::Real B)
8383
{
8484
return enthalpy(x, B) * (x / (x * x + 1.0_rt));
8585
}
@@ -88,12 +88,12 @@ Real dhdx (Real x, Real B)
8888

8989

9090
AMREX_GPU_HOST_DEVICE AMREX_INLINE
91-
void pres_iter (Real pres, Real& dens, Real B)
91+
void pres_iter (amrex::Real pres, amrex::Real& dens, amrex::Real B)
9292
{
9393

9494
// Starting guess for the iteration.
9595

96-
Real x = 1.0_rt;
96+
amrex::Real x = 1.0_rt;
9797

9898
// We are solving the equation:
9999
// f(x) = p_want - p(x) = 0.
@@ -104,7 +104,7 @@ void pres_iter (Real pres, Real& dens, Real B)
104104

105105
for (iter = 1; iter <= max_iter; ++iter)
106106
{
107-
Real dx = (pres - pressure(x)) / dpdx(x);
107+
amrex::Real dx = (pres - pressure(x)) / dpdx(x);
108108

109109
x = x + dx;
110110

@@ -131,32 +131,32 @@ void actual_eos (I input, T& state)
131131
{
132132
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");
133133

134-
Real dens = state.rho;
135-
Real temp = state.T;
134+
amrex::Real dens = state.rho;
135+
amrex::Real temp = state.T;
136136

137-
Real pres = 1.0_rt;
137+
amrex::Real pres = 1.0_rt;
138138
if constexpr (has_pressure<T>::value) {
139139
pres = state.p;
140140
}
141141

142-
Real enth = 1.0_rt;
142+
amrex::Real enth = 1.0_rt;
143143
if constexpr (has_enthalpy<T>::value) {
144144
enth = state.h;
145145
}
146146

147-
Real eint = 1.0_rt;
147+
amrex::Real eint = 1.0_rt;
148148
if constexpr (has_energy<T>::value) {
149149
eint = state.e;
150150
}
151151

152-
Real entr = 1.0_rt;
152+
amrex::Real entr = 1.0_rt;
153153
if constexpr (has_entropy<T>::value) {
154154
entr = state.s;
155155
}
156156

157-
Real B = B2 * state.mu_e;
157+
amrex::Real B = B2 * state.mu_e;
158158

159-
Real x, dxdr;
159+
amrex::Real x, dxdr;
160160

161161
switch (input) {
162162

@@ -321,8 +321,8 @@ void actual_eos (I input, T& state)
321321
x = std::cbrt(dens / B);
322322
dxdr = (1.0_rt / 3.0_rt) * x / dens;
323323

324-
Real dpdr = dxdr * dpdx(x);
325-
Real dhdr = dxdr * dhdx(x, B);
324+
amrex::Real dpdr = dxdr * dpdx(x);
325+
amrex::Real dhdr = dxdr * dhdx(x, B);
326326

327327
if constexpr (has_pressure<T>::value) {
328328
state.dpdr = dpdr;

conductivity/stellar/actual_conductivity.H

+1-3
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ actual_conductivity (T& state)
127127
amrex::Real xkaz = 50.0_rt*xz*xka1 * std::exp(-0.5206_rt*amrex::Math::powi<2>((std::log(state.rho)-d0log)/xkw));
128128
amrex::Real dbar2log = -(4.283_rt + 0.7196_rt*xh) + 3.86_rt*std::log(t6);
129129
amrex::Real dbar1log = -5.296_rt + 4.833_rt*std::log(t6);
130-
if (dbar2log < dbar1log) {
131-
dbar1log = dbar2log;
132-
}
130+
dbar1log = std::min(dbar1log, dbar2log);
133131
oiben2 = std::pow(state.rho/std::exp(dbar1log), 0.67_rt) * std::exp(xkaz);
134132
}
135133

integration/nse_update_sdc.H

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#ifndef NSE_UPDATE_H
22
#define NSE_UPDATE_H
33

4-
#include <AMReX_Algorithm.H>
5-
64
#include <iostream>
75
#include <fstream>
86
#include <actual_network.H>

integration/utils/nonaka_plot.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void nonaka_init() {
5252

5353
template <typename BurnT>
5454
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
55-
void nonaka_rhs(const Real time, const BurnT& state, const YdotNetArray1D& ydot_react) {
55+
void nonaka_rhs(const amrex::Real time, const BurnT& state, const YdotNetArray1D& ydot_react) {
5656

5757
// state: the burn_t corresponding to the current state note:
5858
// state.time is relative to the start of the current burn call,
@@ -74,7 +74,7 @@ void nonaka_rhs(const Real time, const BurnT& state, const YdotNetArray1D& ydot_
7474
nf.open(nonaka_file, std::ios::app);
7575

7676

77-
Real simulation_time = time + state.reference_time;
77+
amrex::Real simulation_time = time + state.reference_time;
7878

7979
nf << std::setw(FIELD_WIDTH) << simulation_time << " ";
8080

networks/aprox21/actual_network.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ namespace RHS {
235235

236236
rhs_t data;
237237

238-
switch (rate) {
238+
switch (rate) { // NOLINT(bugprone-switch-missing-default-case)
239239

240240
case P_to_N:
241241
// irpen and irnep in the original aprox21

nse_solver/nse_eos.H

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ nse_T_abar_from_e(const amrex::Real rho, const amrex::Real e_in,
102102
amrex::Real &T, amrex::Real &abar,
103103
amrex::Real &mu_p, amrex::Real &mu_n) {
104104

105-
constexpr Real ttol{1.e-8_rt};
105+
constexpr amrex::Real ttol{1.e-8_rt};
106106
constexpr int max_iter{100};
107107

108108
bool converged{false};
@@ -148,8 +148,8 @@ nse_T_abar_from_e(const amrex::Real rho, const amrex::Real e_in,
148148

149149
// compute the correction to our guess
150150

151-
Real dT = -f / (eos_state.dedT + eos_state.dedA * dabar_dT
152-
+ Ye * eos_state.dedZ * dabar_dT);
151+
amrex::Real dT = -f / (eos_state.dedT + eos_state.dedA * dabar_dT
152+
+ Ye * eos_state.dedZ * dabar_dT);
153153

154154
// update the temperature and abar
155155

opacity/breakout/actual_opacity.H

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ AMREX_INLINE
99
void actual_opacity_init () {}
1010

1111
AMREX_GPU_HOST_DEVICE AMREX_INLINE
12-
void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu,
12+
void actual_opacity (amrex::Real& kp, amrex::Real& kr,
13+
amrex::Real rho, amrex::Real temp, amrex::Real rhoYe, amrex::Real nu,
1314
bool get_Planck_mean, bool get_Rosseland_mean)
1415
{
15-
const Real Ksc = 0.4e0; // Thomson scattering
16-
const Real fac = 1.e-4; // Planck mean is assumed to be fac * Ksc
16+
const amrex::Real Ksc = 0.4e0; // Thomson scattering
17+
const amrex::Real fac = 1.e-4; // Planck mean is assumed to be fac * Ksc
1718

1819
if (get_Planck_mean) {
1920
kp = rhoYe * Ksc * fac;
@@ -25,5 +26,3 @@ void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real n
2526
}
2627

2728
#endif
28-
29-

opacity/opacity.H

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ void opacity_init ()
1010
}
1111

1212
AMREX_GPU_HOST_DEVICE AMREX_INLINE
13-
void opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu,
13+
void opacity (Real& kp, amrex::Real& kr, amrex::Real rho,
14+
amrex::Real temp, amrex::Real rhoYe, amrex::Real nu,
1415
bool get_Planck_mean, bool get_Rosseland_mean)
1516
{
1617
actual_opacity(kp, kr, rho, temp, rhoYe, nu, get_Planck_mean, get_Rosseland_mean);

0 commit comments

Comments
 (0)