From 7692113471c4a001d1ce5a8ff4532bdc9686e46b Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Mon, 15 Jul 2024 19:27:10 -0700 Subject: [PATCH] testing ERK --- ExampleCodes/SUNDIALS/Exec/inputs | 4 ++-- ExampleCodes/SUNDIALS/Source/main.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ExampleCodes/SUNDIALS/Exec/inputs b/ExampleCodes/SUNDIALS/Exec/inputs index a4f5244f..be6b0821 100644 --- a/ExampleCodes/SUNDIALS/Exec/inputs +++ b/ExampleCodes/SUNDIALS/Exec/inputs @@ -18,9 +18,9 @@ dt = 1.e-4 ## 0 or "ForwardEuler" => Native AMReX Forward Euler integrator ## 1 or "RungeKutta" => Native AMReX Explicit Runge Kutta controlled by integration.rk.type ## 2 or "SUNDIALS" => SUNDIALS backend controlled by integration.sundials.strategy -integration.type = ForwardEuler +#integration.type = ForwardEuler #integration.type = RungeKutta -#integration.type = SUNDIALS +integration.type = SUNDIALS ## Native AMReX Explicit Runge-Kutta parameters # diff --git a/ExampleCodes/SUNDIALS/Source/main.cpp b/ExampleCodes/SUNDIALS/Source/main.cpp index 38768e8e..e2b3f557 100644 --- a/ExampleCodes/SUNDIALS/Source/main.cpp +++ b/ExampleCodes/SUNDIALS/Source/main.cpp @@ -125,6 +125,7 @@ void main_main () // we allocate two phi multifabs; one will store the old state, the other the new. MultiFab phi(ba, dm, Ncomp, Nghost); + MultiFab phi_new(ba, dm, Ncomp, Nghost); // time = starting time in the simulation Real time = 0.0; @@ -170,6 +171,11 @@ void main_main () S_data.FillBoundary(geom.periodicity()); }; +// auto post_step_function = [&](MultiFab& S_data, const Real /* time */) { +// // fill periodic ghost cells +// S_data.FillBoundary(geom.periodicity()); +// }; + auto rhs_function = [&](MultiFab& S_rhs, const MultiFab& S_data, const Real /* time */) { @@ -198,6 +204,7 @@ void main_main () TimeIntegrator integrator(phi, time); integrator.set_pre_rhs_action(pre_rhs_function); +// integrator.set_post_step_action(post_step_function); integrator.set_rhs(rhs_function); if (adapt_dt) { integrator.set_adaptive_step(); @@ -218,6 +225,9 @@ void main_main () // Advance to output time integrator.evolve(phi, time); +// integrator.advance(phi,phi_new,time,dt); +// MultiFab::Copy(phi,phi_new,0,0,1,0); + Real step_stop_time = ParallelDescriptor::second() - step_start_time; ParallelDescriptor::ReduceRealMax(step_stop_time);