Skip to content

Commit

Permalink
update options
Browse files Browse the repository at this point in the history
  • Loading branch information
gardner48 committed Jun 4, 2024
1 parent e04bfe7 commit 4f66639
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions ExampleCodes/SUNDIALS/Exec/inputs_forward_euler
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
n_cell = 32
max_grid_size = 16

nsteps = 1000
plot_int = 100
nsteps = 10
plot_int = 1

dt = 1.e-5

Expand Down
4 changes: 2 additions & 2 deletions ExampleCodes/SUNDIALS/Exec/inputs_rk3
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
n_cell = 32
max_grid_size = 16

nsteps = 1000
plot_int = 100
nsteps = 10
plot_int = 1

dt = 1.e-5

Expand Down
11 changes: 5 additions & 6 deletions ExampleCodes/SUNDIALS/Exec/inputs_sundials_erk
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
n_cell = 32
max_grid_size = 16

# time between outputs
dt_out = 1.e-3

# number of output steps
nsteps = 10
plot_int = 10
plot_int = 1

dt = 1.e-5

# final time
t_final = 1.e-2
# use adaptive time stepping -- should also set integrator tolerances
# adapt_dt = true

# INTEGRATION
# integration.type can take on the following values:
Expand Down
22 changes: 12 additions & 10 deletions ExampleCodes/SUNDIALS/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ void main_main ()
int plot_int;

// time step
Real dt_out;
Real dt;

// final time
Real t_final;
// use adaptive time step (dt used for output time)
bool adapt_dt = false;

// inputs parameters
{
Expand All @@ -64,10 +64,10 @@ void main_main ()
pp.query("plot_int",plot_int);

// time step
pp.get("dt_out",dt_out);
pp.get("dt",dt);

// time step
pp.get("t_final",t_final);
// use adaptive step sizes
pp.query("adapt_dt",adapt_dt);
}

// **********************************
Expand Down Expand Up @@ -188,11 +188,15 @@ void main_main ()
TimeIntegrator<MultiFab> integrator(phi, time);
integrator.set_pre_rhs_action(pre_rhs_function);
integrator.set_rhs(rhs_function);
integrator.set_time_step(dt);
if (adapt_dt) {
integrator.set_adaptive_step();
}

for (int step = 1; step <= nsteps; ++step)
{
// Set output time
time += dt_out;
// Set time to evolve to
time += dt;

// Advance to output time
integrator.evolve(phi, time);
Expand All @@ -206,7 +210,5 @@ void main_main ()
const std::string& pltfile = amrex::Concatenate("plt",step,5);
WriteSingleLevelPlotfile(pltfile, phi, {"phi"}, geom, time, step);
}

if (time > t_final) break;
}
}

0 comments on commit 4f66639

Please sign in to comment.