Skip to content

Commit

Permalink
testing ERK
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnonaka committed Jul 16, 2024
1 parent 01b90db commit 7692113
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ExampleCodes/SUNDIALS/Exec/inputs
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
10 changes: 10 additions & 0 deletions ExampleCodes/SUNDIALS/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */) {

Expand Down Expand Up @@ -198,6 +204,7 @@ void main_main ()

TimeIntegrator<MultiFab> 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();
Expand All @@ -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);

Expand Down

0 comments on commit 7692113

Please sign in to comment.