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

massive star thermodynamics improvements #2695

Merged
merged 1 commit into from
Jan 5, 2024
Merged
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
30 changes: 28 additions & 2 deletions Exec/science/massive_star/problem_initialize_state_data.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#ifdef NSE_TABLE
#include <nse_table_type.H>
#include <nse_table_check.H>
#include <nse_eos.H>
#endif

AMREX_GPU_HOST_DEVICE AMREX_INLINE
Expand Down Expand Up @@ -128,8 +129,33 @@ void problem_initialize_state_data (int i, int j, int k,
}

if (problem::interpolate_pres == 1) {
eos(eos_input_rp, eos_state);
state(i,j,k,UTEMP) = eos_state.T;

// we need to get T from P, rho, but consistent with NSE (if
// we are in NSE)
if (nse_check) {
// this will also change the composition, since the new T
// alters the NSE
nse_T_abar_from_p(eos_state.rho, eos_state.p, eos_state.aux[AuxZero::iye],
eos_state.T, eos_state.aux[AuxZero::iabar]);
state(i,j,k,UTEMP) = eos_state.T;
state(i,j,k,UFX+AuxZero::iabar) = eos_state.aux[AuxZero::iabar];

// now call the EOS with the new T and abar to get e
eos(eos_input_rt, eos_state);

// finally, get the updated B/A
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);

state(i,j,k,UFX+AuxZero::ibea) = nse_state.bea;

} else {
eos(eos_input_rp, eos_state);
state(i,j,k,UTEMP) = eos_state.T;
}
} else {
eos(eos_input_rt, eos_state);
}
Expand Down