From 063825e13b6f699c3e7ecaae721271e5f4f32149 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 25 Sep 2023 08:53:36 -0400 Subject: [PATCH] start of a merge of simplified and true SDC from the point of view of the ODE integrator, they are the same --- .github/workflows/good_defines.txt | 1 + Make.Microphysics_extern | 7 +++++++ integration/BackwardEuler/Make.package | 6 ++---- integration/BackwardEuler/be_integrator.H | 2 +- integration/BackwardEuler/be_type.H | 2 +- integration/Make.package | 14 +++++--------- integration/RKC/Make.package | 6 ++---- integration/RKC/rkc.H | 2 +- integration/RKC/rkc_type.H | 2 +- integration/VODE/Make.package | 6 ++---- integration/VODE/vode_dvhin.H | 5 +---- integration/VODE/vode_dvjac.H | 5 +---- integration/VODE/vode_dvode.H | 7 ++----- integration/VODE/vode_dvstep.H | 6 +++--- integration/VODE/vode_type.H | 2 +- integration/integrator.H | 2 +- integration/utils/circle_theorem.H | 2 +- integration/utils/nonaka_plot.H | 4 ++-- interfaces/burner.H | 12 ++++-------- 19 files changed, 39 insertions(+), 54 deletions(-) diff --git a/.github/workflows/good_defines.txt b/.github/workflows/good_defines.txt index b038ee88fe..c2c60995b8 100644 --- a/.github/workflows/good_defines.txt +++ b/.github/workflows/good_defines.txt @@ -18,6 +18,7 @@ RATES REACTIONS SCREENING SCREEN_METHOD +SDC SIMPLIFIED_SDC STRANG TRUE_SDC diff --git a/Make.Microphysics_extern b/Make.Microphysics_extern index 984e461e4c..2954ebbffc 100644 --- a/Make.Microphysics_extern +++ b/Make.Microphysics_extern @@ -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 diff --git a/integration/BackwardEuler/Make.package b/integration/BackwardEuler/Make.package index ca0dd265d2..8e3bcc7145 100644 --- a/integration/BackwardEuler/Make.package +++ b/integration/BackwardEuler/Make.package @@ -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 diff --git a/integration/BackwardEuler/be_integrator.H b/integration/BackwardEuler/be_integrator.H index d52f0a3b4a..3fc2511494 100644 --- a/integration/BackwardEuler/be_integrator.H +++ b/integration/BackwardEuler/be_integrator.H @@ -13,7 +13,7 @@ #ifdef STRANG #include #endif -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #endif #include diff --git a/integration/BackwardEuler/be_type.H b/integration/BackwardEuler/be_type.H index 70fbe7af79..78ee32c05d 100644 --- a/integration/BackwardEuler/be_type.H +++ b/integration/BackwardEuler/be_type.H @@ -10,7 +10,7 @@ #ifdef STRANG #include #endif -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #endif #include diff --git a/integration/Make.package b/integration/Make.package index df1b6e7f84..23aaaed186 100644 --- a/integration/Make.package +++ b/integration/Make.package @@ -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 diff --git a/integration/RKC/Make.package b/integration/RKC/Make.package index 1d50a75d21..1ec07f04b3 100644 --- a/integration/RKC/Make.package +++ b/integration/RKC/Make.package @@ -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 diff --git a/integration/RKC/rkc.H b/integration/RKC/rkc.H index 37c698ef43..91281b165a 100644 --- a/integration/RKC/rkc.H +++ b/integration/RKC/rkc.H @@ -8,7 +8,7 @@ #include #include #endif -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #include #endif diff --git a/integration/RKC/rkc_type.H b/integration/RKC/rkc_type.H index 2a31f74858..efcbf765a8 100644 --- a/integration/RKC/rkc_type.H +++ b/integration/RKC/rkc_type.H @@ -94,7 +94,7 @@ struct rkc_t { }; -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #endif #ifdef STRANG diff --git a/integration/VODE/Make.package b/integration/VODE/Make.package index 5f6b8a8d7f..861f60ff97 100644 --- a/integration/VODE/Make.package +++ b/integration/VODE/Make.package @@ -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 diff --git a/integration/VODE/vode_dvhin.H b/integration/VODE/vode_dvhin.H index 1ef7779926..fbf6bbc1c5 100644 --- a/integration/VODE/vode_dvhin.H +++ b/integration/VODE/vode_dvhin.H @@ -4,12 +4,9 @@ #ifdef STRANG #include #endif -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #endif -#ifdef TRUE_SDC -#include -#endif template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/integration/VODE/vode_dvjac.H b/integration/VODE/vode_dvjac.H index 9935ee5820..35113e8c5c 100644 --- a/integration/VODE/vode_dvjac.H +++ b/integration/VODE/vode_dvjac.H @@ -8,12 +8,9 @@ #ifdef STRANG #include #endif -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #endif -#ifdef TRUE_SDC -#include -#endif template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/integration/VODE/vode_dvode.H b/integration/VODE/vode_dvode.H index 924c010325..279634cac4 100644 --- a/integration/VODE/vode_dvode.H +++ b/integration/VODE/vode_dvode.H @@ -7,12 +7,9 @@ #ifdef STRANG #include #endif -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #endif -#ifdef TRUE_SDC -#include -#endif #ifdef NSE_TABLE #include #endif @@ -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 diff --git a/integration/VODE/vode_dvstep.H b/integration/VODE/vode_dvstep.H index 5b850225eb..144ac480d2 100644 --- a/integration/VODE/vode_dvstep.H +++ b/integration/VODE/vode_dvstep.H @@ -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); @@ -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; } @@ -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. diff --git a/integration/VODE/vode_type.H b/integration/VODE/vode_type.H index ce37e163ec..e785b237f7 100644 --- a/integration/VODE/vode_type.H +++ b/integration/VODE/vode_type.H @@ -238,7 +238,7 @@ void print_state(dvode_t& dvode_state) } #endif -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #endif #ifdef STRANG diff --git a/integration/integrator.H b/integration/integrator.H index 143d2fba6d..9fe187c8a9 100644 --- a/integration/integrator.H +++ b/integration/integrator.H @@ -1,7 +1,7 @@ #ifndef INTEGRATOR_H #define INTEGRATOR_H -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #else #include diff --git a/integration/utils/circle_theorem.H b/integration/utils/circle_theorem.H index b8dd029eab..291449f690 100644 --- a/integration/utils/circle_theorem.H +++ b/integration/utils/circle_theorem.H @@ -6,7 +6,7 @@ #include #include #endif -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #include #endif diff --git a/integration/utils/nonaka_plot.H b/integration/utils/nonaka_plot.H index 182a85502e..57c9ebb68b 100644 --- a/integration/utils/nonaka_plot.H +++ b/integration/utils/nonaka_plot.H @@ -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 @@ -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 diff --git a/interfaces/burner.H b/interfaces/burner.H index 059d8d5f44..832edede73 100644 --- a/interfaces/burner.H +++ b/interfaces/burner.H @@ -16,7 +16,7 @@ #ifdef STRANG #include #endif -#ifdef SIMPLIFIED_SDC +#ifdef SDC #include #endif #endif @@ -26,8 +26,6 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void burner (BurnT& state, Real dt) { -#ifndef TRUE_SDC - #ifdef NSE bool nse_check = in_nse(state); @@ -35,7 +33,7 @@ void burner (BurnT& state, Real dt) if (nse_check) { // call the table -#ifdef SIMPLIFIED_SDC +#ifdef SDC sdc_nse_burn(state, dt); #else nse_burn(state, dt); @@ -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); @@ -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); @@ -94,8 +92,6 @@ void burner (BurnT& state, Real dt) integrator(state, dt); #endif -#endif - } #endif