Skip to content

Commit

Permalink
sync to the new tabular NSE interfacet (#2673)
Browse files Browse the repository at this point in the history
this syncs up with the Microphysics changes in
AMReX-Astro/Microphysics#1404
  • Loading branch information
zingale authored Dec 8, 2023
1 parent 058d0f0 commit 9cf0cb6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
26 changes: 14 additions & 12 deletions Exec/reacting_tests/nse_test/problem_initialize_state_data.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <eos.H>
#include <network.H>
#if defined(NSE_TABLE)
#include <nse_table_type.H>
#include <nse_table.H>
#elif defined(NSE_NET)
#include <nse_solver.H>
Expand Down Expand Up @@ -64,14 +65,15 @@ void problem_initialize_state_data (int i, int j, int k,
burn_state.y_e = ye;

#if defined(NSE_TABLE)
Real abar;
Real dq;
Real dyedt;
Real dabardt;
Real dbeadt;
Real e_nu;

nse_interp(T, problem::rho0, ye, abar, dq, dyedt, dabardt, dbeadt, e_nu, burn_state.xn);
nse_table_t nse_state;
nse_state.T = T;
nse_state.rho = problem::rho0;
nse_state.Ye = ye;
nse_interp(nse_state);

for (int n = 0; n < NumSpec; ++n) {
burn_state.xn[n] = nse_state.X[n];
}
#elif defined(NSE_NET)
Real eps = 1.e-10_rt;
bool input_ye_is_valid = true;
Expand Down Expand Up @@ -105,16 +107,16 @@ void problem_initialize_state_data (int i, int j, int k,
for (int n = 0; n < NumSpec; n++) {
burn_state.xn[n] /= sumX;
}

#ifdef NSE_NET
state(i,j,k,UMUP) = burn_state.mu_p;
state(i,j,k,UMUN) = burn_state.mu_n;
#endif

#ifdef AUX_THERMO
burn_state.aux[AuxZero::iye] = ye;
burn_state.aux[AuxZero::iabar] = abar;
burn_state.aux[AuxZero::ibea] = dq;
burn_state.aux[AuxZero::iabar] = nse_state.abar;
burn_state.aux[AuxZero::ibea] = nse_state.bea;
#endif

eos(eos_input_rt, burn_state);
Expand Down
22 changes: 9 additions & 13 deletions Exec/science/massive_star/problem_initialize_state_data.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <eos.H>
#include <model_parser.H>
#ifdef NSE_TABLE
#include <nse_table_type.H>
#include <nse_table_check.H>
#endif

Expand Down Expand Up @@ -80,21 +81,16 @@ void problem_initialize_state_data (int i, int j, int k,

if (nse_check) {

Real abar;
Real dq;
Real dyedt;
Real dabardt;
Real dbeadt;
Real e_nu;
Real xn[NumSpec];
nse_table_t nse_state;
nse_state.T = state(i,j,k,UTEMP);
nse_state.rho = state(i,j,k,URHO);
nse_state.Ye = state(i,j,k,UFX+AuxZero::iye);
nse_interp(nse_state);

nse_interp(state(i,j,k,UTEMP), state(i,j,k,URHO),
state(i,j,k,UFX+AuxZero::iye), abar, dq, dyedt, dabardt, dbeadt, e_nu, xn);

state(i,j,k,UFX+AuxZero::iabar) = abar;
state(i,j,k,UFX+AuxZero::ibea) = dq;
state(i,j,k,UFX+AuxZero::iabar) = nse_state.abar;
state(i,j,k,UFX+AuxZero::ibea) = nse_state.bea;
for (int n = 0; n < NumSpec; n++) {
state(i,j,k,UFS+n) = amrex::max(xn[n], small_x);
state(i,j,k,UFS+n) = amrex::max(nse_state.X[n], small_x);
}

// we just got new X's, so we need to re-renormalize them
Expand Down

0 comments on commit 9cf0cb6

Please sign in to comment.