Implementation of the PFASST algorithm as described in [1] . More...
#include <pfasst.hpp>
Public Member Functions | |
virtual void | run () override |
Solve ODE using PFASST. More... | |
Public Member Functions inherited from pfasst::MLSDC< time > | |
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... | |
Public Member Functions inherited from pfasst::Controller< time > | |
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... | |
Private Types | |
typedef pfasst::Controller< time >::LevelIter | LevelIter |
Private Member Functions | |
void | perform_sweeps (size_t level) |
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... | |
virtual void | predictor () |
Predictor: restrict initial down, preform coarse sweeps, return to finest. More... | |
Private Attributes | |
ICommunicator * | comm |
communicator to use More... | |
bool | predict |
whether to use a predict sweep More... | |
Communication | |
virtual void | broadcast () |
Broadcast finest level to all processes of PFASST::comm. More... | |
virtual int | tag (LevelIter level_iter) |
Generate a unique tag for level iterator. More... | |
virtual int | stag (LevelIter level_iter) |
virtual void | post () |
Post current status and values to next processor. More... | |
virtual void | set_comm (ICommunicator *comm) |
Set communicator. More... | |
Additional Inherited Members | |
Protected Types inherited from pfasst::MLSDC< time > | |
typedef pfasst::Controller< time >::LevelIter | LevelIter |
Protected Member Functions inherited from pfasst::MLSDC< time > | |
void | perform_sweeps (size_t level) |
Perform pre-configured number of sweeps on level level . More... | |
Protected Attributes inherited from pfasst::MLSDC< time > | |
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... | |
Protected Attributes inherited from pfasst::Controller< time > | |
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... | |
Implementation of the PFASST algorithm as described in [1] .
Definition at line 19 of file pfasst.hpp.
|
private |
Definition at line 22 of file pfasst.hpp.
|
privatevirtual |
Broadcast finest level to all processes of PFASST::comm.
Definition at line 199 of file pfasst_impl.hpp.
|
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 131 of file pfasst_impl.hpp.
References pfasst::Controller< time >::LevelIter::current(), and 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 92 of file pfasst_impl.hpp.
References pfasst::Controller< time >::LevelIter::coarse(), pfasst::Controller< time >::LevelIter::current(), pfasst::Controller< time >::LevelIter::level, 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 113 of file pfasst_impl.hpp.
References pfasst::Controller< time >::LevelIter::coarse(), pfasst::Controller< time >::LevelIter::current(), pfasst::Controller< time >::LevelIter::level, 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 147 of file pfasst_impl.hpp.
References pfasst::Controller< time >::LevelIter::level.
|
private |
Definition at line 9 of file pfasst_impl.hpp.
|
privatevirtual |
Post current status and values to next processor.
Definition at line 228 of file pfasst_impl.hpp.
|
privatevirtual |
Predictor: restrict initial down, preform coarse sweeps, return to finest.
Definition at line 160 of file pfasst_impl.hpp.
|
overridevirtual |
Solve ODE using PFASST.
Reimplemented from pfasst::MLSDC< time >.
Definition at line 40 of file pfasst_impl.hpp.
References ML_CLOG, and pfasst::MLSDC< time >::run().
Referenced by pfasst::examples::boris::run_boris_pfasst(), and pfasst::examples::advection_diffusion::run_mpi_pfasst().
|
virtual |
Set communicator.
[in] | comm | ICommunicator to use |
Definition at line 30 of file pfasst_impl.hpp.
Referenced by pfasst::examples::boris::run_boris_pfasst(), and pfasst::examples::advection_diffusion::run_mpi_pfasst().
|
privatevirtual |
Definition at line 218 of file pfasst_impl.hpp.
References pfasst::Controller< time >::LevelIter::level.
|
privatevirtual |
Generate a unique tag for level iterator.
[in] | level_iter | level iterator providing information to compute the communication tag |
Definition at line 212 of file pfasst_impl.hpp.
References pfasst::Controller< time >::LevelIter::level.
|
private |
communicator to use
Definition at line 24 of file pfasst.hpp.
|
private |
whether to use a predict sweep
Definition at line 25 of file pfasst.hpp.