Skip to content

Commit

Permalink
Merge branch 'development' into new-amu
Browse files Browse the repository at this point in the history
  • Loading branch information
psharda authored Jul 19, 2023
2 parents 5ec9e05 + 0ef8cc6 commit 6081168
Show file tree
Hide file tree
Showing 30 changed files with 24,589 additions and 24,872 deletions.
26 changes: 26 additions & 0 deletions interfaces/rhs_type.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@
#endif
#include <tfactors.H>

// Implementation of "constexpr for" based on
// https://artificial-mind.net/blog/2020/10/31/constexpr-for
//
// Approximates what one would get from a compile-time
// unrolling of the loop
// for (int i = 0; i < N; ++i) {
// f(i);
// }
//
// The mechanism is recursive, we evaluate f(i) at the current
// i and then call the for loop at i+1. f() is a lambda function
// that provides the body of the loop and takes only an integer
// i as its argument. It is assumed that at the loop call site
// the lambda is declared [&] so that it can operate on whatever
// data it needs.

template<auto I, auto N, class F>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
constexpr void constexpr_for (F&& f)
{
if constexpr (I < N) {
f(std::integral_constant<decltype(I), I>());
constexpr_for<I+1, N>(f);
}
}

namespace RHS
{

Expand Down
12,011 changes: 5,930 additions & 6,081 deletions networks/ECSN/20f-20ne_betadecay.dat

Large diffs are not rendered by default.

12,011 changes: 5,930 additions & 6,081 deletions networks/ECSN/20f-20o_electroncapture.dat

Large diffs are not rendered by default.

12,011 changes: 5,930 additions & 6,081 deletions networks/ECSN/20ne-20f_electroncapture.dat

Large diffs are not rendered by default.

12,011 changes: 5,930 additions & 6,081 deletions networks/ECSN/20o-20f_betadecay.dat

Large diffs are not rendered by default.

90 changes: 53 additions & 37 deletions networks/ECSN/actual_network.H
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ namespace Rates

enum NetworkRates
{
k_ne20__he4_o16 = 1,
k_he4_o16__ne20 = 2,
k_he4_ne20__mg24 = 3,
k_he4_mg24__si28 = 4,
k_p_al27__si28 = 5,
k_he4_al27__p31 = 6,
k_he4_si28__s32 = 7,
k_p_p31__s32 = 8,
k_o16_o16__p_p31 = 9,
k_o16_o16__he4_si28 = 10,
k_he4_mg24__p_al27 = 11,
k_p_al27__he4_mg24 = 12,
k_he4_si28__p_p31 = 13,
k_p_p31__he4_si28 = 14,
k_f20__o20 = 15,
k_ne20__f20 = 16,
k_o20__f20 = 17,
k_f20__ne20 = 18,
NumRates = k_f20__ne20
k_ne20_to_he4_o16 = 1,
k_he4_o16_to_ne20 = 2,
k_he4_ne20_to_mg24 = 3,
k_he4_mg24_to_si28 = 4,
k_p_al27_to_si28 = 5,
k_he4_al27_to_p31 = 6,
k_he4_si28_to_s32 = 7,
k_p_p31_to_s32 = 8,
k_o16_o16_to_p_p31 = 9,
k_o16_o16_to_he4_si28 = 10,
k_he4_mg24_to_p_al27 = 11,
k_p_al27_to_he4_mg24 = 12,
k_he4_si28_to_p_p31 = 13,
k_p_p31_to_he4_si28 = 14,
k_f20_to_o20 = 15,
k_ne20_to_f20 = 16,
k_o20_to_f20 = 17,
k_f20_to_ne20 = 18,
NumRates = k_f20_to_ne20
};

// number of reaclib rates
Expand All @@ -59,26 +59,42 @@ namespace Rates

static const std::vector<std::string> rate_names = {
"", // 0
"ne20__he4_o16", // 1,
"he4_o16__ne20", // 2,
"he4_ne20__mg24", // 3,
"he4_mg24__si28", // 4,
"p_al27__si28", // 5,
"he4_al27__p31", // 6,
"he4_si28__s32", // 7,
"p_p31__s32", // 8,
"o16_o16__p_p31", // 9,
"o16_o16__he4_si28", // 10,
"he4_mg24__p_al27", // 11,
"p_al27__he4_mg24", // 12,
"he4_si28__p_p31", // 13,
"p_p31__he4_si28", // 14,
"f20__o20", // 15,
"ne20__f20", // 16,
"o20__f20", // 17,
"f20__ne20" // 18,
"ne20_to_he4_o16", // 1,
"he4_o16_to_ne20", // 2,
"he4_ne20_to_mg24", // 3,
"he4_mg24_to_si28", // 4,
"p_al27_to_si28", // 5,
"he4_al27_to_p31", // 6,
"he4_si28_to_s32", // 7,
"p_p31_to_s32", // 8,
"o16_o16_to_p_p31", // 9,
"o16_o16_to_he4_si28", // 10,
"he4_mg24_to_p_al27", // 11,
"p_al27_to_he4_mg24", // 12,
"he4_si28_to_p_p31", // 13,
"p_p31_to_he4_si28", // 14,
"f20_to_o20", // 15,
"ne20_to_f20", // 16,
"o20_to_f20", // 17,
"f20_to_ne20" // 18,
};

}

#ifdef NSE_NET
namespace NSE_INDEX
{
constexpr int h1_index = 0;
constexpr int n_index = -1;
constexpr int he4_index = 1;

// Each row corresponds to the rate in NetworkRates enum
// First 3 row indices for reactants, followed by 3 product indices
// last index is the corresponding reverse rate index.

extern AMREX_GPU_MANAGED amrex::Array2D<int, 1, Rates::NumRates, 1, 7, Order::C> rate_indices;
extern AMREX_GPU_MANAGED bool initialized;
}
#endif

#endif
27 changes: 27 additions & 0 deletions networks/ECSN/actual_network_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@ namespace network
AMREX_GPU_MANAGED amrex::Array1D<amrex::Real, 1, NumSpec> mion;
}

#ifdef NSE_NET
namespace NSE_INDEX
{
AMREX_GPU_MANAGED amrex::Array2D<int, 1, Rates::NumRates, 1, 7, Order::C> rate_indices {
-1, -1, 5, -1, 1, 2, -1,
-1, 1, 2, -1, -1, 5, 1,
-1, 1, 5, -1, -1, 6, -1,
-1, 1, 6, -1, -1, 8, -1,
-1, 0, 7, -1, -1, 8, -1,
-1, 1, 7, -1, -1, 9, -1,
-1, 1, 8, -1, -1, 10, -1,
-1, 0, 9, -1, -1, 10, -1,
-1, 2, 2, -1, 0, 9, -1,
-1, 2, 2, -1, 1, 8, -1,
-1, 1, 6, -1, 0, 7, -1,
-1, 0, 7, -1, 1, 6, 11,
-1, 1, 8, -1, 0, 9, -1,
-1, 0, 9, -1, 1, 8, 13,
-1, -1, 4, -1, -1, 3, -1,
-1, -1, 5, -1, -1, 4, -1,
-1, -1, 3, -1, -1, 4, 15,
-1, -1, 4, -1, -1, 5, 16
};
AMREX_GPU_MANAGED bool initialized = false;
}
#endif

void actual_network_init()
{
using namespace Species;
Expand Down
Loading

0 comments on commit 6081168

Please sign in to comment.