PFASST++
pfasst::PFASST< time > Class Template Reference

Implementation of the PFASST algorithm as described in [1] . More...

#include <pfasst.hpp>

+ Inheritance diagram for pfasst::PFASST< time >:
+ Collaboration diagram for pfasst::PFASST< time >:

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

ICommunicatorcomm
 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...
 

Detailed Description

template<typename time = pfasst::time_precision>
class pfasst::PFASST< time >

Implementation of the PFASST algorithm as described in [1] .

Definition at line 19 of file pfasst.hpp.

Member Typedef Documentation

template<typename time = pfasst::time_precision>
typedef pfasst::Controller<time>::LevelIter pfasst::PFASST< time >::LevelIter
private

Definition at line 22 of file pfasst.hpp.

Member Function Documentation

template<typename time >
void pfasst::PFASST< time >::broadcast ( )
privatevirtual

Broadcast finest level to all processes of PFASST::comm.

See also
ISweeper::broadcast() and its implementations for details on how broadcasting levels is done.

Definition at line 199 of file pfasst_impl.hpp.

template<typename time = pfasst::time_precision>
PFASST< time >::LevelIter pfasst::PFASST< time >::cycle_bottom ( LevelIter  level_iter)
private

Sweep on the current (coarsest) level.

Parameters
[in]level_iterlevel iterator pointing to the coarsest level
Returns
level iterator pointing to the next finer level
Precondition
It is assumed that 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.

+ Here is the call graph for this function:

template<typename time = pfasst::time_precision>
PFASST< time >::LevelIter pfasst::PFASST< time >::cycle_down ( LevelIter  level_iter)
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.

Parameters
[in]level_iterlevel iterator pointing to the finer level
Returns
level iterator to current level if it has converged after the sweep; otherwise a level iterator to the next coarser 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().

+ Here is the call graph for this function:

template<typename time = pfasst::time_precision>
PFASST< time >::LevelIter pfasst::PFASST< time >::cycle_up ( LevelIter  level_iter)
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.

Parameters
[in]level_iterlevel iterator pointing to the finer level
Returns
level iterator pointing to the coarser level
Note
If the fine level corresponds to the finest MLSDC level, we don't perform a sweep. In this case the only operation that is performed here is interpolation.

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().

+ Here is the call graph for this function:

template<typename time = pfasst::time_precision>
PFASST< time >::LevelIter pfasst::PFASST< time >::cycle_v ( LevelIter  level_iter)
private

Perform an MLSDC V-cycle.

Parameters
[in]level_iterlevel iterator pointing to a fine level
Returns
level iterator pointing to either the coarsest level if 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 convergence
Note
This method is recursive with two exit points. The two exit points:
  1. if level_iter points to the coarsest level
  2. if MLSDC::cycle_down() results in a converged state

Definition at line 147 of file pfasst_impl.hpp.

References pfasst::Controller< time >::LevelIter::level.

template<typename time >
void pfasst::PFASST< time >::perform_sweeps ( size_t  level)
private

Definition at line 9 of file pfasst_impl.hpp.

template<typename time >
void pfasst::PFASST< time >::post ( )
privatevirtual

Post current status and values to next processor.

See also
IStatus::post() for details and implementations of posting current status
ISweeper::post() for details and implementations of posting current level

Definition at line 228 of file pfasst_impl.hpp.

template<typename time >
void pfasst::PFASST< time >::predictor ( )
privatevirtual

Predictor: restrict initial down, preform coarse sweeps, return to finest.

Definition at line 160 of file pfasst_impl.hpp.

template<typename time >
void pfasst::PFASST< time >::run ( )
overridevirtual

Solve ODE using PFASST.

Precondition
It is assumed that the user has set initial conditions on the finest level.
Note
Currently uses block mode PFASST with the standard predictor (see PFASST::predictor()).

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename time >
void pfasst::PFASST< time >::set_comm ( ICommunicator comm)
virtual

Set communicator.

Parameters
[in]commICommunicator 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().

+ Here is the caller graph for this function:

template<typename time >
int pfasst::PFASST< time >::stag ( LevelIter  level_iter)
privatevirtual

Definition at line 218 of file pfasst_impl.hpp.

References pfasst::Controller< time >::LevelIter::level.

template<typename time >
int pfasst::PFASST< time >::tag ( LevelIter  level_iter)
privatevirtual

Generate a unique tag for level iterator.

Parameters
[in]level_iterlevel iterator providing information to compute the communication tag

Definition at line 212 of file pfasst_impl.hpp.

References pfasst::Controller< time >::LevelIter::level.

Member Data Documentation

template<typename time = pfasst::time_precision>
ICommunicator* pfasst::PFASST< time >::comm
private

communicator to use

Definition at line 24 of file pfasst.hpp.

template<typename time = pfasst::time_precision>
bool pfasst::PFASST< time >::predict
private

whether to use a predict sweep

Definition at line 25 of file pfasst.hpp.


The documentation for this class was generated from the following files: