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

sync up react_state's return type #2570

Merged
merged 10 commits into from
Sep 24, 2023
12 changes: 6 additions & 6 deletions Source/reactions/Castro_react.H
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
/// @param time current time
/// @param dt reaction timestep
///
bool react_state(amrex::MultiFab& state,
amrex::MultiFab& reactions,
amrex::Real time,
amrex::Real dt,
const int strang_half);
int react_state(amrex::MultiFab& state,
amrex::MultiFab& reactions,
amrex::Real time,
amrex::Real dt,
const int strang_half);

///
/// Simplified SDC version of react_state. Reacts the current state through a single timestep.
///
/// @param time current time
/// @param dt timestep
///
bool react_state(amrex::Real time, amrex::Real dt);
int react_state(amrex::Real time, amrex::Real dt);

///
/// Are there any zones in ``State`` that can burn?
Expand Down
24 changes: 11 additions & 13 deletions Source/reactions/Castro_react.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Castro::do_old_reactions (Real time, Real dt)
advance_status status {};

#ifndef SIMPLIFIED_SDC
bool burn_success = true;
int burn_success{1};
maxpkatz marked this conversation as resolved.
Show resolved Hide resolved

MultiFab& R_old = get_old_data(Reactions_Type);
MultiFab& R_new = get_new_data(Reactions_Type);
Expand All @@ -29,7 +29,7 @@ Castro::do_old_reactions (Real time, Real dt)
// The result of the reactions is added directly to Sborder.
burn_success = react_state(Sborder, R_old, time, 0.5 * dt, 0);

if (!burn_success) {
if (burn_success != 1) {
status.success = false;
status.reason = "burn unsuccessful";

Expand Down Expand Up @@ -57,7 +57,7 @@ Castro::do_new_reactions (Real time, Real dt)

advance_status status {};

bool burn_success = true;
int burn_success{1};

MultiFab& R_new = get_new_data(Reactions_Type);
MultiFab& S_new = get_new_data(State_Type);
Expand All @@ -73,7 +73,7 @@ Castro::do_new_reactions (Real time, Real dt)

burn_success = react_state(time, dt);

if (!burn_success) {
if (burn_success != 1) {
status.success = false;
status.reason = "burn unsuccessful";

Expand Down Expand Up @@ -107,7 +107,7 @@ Castro::do_new_reactions (Real time, Real dt)

burn_success = react_state(S_new, R_new, time - 0.5 * dt, 0.5 * dt, 1);

if (!burn_success) {
if (burn_success != 1) {
status.success = false;
status.reason = "burn unsuccessful";

Expand All @@ -129,7 +129,7 @@ Castro::do_new_reactions (Real time, Real dt)

// Strang version

bool
int
Castro::react_state(MultiFab& s, MultiFab& r, Real time, Real dt, const int strang_half)
{

Expand Down Expand Up @@ -452,7 +452,7 @@ Castro::react_state(MultiFab& s, MultiFab& r, Real time, Real dt, const int stra
#ifdef SIMPLIFIED_SDC
// Simplified SDC version

bool
int
Castro::react_state(Real time, Real dt)
{

Expand Down Expand Up @@ -804,7 +804,9 @@ Castro::react_state(Real time, Real dt)
ReduceTuple hv = reduce_data.value();
Real burn_failed = amrex::get<0>(hv);

if (burn_failed != 0.0) burn_success = 0;
if (burn_failed != 0.0) {
burn_success = 0;
}

ParallelDescriptor::ReduceIntMin(burn_success);

Expand Down Expand Up @@ -843,11 +845,7 @@ Castro::react_state(Real time, Real dt)

}

if (burn_success) {
return true;
} else {
return false;
}
return burn_success;

}
#endif
Expand Down