Multilevel SDC controller. More...
#include <mlsdc.hpp>
Public Member Functions | |
virtual void | setup () override |
Basic setup routine for this controller. More... | |
virtual void | set_nsweeps (vector< size_t > nsweeps) |
Set desired number of sweeps for each level independently. More... | |
virtual void | run () |
Solve ODE using MLSDC. More... | |
![]() | |
Controller () | |
virtual | ~Controller () |
virtual void | set_options (bool all_sweepers=true) |
Set options from command line etc. More... | |
virtual void | set_duration (time t0, time tend, time dt, size_t niters) |
Set basic time scope of the Controller. More... | |
virtual void | add_level (shared_ptr< ISweeper< time >> sweeper, shared_ptr< ITransfer< time >> transfer=shared_ptr< ITransfer< time >>(nullptr), bool coarse=true) |
Adding a level to the controller. More... | |
virtual size_t | nlevels () |
Total number of levels controlled by this Controller. More... | |
template<typename R = ISweeper<time>> | |
shared_ptr< R > | get_level (size_t level) |
Get sweeper for level with index level . More... | |
template<typename R = ISweeper<time>> | |
shared_ptr< R > | get_finest () |
Get coarsest level. More... | |
template<typename R = ISweeper<time>> | |
shared_ptr< R > | get_coarsest () |
Get coarsest level. More... | |
template<typename R = ITransfer<time>> | |
shared_ptr< R > | get_transfer (size_t level) |
Retreive transfer operator for level level . More... | |
virtual size_t | get_step () |
Get current time step index. More... | |
virtual void | set_step (size_t n) |
Set current time step index. More... | |
virtual time | get_step_size () |
Get width of current time step. More... | |
time | get_dt () |
Get width of current time step (alias for get_step_size). More... | |
virtual time | get_time () |
Get start time point of current time step. More... | |
time | get_t () |
Get start time point of current time step (alias for get_time). More... | |
virtual void | advance_time (size_t nsteps=1) |
Advance to a following time step. More... | |
virtual time | get_end_time () |
Get end time point of last time step. More... | |
virtual size_t | get_iteration () |
Get current iteration index of current time step. More... | |
virtual void | set_iteration (size_t iter) |
Set current iteration of current time step. More... | |
virtual void | advance_iteration () |
Advance to the next iteration. More... | |
virtual size_t | get_max_iterations () |
Get maximum number of allowed iterations per time step. More... | |
virtual LevelIter | finest () |
Convenience accessor to the finest level. More... | |
virtual LevelIter | coarsest () |
Convenience accessor to the coarsest level. More... | |
Protected Types | |
typedef pfasst::Controller< time >::LevelIter | LevelIter |
Protected Member Functions | |
void | perform_sweeps (size_t level) |
Perform pre-configured number of sweeps on level level . More... | |
Protected Attributes | |
vector< size_t > | nsweeps |
How many sweeps should be done on the different levels. More... | |
bool | predict |
Whether to use a predict sweep. More... | |
bool | initial |
Whether we're sweeping from a new initial condition. More... | |
bool | converged |
Whether we've converged. More... | |
![]() | |
deque< shared_ptr< ISweeper< time > > > | levels |
Ordered list of all levels. More... | |
deque< shared_ptr< ITransfer< time > > > | transfer |
Ordered list of transfer operators for levels. More... | |
size_t | step |
Current time step index. More... | |
size_t | iteration |
Current iteration index on current time step. More... | |
size_t | max_iterations |
Maximum iterations per time step. More... | |
time | t |
\( t_0 \) of current time step. More... | |
time | dt |
Width of current time step (\( \Delta t \)). More... | |
time | tend |
\( T_{end} \) of last time step. More... | |
Private Member Functions | |
LevelIter | cycle_down (LevelIter level_iter) |
Sweep on current (fine), restrict to coarse. More... | |
LevelIter | cycle_up (LevelIter level_iter) |
Interpolate coarse correction to fine, sweep on current (fine). More... | |
LevelIter | cycle_bottom (LevelIter level_iter) |
Sweep on the current (coarsest) level. More... | |
LevelIter | cycle_v (LevelIter level_iter) |
Perform an MLSDC V-cycle. More... | |
Multilevel SDC controller.
time | time precision |
|
protected |
|
private |
Sweep on the current (coarsest) level.
[in] | level_iter | level iterator pointing to the coarsest level |
level_iter
currently points to the coarsest level. Definition at line 145 of file mlsdc_impl.hpp.
References pfasst::Controller< time >::LevelIter::level.
|
private |
Sweep on current (fine), restrict to coarse.
First, MLSDC::perform_sweeps() with current level is called followed by a check on convergence via ISweeper::converged() on the same level.
[in] | level_iter | level iterator pointing to the finer level |
If it has not converged the transfer operator of the current level is used to restrict from current to coarse via ITransfer::restrict() (under consideration of MLSDC::initial). The FAS correction is computed via the same transfer operators ITransfer::fas() method.
A call to ISweeper::save() finalizes the restriction on the coarser level.
Definition at line 99 of file mlsdc_impl.hpp.
References pfasst::Controller< time >::LevelIter::coarse(), pfasst::Controller< time >::LevelIter::current(), pfasst::Controller< time >::LevelIter::level, ML_CVLOG, and pfasst::Controller< time >::LevelIter::transfer().
|
private |
Interpolate coarse correction to fine, sweep on current (fine).
First the transfer operator of the current level is used (via ITransfer::interpolate()) to interpolate from the coarser level to the current (finer) level.
[in] | level_iter | level iterator pointing to the finer level |
Definition at line 128 of file mlsdc_impl.hpp.
References pfasst::Controller< time >::LevelIter::coarse(), pfasst::Controller< time >::LevelIter::current(), pfasst::Controller< time >::LevelIter::level, ML_CVLOG, and pfasst::Controller< time >::LevelIter::transfer().
|
private |
Perform an MLSDC V-cycle.
[in] | level_iter | level iterator pointing to a fine level |
level_iter
is the coarsest level or the same level as level_iter
if a sweep on that level results in convergence or all sweeps on all coarser levels did not let to convergencelevel_iter
points to the coarsest levelDefinition at line 158 of file mlsdc_impl.hpp.
References pfasst::Controller< time >::LevelIter::level.
|
protected |
Perform pre-configured number of sweeps on level level
.
One sweep is either a call to ISweeper::predict() if MLSDC::predict is true
followed by triggering the ISweeper::post_predict() hook.
[in] | level | level index to perform pre-configured number of sweeps |
In case MLSDC::predict is false
, ISweeper::sweep() and subsequent ISweeper::post_sweep() are called.
Definition at line 20 of file mlsdc_impl.hpp.
References ML_CVLOG.
|
virtual |
Solve ODE using MLSDC.
Reimplemented in pfasst::PFASST< time >.
Definition at line 62 of file mlsdc_impl.hpp.
Referenced by pfasst::PFASST< time >::run(), pfasst::examples::boris::run_boris_sdc(), and pfasst::examples::advection_diffusion::run_serial_mlsdc().
|
virtual |
Set desired number of sweeps for each level independently.
[in] | nsweeps | vector with number of sweeps for each level. |
Definition at line 56 of file mlsdc_impl.hpp.
Referenced by pfasst::examples::advection_diffusion::run_mpi_pfasst().
|
overridevirtual |
Basic setup routine for this controller.
Reimplemented from pfasst::Controller< time >.
Definition at line 45 of file mlsdc_impl.hpp.
Referenced by pfasst::examples::boris::run_boris_pfasst(), pfasst::examples::boris::run_boris_sdc(), pfasst::examples::advection_diffusion::run_mpi_pfasst(), and pfasst::examples::advection_diffusion::run_serial_mlsdc().
|
protected |
|
protected |
|
protected |
|
protected |