diff --git a/ExampleCodes/SUNDIALS/Exec/inputs b/ExampleCodes/SUNDIALS/Exec/inputs new file mode 100644 index 00000000..165b4fbf --- /dev/null +++ b/ExampleCodes/SUNDIALS/Exec/inputs @@ -0,0 +1,50 @@ +n_cell = 32 +max_grid_size = 16 + +nsteps = 5 +plot_int = 5 +dt = 1.e-4 + +#nsteps = 10 +#plot_int = 10 +#dt = 5.e-5 + +#nsteps = 20 +#plot_int = 20 +#dt = 2.5e-5 + +adapt_dt = true + +# INTEGRATION +## integration.type can take on the following values: +## 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 = RungeKutta +#integration.type = SUNDIALS + +## Native AMReX Explicit Runge-Kutta parameters +# +## integration.rk.type can take the following values: +### 0 = User-specified Butcher Tableau +### 1 = Forward Euler +### 2 = Trapezoid Method +### 3 = SSPRK3 Method +### 4 = RK4 Method +integration.rk.type = 1 + +# Set the SUNDIALS method type: +# ERK = Explicit Runge-Kutta method +# DIRK = Diagonally Implicit Runge-Kutta method +# +# Optionally select a specific SUNDIALS method by name, see the SUNDIALS +# documentation for the supported method names + +# Use forward Euler (fixed step sizes only) +integration.sundials.type = ERK +integration.sundials.method = ARKODE_FORWARD_EULER_1_1 + +# Use backward Euler (fixed step sizes only) +#integration.sundials.type = DIRK +#integration.sundials.method = ARKODE_BACKWARD_EULER_1_1 diff --git a/ExampleCodes/SUNDIALS/Exec/inputs_forward_euler b/ExampleCodes/SUNDIALS/Exec/inputs_forward_euler deleted file mode 100644 index 39b09830..00000000 --- a/ExampleCodes/SUNDIALS/Exec/inputs_forward_euler +++ /dev/null @@ -1,14 +0,0 @@ -n_cell = 32 -max_grid_size = 16 - -nsteps = 1000 -plot_int = 100 - -dt = 1.e-5 - -# INTEGRATION -## integration.type can take on the following values: -## 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 diff --git a/ExampleCodes/SUNDIALS/Exec/inputs_rk3 b/ExampleCodes/SUNDIALS/Exec/inputs_rk3 deleted file mode 100644 index 6eb60137..00000000 --- a/ExampleCodes/SUNDIALS/Exec/inputs_rk3 +++ /dev/null @@ -1,24 +0,0 @@ -n_cell = 32 -max_grid_size = 16 - -nsteps = 1000 -plot_int = 100 - -dt = 1.e-5 - -# INTEGRATION -## integration.type can take on the following values: -## 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 = RungeKutta - -## Native AMReX Explicit Runge-Kutta parameters -# -## integration.rk.type can take the following values: -### 0 = User-specified Butcher Tableau -### 1 = Forward Euler -### 2 = Trapezoid Method -### 3 = SSPRK3 Method -### 4 = RK4 Method -integration.rk.type = 3 diff --git a/ExampleCodes/SUNDIALS/Source/main.cpp b/ExampleCodes/SUNDIALS/Source/main.cpp index cd24a35f..b7bdd590 100644 --- a/ExampleCodes/SUNDIALS/Source/main.cpp +++ b/ExampleCodes/SUNDIALS/Source/main.cpp @@ -77,7 +77,7 @@ void main_main () pp.query("reltol",reltol); pp.query("abstol",abstol); } - + // ********************************** // SIMULATION SETUP @@ -129,6 +129,9 @@ void main_main () // time = starting time in the simulation Real time = 0.0; + Print() << "dt = " << dt << std::endl; + Print() << "Diffusive CFL time step = " << dx[0]*dx[0]/(2.*AMREX_SPACEDIM) << std::endl; + // ********************************** // INITIALIZE DATA @@ -203,16 +206,23 @@ void main_main () integrator.set_time_step(dt); } + Real evolution_start_time = ParallelDescriptor::second(); + for (int step = 1; step <= nsteps; ++step) { // Set time to evolve to time += dt; + Real step_start_time = ParallelDescriptor::second(); + // Advance to output time integrator.evolve(phi, time); + Real step_stop_time = ParallelDescriptor::second() - step_start_time; + ParallelDescriptor::ReduceRealMax(step_stop_time); + // Tell the I/O Processor to write out which step we're doing - amrex::Print() << "Advanced step " << step << "\n"; + amrex::Print() << "Advanced step " << step << " in " << step_stop_time << " seconds; time = " << time << "\n"; // Write a plotfile of the current data (plot_int was defined in the inputs file) if (plot_int > 0 && step%plot_int == 0) @@ -221,4 +231,8 @@ void main_main () WriteSingleLevelPlotfile(pltfile, phi, {"phi"}, geom, time, step); } } + + Real evolution_stop_time = ParallelDescriptor::second() - evolution_start_time; + ParallelDescriptor::ReduceRealMax(evolution_stop_time); + amrex::Print() << "Total evolution time = " << evolution_stop_time << " seconds\n"; } diff --git a/ExampleCodes/SUNDIALS_Multirate/Exec/inputs b/ExampleCodes/SUNDIALS_Multirate/Exec/inputs new file mode 100644 index 00000000..1f89cf49 --- /dev/null +++ b/ExampleCodes/SUNDIALS_Multirate/Exec/inputs @@ -0,0 +1,52 @@ +n_cell = 32 +max_grid_size = 16 + +nsteps = 5 +plot_int = 5 +dt = 1.e-4 + +#nsteps = 10 +#plot_int = 10 +#dt = 5.e-5 + +#nsteps = 20 +#plot_int = 20 +#dt = 2.5e-5 + +# INTEGRATION +## integration.type can take on the following values: +## 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.type +integration.type = ForwardEuler +integration.type = RungeKutta +integration.type = SUNDIALS + +## Native AMReX Explicit Runge-Kutta parameters +# +## integration.rk.type can take the following values: +### 0 = User-specified Butcher Tableau +### 1 = Forward Euler +### 2 = Trapezoid Method +### 3 = SSPRK3 Method +### 4 = RK4 Method +integration.rk.type = 1 + +# Set the SUNDIALS method type: +# ERK = Explicit Runge-Kutta method +# DIRK = Diagonally Implicit Runge-Kutta method +# IMEX-RK = Implicit-Explicit Additive Runge-Kutta method +# EX-MRI = Explicit Multirate Infatesimal method +# IM-MRI = Implicit Multirate Infatesimal method +# IMEX-MRI = Implicit-Explicit Multirate Infatesimal method +# +# Optionally select a specific SUNDIALS method by name, see the SUNDIALS +# documentation for the supported method names + +# Use forward Euler (fixed step sizes only) +integration.sundials.type = ERK +integration.sundials.method = ARKODE_FORWARD_EULER_1_1 + +# Use backward Euler (fixed step sizes only) +#integration.sundials.type = DIRK +#integration.sundials.method = ARKODE_BACKWARD_EULER_1_1