Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert triple_alpha_plus_cago to new reactions scheme #1265

Merged
merged 23 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8922d4b
Convert triple_alpha_plus_cago to new network implementation
maxpkatz Jul 7, 2023
46963bf
Turn off reverse reactions
maxpkatz Jul 7, 2023
dc085fa
Merge branch 'development' into convert_triple_alpha
maxpkatz Jul 7, 2023
1d26ec6
Don't need NETWORK_PROPERTIES anymore
maxpkatz Jul 7, 2023
b4c9b4f
Revert "Don't need NETWORK_PROPERTIES anymore"
maxpkatz Jul 7, 2023
6869eb5
Update benchmark
maxpkatz Jul 7, 2023
5252b45
Inline functions for mion and bion
maxpkatz Jul 7, 2023
6adc86c
constexpr
maxpkatz Jul 7, 2023
2f4b12f
Merge branch 'development' into convert_triple_alpha
maxpkatz Jul 8, 2023
b6217b4
Add legacy interfaces
maxpkatz Jul 8, 2023
55c7723
Merge branch 'development' into convert_triple_alpha
zingale Jul 16, 2023
814d53c
Move tabular NSE implementation to its own directory (#1281)
maxpkatz Jul 17, 2023
6c53b41
fix compilation of application codes that use the NSE table (#1282)
zingale Jul 17, 2023
899de3a
decompose get_nse_state into two separate functions (#1276)
zhichen3 Jul 17, 2023
69f9ed7
abort earlier if T_in < T_nse_net (#1283)
zhichen3 Jul 17, 2023
ff78572
New Ci-Benchmark for the burn_cell test (#1277)
aisclark91 Jul 18, 2023
a43c526
Make mion and bion inline functions for aprox nets (#1267)
maxpkatz Jul 18, 2023
7f85052
Merge branch 'development' into convert_triple_alpha
maxpkatz Jul 19, 2023
d8cd205
Update test_rhs benchmark
maxpkatz Jul 19, 2023
5719e84
Merge branch 'development' into convert_triple_alpha
maxpkatz Jul 21, 2023
41ed7db
Merge branch 'development' into convert_triple_alpha
zingale Jul 21, 2023
26ffd7a
Constructor now available
maxpkatz Jul 21, 2023
1281f03
Merge branch 'development' into convert_triple_alpha
maxpkatz Jul 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions networks/triple_alpha_plus_cago/Make.package
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
CEXE_headers += network_properties.H

ifeq ($(USE_REACT),TRUE)
CEXE_sources += actual_network_data.cpp
CEXE_headers += actual_network.H

CEXE_sources += actual_rhs_data.cpp
CEXE_headers += actual_rhs.H

USE_RATES = TRUE
USE_SCREENING = TRUE
endif
168 changes: 161 additions & 7 deletions networks/triple_alpha_plus_cago/actual_network.H
Original file line number Diff line number Diff line change
@@ -1,33 +1,187 @@
#ifndef actual_network_H
#define actual_network_H

#define NEW_NETWORK_IMPLEMENTATION

#include <AMReX_REAL.H>
#include <AMReX_Vector.H>
#include <AMReX_Array.H>

#include <fundamental_constants.H>
#include <network_properties.H>
#include <rhs_type.H>
#include <aprox_rates.H>

using namespace amrex;

void actual_network_init();
AMREX_INLINE
void actual_network_init() {}

const std::string network_name = "triple_alpha_plus_cago";

namespace network
{
extern AMREX_GPU_MANAGED amrex::Array1D<amrex::Real, 1, NumSpec> bion;
template<int spec>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
constexpr Real bion () {
using namespace Species;

static_assert(spec >= 1 && spec <= NumSpec);

// Set the binding energy of the element
if constexpr (spec == He4) {
return 28.29603_rt;
}
else if constexpr (spec == C12) {
return 92.16294_rt;
}
else if constexpr (spec == O16) {
return 127.62093_rt;
}
else if constexpr (spec == Fe56) {
return 492.25389_rt;
}

// Return zero if we don't recognize the species.

return 0.0_rt;
}

template<int spec>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
constexpr Real mion () {
static_assert(spec >= 1 && spec <= NumSpec);

constexpr Real A = NetworkProperties::aion(spec);
constexpr Real Z = NetworkProperties::zion(spec);

return (A - Z) * C::Legacy::m_n + Z * (C::Legacy::m_p + C::Legacy::m_e) - bion<spec>() * C::Legacy::MeV2gr;
}

// Legacy (non-templated) interfaces

AMREX_GPU_HOST_DEVICE AMREX_INLINE
Real bion (int spec) {
using namespace Species;

Real b = 0.0_rt;

// Set the binding energy of the element
constexpr_for<1, NumSpec+1>([&] (auto n) {
if (n == spec) {
b = bion<n>();
}
});

return b;
}

AMREX_GPU_HOST_DEVICE AMREX_INLINE
Real mion (int spec) {
using namespace Species;

Real m = 0.0_rt;

constexpr_for<1, NumSpec+1>([&] (auto n) {
if (n == spec) {
m = mion<n>();
}
});

return m;
}
}

namespace Rates
{
enum NetworkRates {
ir3a = 1,
ircago = 2,
NumRates = ircago
He4_He4_He4_to_C12 = 1,
C12_He4_to_O16,
NumRates = C12_He4_to_O16
};

const int NumGroups = 2;
};

namespace RHS {

AMREX_GPU_HOST_DEVICE AMREX_INLINE
constexpr rhs_t rhs_data (int rate)
{
using namespace Species;
using namespace Rates;

rhs_t data;

switch (rate) {

case He4_He4_He4_to_C12:
data.species_A = He4;
data.species_D = C12;

data.number_A = 3;
data.number_D = 1;

data.exponent_A = 3;
data.exponent_D = 1;

// This network doesn't allow the reverse reaction
data.reverse_branching_ratio = 0.0_rt;
break;

case C12_He4_to_O16:
data.species_A = C12;
data.species_B = He4;
data.species_D = O16;

data.number_A = 1;
data.number_B = 1;
data.number_D = 1;

data.exponent_A = 1;
data.exponent_B = 1;
data.exponent_D = 1;

// This network doesn't allow the reverse reaction
data.reverse_branching_ratio = 0.0_rt;
break;

}

return data;
}

template<int rate>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
void evaluate_analytical_rate (const rhs_state_t& state, rate_t& rates)
{
using namespace Species;
using namespace Rates;

if constexpr (rate == He4_He4_He4_to_C12) {
rate_triplealf(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == C12_He4_to_O16) {
rate_c12ag(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
}

template<int rate>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
void postprocess_rate ([[maybe_unused]] const rhs_state_t& state, rate_t& rates,
rate_t& rates1, rate_t& rates2, rate_t& rates3)
{
using namespace Species;
using namespace Rates;

// Nothing to do for this network.
}

template<int spec>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
Real ener_gener_rate (Real const& dydt)
{
return dydt * network::mion<spec>() * C::Legacy::enuc_conv2;
}

} // namespace RHS

#endif
22 changes: 0 additions & 22 deletions networks/triple_alpha_plus_cago/actual_network_data.cpp

This file was deleted.

Loading