Skip to content

Commit

Permalink
template out the plasma neutrino derivatives (#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Sep 19, 2023
1 parent dfc865b commit 790ee20
Show file tree
Hide file tree
Showing 16 changed files with 462 additions and 306 deletions.
7 changes: 4 additions & 3 deletions networks/CNO_extras/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -1197,7 +1197,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/ECSN/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -629,7 +629,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * dsnuda + (zion[j-1] - state.zbar) * state.abar * dsnudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/ase/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -1646,7 +1646,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/ignition_reaclib/C-burn-simple/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -309,7 +309,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/ignition_reaclib/URCA-simple/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -343,7 +343,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/nova/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -746,7 +746,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/nova2/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -1058,7 +1058,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/partition_test/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -335,7 +335,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
10 changes: 6 additions & 4 deletions networks/rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -1348,9 +1348,10 @@ void rhs (burn_t& burn_state, Array1D<Real, 1, nrhs>& ydot)

// Evaluate the neutrino cooling.
#ifdef NEUTRINOS
constexpr int do_derivatives{0};
Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;
sneut5(burn_state.T, burn_state.rho, burn_state.abar, burn_state.zbar,
sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
sneut5<do_derivatives>(burn_state.T, burn_state.rho, burn_state.abar, burn_state.zbar,
sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
#else
Real sneut = 0.0;
#endif
Expand Down Expand Up @@ -1495,8 +1496,9 @@ void jac (burn_t& burn_state, ArrayUtil::MathArray2D<1, neqs, 1, neqs>& jac)
// Evaluate the neutrino cooling.
#ifdef NEUTRINOS
Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;
sneut5(burn_state.T, burn_state.rho, burn_state.abar, burn_state.zbar,
sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(burn_state.T, burn_state.rho, burn_state.abar, burn_state.zbar,
sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
#else
Real sneut = 0.0, dsneutdt = 0.0, dsneutdd = 0.0, dsnuda = 0.0, dsnudz = 0.0;
amrex::ignore_unused(sneut, dsneutdd);
Expand Down
7 changes: 4 additions & 3 deletions networks/sn160/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -10396,8 +10396,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -18028,7 +18028,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/subch_approx/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -1928,7 +1928,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/subch_full/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -2390,7 +2390,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
7 changes: 4 additions & 3 deletions networks/subch_simple/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -1227,8 +1227,8 @@ void actual_rhs (burn_t& state, Array1D<Real, 1, neqs>& ydot)
// Get the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;

sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{0};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

// Append the energy equation (this is erg/g/s)

Expand Down Expand Up @@ -1723,7 +1723,8 @@ void actual_jac(const burn_t& state, MatrixType& jac)
// Account for the thermal neutrino losses

Real sneut, dsneutdt, dsneutdd, snuda, snudz;
sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);
constexpr int do_derivatives{1};
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, snuda, snudz);

for (int j = 1; j <= NumSpec; ++j) {
Real b1 = (-state.abar * state.abar * snuda + (zion[j-1] - state.zbar) * state.abar * snudz);
Expand Down
Loading

0 comments on commit 790ee20

Please sign in to comment.