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

Add wrappers for CTU advance source terms #2500

Merged
merged 3 commits into from
Jun 17, 2023
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
25 changes: 2 additions & 23 deletions Source/driver/Castro_advance_ctu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ Castro::do_advance_ctu (Real time, Real dt)

MultiFab& S_new = get_new_data(State_Type);

MultiFab& old_source = get_old_data(Source_Type);
MultiFab& new_source = get_new_data(Source_Type);

#ifdef MHD
MultiFab& Bx_old = get_old_data(Mag_Type_x);
MultiFab& By_old = get_old_data(Mag_Type_y);
MultiFab& Bz_old = get_old_data(Mag_Type_z);

MultiFab& Bx_new = get_new_data(Mag_Type_x);
MultiFab& By_new = get_new_data(Mag_Type_y);
MultiFab& Bz_new = get_new_data(Mag_Type_z);
#endif

// Perform initialization steps.

status = initialize_do_advance(time, dt);
Expand Down Expand Up @@ -77,11 +64,7 @@ Castro::do_advance_ctu (Real time, Real dt)
construct_old_gravity(prev_time);
#endif

do_old_sources(
#ifdef MHD
Bx_old, By_old, Bz_old,
#endif
old_source, Sborder, S_new, prev_time, dt);
do_old_sources(prev_time, dt);

#ifdef SIMPLIFIED_SDC
#ifdef REACTIONS
Expand Down Expand Up @@ -116,11 +99,7 @@ Castro::do_advance_ctu (Real time, Real dt)
construct_new_gravity(cur_time);
#endif

do_new_sources(
#ifdef MHD
Bx_new, By_new, Bz_new,
#endif
new_source, Sborder, S_new, cur_time, dt);
do_new_sources(cur_time, dt);

// If the state has ghost zones, sync them up now since the hydro
// source and new-time sources only work on the valid zones.
Expand Down
20 changes: 20 additions & 0 deletions Source/sources/Castro_sources.H
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
amrex::Real time, amrex::Real dt, bool apply_to_state = true);


///
/// Construct source terms at old time (convenience wrapper for CTU advance)
///
/// @param time the current simulation time
/// @param dt the timestep to advance (e.g., go from time to
/// time + dt)
///
void do_old_sources (amrex::Real time, amrex::Real dt);


///
/// Construct the old-time source
///
Expand Down Expand Up @@ -83,6 +93,16 @@
amrex::Real time, amrex::Real dt, bool apply_to_state = true);


///
/// Construct new time sources (convenience wrapper for CTU advance)
///
/// @param time the current simulation time
/// @param dt the timestep to advance (e.g., go from time to
/// time + dt)
///
void do_new_sources (amrex::Real time, amrex::Real dt);


///
/// Construct the new-time sources.
///
Expand Down
39 changes: 39 additions & 0 deletions Source/sources/Castro_sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,26 @@ Castro::do_old_sources(
});
#endif
}
}

void
Castro::do_old_sources (Real time, Real dt)
{
MultiFab& S_new = get_new_data(State_Type);

MultiFab& old_source = get_old_data(Source_Type);

#ifdef MHD
MultiFab& Bx_old = get_old_data(Mag_Type_x);
MultiFab& By_old = get_old_data(Mag_Type_y);
MultiFab& Bz_old = get_old_data(Mag_Type_z);
#endif

do_old_sources(
#ifdef MHD
Bx_old, By_old, Bz_old,
#endif
old_source, Sborder, S_new, time, dt);
}

void
Expand Down Expand Up @@ -235,6 +254,26 @@ Castro::do_new_sources(

}

void
Castro::do_new_sources (Real time, Real dt)
{
MultiFab& S_new = get_new_data(State_Type);

MultiFab& new_source = get_new_data(Source_Type);

#ifdef MHD
MultiFab& Bx_new = get_new_data(Mag_Type_x);
MultiFab& By_new = get_new_data(Mag_Type_y);
MultiFab& Bz_new = get_new_data(Mag_Type_z);
#endif

do_new_sources(
#ifdef MHD
Bx_new, By_new, Bz_new,
#endif
new_source, Sborder, S_new, time, dt);
}

void
Castro::construct_old_source(int src, MultiFab& source, MultiFab& state_in, Real time, Real dt)
{
Expand Down