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

Move aprox13 to C++ #305

Merged
merged 7 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions networks/aprox13/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ F90EXE_sources += actual_network.F90
F90EXE_sources += network_properties.F90
CEXE_headers += network_properties.H

CEXE_sources += actual_network_data.cpp
CEXE_headers += actual_network.H

ifeq ($(USE_REACT),TRUE)
ifneq ($(USE_SIMPLIFIED_SDC), TRUE)
F90EXE_sources += actual_burner.F90
endif
F90EXE_sources += actual_rhs.F90

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

USE_RATES = TRUE
USE_SCREENING = TRUE
USE_NEUTRINOS = TRUE
Expand Down
120 changes: 120 additions & 0 deletions networks/aprox13/actual_network.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#ifndef _actual_network_H_
#define _actual_network_H_

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

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

using namespace amrex;

void actual_network_init();

namespace C
{
namespace Legacy
{
// These are the values of the constants used in the original aprox13
constexpr amrex::Real m_n = 1.67492721184e-24_rt;
constexpr amrex::Real m_p = 1.67262163783e-24_rt;
constexpr amrex::Real m_e = 9.1093821545e-28_rt;

constexpr amrex::Real eV2erg = 1.60217648740e-12_rt;
constexpr amrex::Real MeV2erg = eV2erg*1.0e6_rt;
constexpr amrex::Real MeV2gr = MeV2erg/(c_light*c_light);

constexpr amrex::Real n_A = 6.0221417930e23_rt;

// conversion factor for nuclear energy generation rate
constexpr amrex::Real enuc_conv2 = -n_A * c_light * c_light;
}
}

const std::string network_name = "aprox13";

namespace aprox13
{
extern AMREX_GPU_MANAGED amrex::Array1D<amrex::Real, 1, NumSpec> bion;
extern AMREX_GPU_MANAGED amrex::Array1D<amrex::Real, 1, NumSpec> mion;
}

namespace Rates {
enum NetworkRates {
ir3a = 1,
irg3a,
ircag,
iroga,
ir1212,
ir1216,
ir1616,
iroag,
irnega,
irneag,
irmgga,
irmgag,
irsiga,
irmgap,
iralpa,
iralpg,
irsigp,
irsiag,
irsga,
irsiap,
irppa,
irppg,
irsgp,
irsag,
irarga,
irsap,
irclpa,
irclpg,
irargp,
irarag,
ircaga,
irarap,
irkpa,
irkpg,
ircagp,
ircaag,
irtiga,
ircaap,
irscpa,
irscpg,
irtigp,
irtiag,
ircrga,
irtiap,
irvpa,
irvpg,
ircrgp,
ircrag,
irfega,
ircrap,
irmnpa,
irmnpg,
irfegp,
irfeag,
irniga,
irfeap,
ircopa,
ircopg,
irnigp,
irr1,
irs1,
irt1,
iru1,
irv1,
irw1,
irx1,
iry1,
NumRates=iry1
};

const int NumGroups = 2;

extern amrex::Vector<std::string> names;
};

#endif
113 changes: 113 additions & 0 deletions networks/aprox13/actual_network_data.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#include <AMReX_Vector.H>
#include <actual_network.H>

namespace aprox13
{
AMREX_GPU_MANAGED amrex::Array1D<amrex::Real, 1, NumSpec> bion;
AMREX_GPU_MANAGED amrex::Array1D<amrex::Real, 1, NumSpec> mion;
}

namespace Rates
{
amrex::Vector<std::string> names;
}

void actual_network_init()
{
using namespace Species;
using namespace aprox13;

// Set the binding energy of the element
bion(He4) = 28.29603e0_rt;
bion(C12) = 92.16294e0_rt;
bion(O16) = 127.62093e0_rt;
bion(Ne20) = 160.64788e0_rt;
bion(Mg24) = 198.25790e0_rt;
bion(Si28) = 236.53790e0_rt;
bion(S32) = 271.78250e0_rt;
bion(Ar36) = 306.72020e0_rt;
bion(Ca40) = 342.05680e0_rt;
bion(Ti44) = 375.47720e0_rt;
bion(Cr48) = 411.46900e0_rt;
bion(Fe52) = 447.70800e0_rt;
bion(Ni56) = 484.00300e0_rt;

// Set the mass
for (int i = 1; i <= NumSpec; ++i) {
mion(i) = (aion[i-1] - zion[i-1]) * C::Legacy::m_n + zion[i-1] * (C::Legacy::m_p + C::Legacy::m_e) - bion(i) * C::Legacy::MeV2gr;
}

// set the names of the reaction rates
{
using namespace Rates;
names.resize(NumRates);

names[ir3a-1] = "r3a";
names[irg3a-1] = "rg3a";
names[ircag-1] = "rcag";
names[ir1212-1] = "r1212";
names[ir1216-1] = "r1216";
names[ir1616-1] = "r1616";
names[iroga-1] = "roga";
names[iroag-1] = "roag";
names[irnega-1] = "rnega";
names[irneag-1] = "rneag";
names[irmgga-1] = "rmgga";
names[irmgag-1] = "rmgag";
names[irsiga-1] = "rsiga";
names[irmgap-1] = "rmgap";
names[iralpa-1] = "ralpa";
names[iralpg-1] = "ralpg";
names[irsigp-1] = "rsigp";
names[irsiag-1] = "rsiag";
names[irsga-1] = "rsga";
names[irsiap-1] = "rsiap";
names[irppa-1] = "rppa";
names[irppg-1] = "rppg";
names[irsgp-1] = "rsgp";
names[irsag-1] = "rsag";
names[irarga-1] = "rarga";
names[irsap-1] = "rsap";
names[irclpa-1] = "rclpa";
names[irclpg-1] = "rclpg";
names[irargp-1] = "rargp";
names[irarag-1] = "rarag";
names[ircaga-1] = "rcaga";
names[irarap-1] = "rarap";
names[irkpa-1] = "rkpa";
names[irkpg-1] = "rkpg";
names[ircagp-1] = "rcagp";
names[ircaag-1] = "rcaag";
names[irtiga-1] = "rtiga";
names[ircaap-1] = "rcaap";
names[irscpa-1] = "rscpa";
names[irscpg-1] = "rscpg";
names[irtigp-1] = "rtigp";
names[irtiag-1] = "rtiag";
names[ircrga-1] = "rcrga";
names[irtiap-1] = "rtiap";
names[irvpa-1] = "rvpa";
names[irvpg-1] = "rvpg";
names[ircrgp-1] = "rcrgp";
names[ircrag-1] = "rcrag";
names[irfega-1] = "rfega";
names[ircrap-1] = "rcrap";
names[irmnpa-1] = "rmnpa";
names[irmnpg-1] = "rmnpg";
names[irfegp-1] = "rfegp";
names[irfeag-1] = "rfeag";
names[irniga-1] = "rniga";
names[irfeap-1] = "rfeap";
names[ircopa-1] = "rcopa";
names[ircopg-1] = "rcopg";
names[irnigp-1] = "rnigp";
names[irr1-1] = "r1";
names[irs1-1] = "s1";
names[irt1-1] = "t1";
names[iru1-1] = "u1";
names[irv1-1] = "v1";
names[irw1-1] = "w1";
names[irx1-1] = "x1";
names[iry1-1] = "y1";
}
}
Loading