Skip to content

Commit

Permalink
fix some burn failure diagonstics on GPUs (#1635)
Browse files Browse the repository at this point in the history
if we are on the GPU with printf allowed, we weren't backing up the thermo
state
  • Loading branch information
zingale authored Jul 29, 2024
1 parent 83ce77c commit 727afa9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
13 changes: 7 additions & 6 deletions integration/integrator_setup_sdc.H
Original file line number Diff line number Diff line change
Expand Up @@ -103,28 +103,29 @@ IntegratorT integrator_setup (BurnT& state, amrex::Real dt, bool is_retry)
return int_state;
}

///
/// Save the initial composition and thermodynamic state for
/// diagnostics.
///
template <typename BurnT>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
state_backup_t integrator_backup (const BurnT& state) {

// Save the initial composition and temperature for our later
// diagnostics.

state_backup_t state_save;

#ifndef AMREX_USE_GPU
for (int n = 0; n < NumSpec; ++n) {
state_save.xn_in[n] = state.y[SFS+n] / state.y[SRHO];
}
// we are assuming that the temperature was valid on input
state_save.T_in = state.T;
#ifdef AUX_THERMO
for (int n = 0; n < NumAux; ++n) {
state_save.aux_in[n] = state.y[SFX+n] / state.y[SRHO];
}
#endif
state_save.rhoe_in = state.y[SEINT];
#endif
// we are assuming that the temperature was valid on input
state_save.T_in = state.T;
state_save.rhoe_in = state.y[SEINT];

return state_save;

Expand Down
7 changes: 5 additions & 2 deletions integration/integrator_setup_strang.H
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ IntegratorT integrator_setup (BurnT& state, amrex::Real dt, bool is_retry)
return int_state;
}


///
/// Save the initial composition and thermodynamic state for
/// diagnostics.
///
template <typename BurnT>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
state_backup_t integrator_backup (const BurnT& state) {
Expand All @@ -106,8 +109,8 @@ state_backup_t integrator_backup (const BurnT& state) {
for (int n = 0; n < NumSpec; ++n) {
state_save.xn_in[n] = state.xn[n];
}
state_save.T_in = state.T;
#endif
state_save.T_in = state.T;
state_save.e_in = state.e;

return state_save;
Expand Down

0 comments on commit 727afa9

Please sign in to comment.