Skip to content

Commit

Permalink
start of a merge of simplified and true SDC
Browse files Browse the repository at this point in the history
from the point of view of the ODE integrator, they are the same
  • Loading branch information
zingale committed Sep 25, 2023
1 parent 9c08d80 commit 063825e
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 54 deletions.
1 change: 1 addition & 0 deletions .github/workflows/good_defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RATES
REACTIONS
SCREENING
SCREEN_METHOD
SDC
SIMPLIFIED_SDC
STRANG
TRUE_SDC
Expand Down
7 changes: 7 additions & 0 deletions Make.Microphysics_extern
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# This is the main include makefile for applications that want to use Microphysics
# You should set NETWORK_OUTPUT_PATH before including this file

# for common code paths between simplified-SDC and true-SDC, we'll
# use the SDC define

ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
DEFINES += -DSIMPLIFIED_SDC
DEFINES += -DSDC
USE_ALL_SDC := TRUE
else ifeq ($(USE_TRUE_SDC), TRUE)
DEFINES += -DTRUE_SDC
DEFINES += -DSDC
USE_ALL_SDC := TRUE
else
DEFINES += -DSTRANG
endif
Expand Down
6 changes: 2 additions & 4 deletions integration/BackwardEuler/Make.package
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
ifeq ($(USE_ALL_SDC), TRUE)
CEXE_headers += actual_integrator_simplified_sdc.H
else
ifneq ($(USE_TRUE_SDC), TRUE)
CEXE_headers += actual_integrator.H
endif
CEXE_headers += actual_integrator.H
endif

CEXE_headers += be_integrator.H
Expand Down
2 changes: 1 addition & 1 deletion integration/BackwardEuler/be_integrator.H
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifdef STRANG
#include <integrator_rhs_strang.H>
#endif
#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <integrator_rhs_simplified_sdc.H>
#endif
#include <integrator_data.H>
Expand Down
2 changes: 1 addition & 1 deletion integration/BackwardEuler/be_type.H
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifdef STRANG
#include <integrator_type_strang.H>
#endif
#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <integrator_type_simplified_sdc.H>
#endif
#include <network.H>
Expand Down
14 changes: 5 additions & 9 deletions integration/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@ CEXE_headers += integrator.H
CEXE_headers += integrator_data.H
CEXE_headers += integrator_type.H

ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
ifeq ($(USE_ALL_SDC), TRUE)
CEXE_headers += integrator_rhs_simplified_sdc.H
CEXE_headers += integrator_type_simplified_sdc.H
else
ifneq ($(USE_TRUE_SDC), TRUE)
CEXE_headers += integrator_type_strang.H
CEXE_headers += integrator_rhs_strang.H
endif
CEXE_headers += integrator_type_strang.H
CEXE_headers += integrator_rhs_strang.H
endif

ifeq ($(USE_NSE_TABLE), TRUE)
ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
ifeq ($(USE_ALL_SDC), TRUE)
CEXE_headers += nse_update_simplified_sdc.H
else
ifneq ($(USE_TRUE_SDC), TRUE)
CEXE_headers += nse_update_strang.H
endif
CEXE_headers += nse_update_strang.H
endif
endif

Expand Down
6 changes: 2 additions & 4 deletions integration/RKC/Make.package
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
ifeq ($(USE_ALL_SDC), TRUE)
CEXE_headers += actual_integrator_simplified_sdc.H
else
ifneq ($(USE_TRUE_SDC), TRUE)
CEXE_headers += actual_integrator.H
endif
CEXE_headers += actual_integrator.H
endif

CEXE_headers += rkc_type.H
Expand Down
2 changes: 1 addition & 1 deletion integration/RKC/rkc.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <integrator_type_strang.H>
#include <integrator_rhs_strang.H>
#endif
#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <integrator_type_simplified_sdc.H>
#include <integrator_rhs_simplified_sdc.H>
#endif
Expand Down
2 changes: 1 addition & 1 deletion integration/RKC/rkc_type.H
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct rkc_t {

};

#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <integrator_type_simplified_sdc.H>
#endif
#ifdef STRANG
Expand Down
6 changes: 2 additions & 4 deletions integration/VODE/Make.package
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
ifeq ($(USE_ALL_SDC), TRUE)
CEXE_headers += actual_integrator_simplified_sdc.H
else
ifneq ($(USE_TRUE_SDC), TRUE)
CEXE_headers += actual_integrator.H
endif
CEXE_headers += actual_integrator.H
endif

# by default we do not enable Jacobian caching on GPUs to save memory
Expand Down
5 changes: 1 addition & 4 deletions integration/VODE/vode_dvhin.H
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
#ifdef STRANG
#include <integrator_rhs_strang.H>
#endif
#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <integrator_rhs_simplified_sdc.H>
#endif
#ifdef TRUE_SDC
#include <vode_rhs_true_sdc.H>
#endif

template <typename BurnT, typename DvodeT>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
Expand Down
5 changes: 1 addition & 4 deletions integration/VODE/vode_dvjac.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
#ifdef STRANG
#include <integrator_rhs_strang.H>
#endif
#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <integrator_rhs_simplified_sdc.H>
#endif
#ifdef TRUE_SDC
#include <vode_rhs_true_sdc.H>
#endif

template <typename IArray1D, typename BurnT, typename DvodeT>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
Expand Down
7 changes: 2 additions & 5 deletions integration/VODE/vode_dvode.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
#ifdef STRANG
#include <integrator_rhs_strang.H>
#endif
#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <integrator_rhs_simplified_sdc.H>
#endif
#ifdef TRUE_SDC
#include <vode_rhs_true_sdc.H>
#endif
#ifdef NSE_TABLE
#include <nse_table_check.H>
#endif
Expand Down Expand Up @@ -236,7 +233,7 @@ int dvode (BurnT& state, DvodeT& vstate)
#ifdef STRANG
update_thermodynamics(state, vstate);
#endif
#ifdef SIMPLIFIED_SDC
#ifdef SDC
int_to_burn(vstate.tn, vstate, state);
#endif

Expand Down
6 changes: 3 additions & 3 deletions integration/VODE/vode_dvstep.H
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int dvstep (BurnT& state, DvodeT& vstate)
y_save(i) = vstate.y(i);
}
#endif
#if defined(SIMPLIFIED_SDC) || defined(TRUE_SDC)
#ifdef SDC
Real rho_old = state.rho_orig + TOLD * state.ydot_a[SRHO];
for (int i = 1; i <= int_neqs; ++i) {
y_save(i) = vstate.y(i);
Expand Down Expand Up @@ -224,7 +224,7 @@ int dvstep (BurnT& state, DvodeT& vstate)

bool valid_update = true;

#if defined(SIMPLIFIED_SDC) || defined(TRUE_SDC)
#ifdef SDC
if (vstate.y(SEINT+1) < 0.0_rt) {
valid_update = false;
}
Expand Down Expand Up @@ -271,7 +271,7 @@ int dvstep (BurnT& state, DvodeT& vstate)

#endif

#if defined(SIMPLIFIED_SDC) || defined(TRUE_SDC)
#ifdef SDC

// these are basically the same checks as with Strang
// above, except now we are evolving rhoX instead of X.
Expand Down
2 changes: 1 addition & 1 deletion integration/VODE/vode_type.H
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void print_state(dvode_t<int_neqs>& dvode_state)
}
#endif

#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <integrator_type_simplified_sdc.H>
#endif
#ifdef STRANG
Expand Down
2 changes: 1 addition & 1 deletion integration/integrator.H
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef INTEGRATOR_H
#define INTEGRATOR_H

#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <actual_integrator_simplified_sdc.H>
#else
#include <actual_integrator.H>
Expand Down
2 changes: 1 addition & 1 deletion integration/utils/circle_theorem.H
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <integrator_type_strang.H>
#include <integrator_rhs_strang.H>
#endif
#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <integrator_type_simplified_sdc.H>
#include <integrator_rhs_simplified_sdc.H>
#endif
Expand Down
4 changes: 2 additions & 2 deletions integration/utils/nonaka_plot.H
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void nonaka_init() {
std::stringstream ss;
ss << std::setw(FIELD_WIDTH) << "time" << " ";

#ifdef SIMPLIFIED_SDC
#ifdef SDC
ss << std::setw(FIELD_WIDTH) << "sdc-iter" << " ";
#endif

Expand Down Expand Up @@ -80,7 +80,7 @@ void nonaka_rhs(const Real time, const BurnT& state, const YdotNetArray1D& ydot_

nf << std::setw(FIELD_WIDTH) << simulation_time << " ";

#ifdef SIMPLIFIED_SDC
#ifdef SDC
nf << std::setw(FIELD_WIDTH) << state.sdc_iter << " ";
#endif

Expand Down
12 changes: 4 additions & 8 deletions interfaces/burner.H
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifdef STRANG
#include <nse_update_strang.H>
#endif
#ifdef SIMPLIFIED_SDC
#ifdef SDC
#include <nse_update_simplified_sdc.H>
#endif
#endif
Expand All @@ -26,16 +26,14 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void burner (BurnT& state, Real dt)
{

#ifndef TRUE_SDC

#ifdef NSE

bool nse_check = in_nse(state);

if (nse_check) {

// call the table
#ifdef SIMPLIFIED_SDC
#ifdef SDC
sdc_nse_burn(state, dt);
#else
nse_burn(state, dt);
Expand All @@ -45,7 +43,7 @@ void burner (BurnT& state, Real dt)
// burn as usual
integrator(state, dt);

#if !defined(SIMPLIFIED_SDC) && defined(AUX_THERMO)
#if !defined(SDC) && defined(AUX_THERMO)
// update the aux from the new X's this is not needed with the
// SDC method, since we took care of that internally.
set_aux_comp_from_X(state);
Expand Down Expand Up @@ -74,7 +72,7 @@ void burner (BurnT& state, Real dt)

// This will append to state.e the amount additional
// energy released from adjusting to the new NSE state
#ifdef SIMPLIFIED_SDC
#ifdef SDC
sdc_nse_burn(state, dt_remaining);
#else
nse_burn(state, dt_remaining);
Expand All @@ -94,8 +92,6 @@ void burner (BurnT& state, Real dt)
integrator(state, dt);
#endif

#endif

}

#endif

0 comments on commit 063825e

Please sign in to comment.