Skip to content

Commit

Permalink
more work
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Jan 23, 2024
1 parent 6be7341 commit 8249828
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Source/sources/Castro_sources.H
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/// @param dt the timestep to advance (e.g., go from time to
/// time + dt)
///
advance_status do_old_sources (amrex::Real time, amrex::Real dt);
advance_status do_old_sources (amrex::Real time, amrex::Real dt, bool apply_to_state = true);


///
Expand Down
19 changes: 14 additions & 5 deletions Source/sources/Castro_sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Castro::do_old_sources(
// Optionally print out diagnostic information about how much
// these source terms changed the state.

if (print_update_diagnostics) {
if (apply_to_state && print_update_diagnostics) {
bool is_new = false;
print_all_source_changes(dt, is_new);
}
Expand All @@ -174,7 +174,7 @@ Castro::do_old_sources(
}

advance_status
Castro::do_old_sources (Real time, Real dt)
Castro::do_old_sources (Real time, Real dt, bool apply_to_state)
{
advance_status status {};

Expand All @@ -192,7 +192,8 @@ Castro::do_old_sources (Real time, Real dt)
#ifdef MHD
Bx_old, By_old, Bz_old,
#endif
old_source, Sborder, S_new, time, dt);
old_source, Sborder, S_new, time, dt,
apply_to_state);

return status;
}
Expand Down Expand Up @@ -546,7 +547,8 @@ Castro::pre_advance_operators (Real time, Real dt)
// recompute the old sources after the burn, so this is done here
// only for evaluating the shock flag.

do_old_sources(time, dt);
const bool apply_to_state{false};
do_old_sources(time, dt, apply_to_state);

MultiFab& old_source = get_old_data(Source_Type);

Expand All @@ -555,8 +557,15 @@ Castro::pre_advance_operators (Real time, Real dt)

for (MFIter mfi(Sborder, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
const Box& bx = mfi.tilebox();
const Box& obx = mfi.growntilebox(1);

shk.resize(bx, 1);
#ifdef RADIATION
q.resize(obx, NQ);
#else
q.resize(obx, NQTHERM);
#endif
qaux.resize(obx, NQAUX);

Array4<Real> const shk_arr = shk.array();
Array4<Real> const q_arr = q.array();
Expand All @@ -565,7 +574,7 @@ Castro::pre_advance_operators (Real time, Real dt)
Array4<Real> const U_old_arr = Sborder.array(mfi);
Array4<Real> const old_src_arr = old_source.array(mfi);

ctoprim(bx, time, U_old_arr, q_arr, qaux_arr);
ctoprim(obx, time, U_old_arr, q_arr, qaux_arr);

shock(bx, q_arr, old_src_arr, shk_arr);

Expand Down

0 comments on commit 8249828

Please sign in to comment.