28 namespace advection_diffusion
39 double step_size_in=0.01,
46 const size_t nsteps = config::get_value<size_t>(
"num_steps", nsteps_in);
47 const double dt = config::get_value<double>(
"step_size", step_size_in);
48 const size_t niters = config::get_value<size_t>(
"num_iter", num_iter_in);
52 size_t nnodes = config::get_value<size_t>(
"num_nodes", nnodes_in);
53 size_t ndofs = config::get_value<size_t>(
"spatial_dofs", ndofs_in);
55 const double abs_res_tol = pfasst::config::get_value<double>(
"abs_res_tol", 0.0);
56 const double rel_res_tol = pfasst::config::get_value<double>(
"rel_res_tol", 0.0);
64 for (
size_t l = 0; l < nlevs; l++) {
66 auto factory = make_shared<VectorFactory<double>>(ndofs);
67 auto sweeper = make_shared<AdvectionDiffusionSweeper<>>(ndofs);
68 auto transfer = make_shared<SpectralTransfer1D<>>();
70 ML_LOG(INFO,
"expected quadrature error: " << quad->expected_error() <<
" (" << nnodes <<
")");
72 sweeper->set_quadrature(quad);
73 sweeper->set_factory(factory);
74 sweeper->set_residual_tolerances(abs_res_tol, rel_res_tol);
79 nnodes = (nnodes - 1) / trat + 1;
94 sweeper->exact(q0, 0.0);
104 tuple<error_map, residual_map> rinfo;
115 #ifndef PFASST_UNIT_TESTING
116 int main(
int argc,
char** argv)
virtual void run()
Solve ODE using MLSDC.
virtual void set_options(bool all_sweepers=true)
Set options from command line etc.
int main(int argc, char **argv)
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.
static void init(int argc, char **argv, std::function< void()> opts=nullptr, std::function< void()> logs=nullptr)
virtual LevelIter finest()
Convenience accessor to the finest level.
#define ML_LOG(level, x)
same as LOG(level, x) from easylogging++
virtual void set_duration(time t0, time tend, time dt, size_t niters)
Set basic time scope of the Controller.
Multilevel SDC controller.
virtual void setup() override
Basic setup routine for this controller.
shared_ptr< IQuadrature< precision > > quadrature_factory(const size_t nnodes, const QuadratureType qtype)
Instantiates quadrature handler for given number of nodes and type descriptor.
shared_ptr< R > get_finest()
Get coarsest level.
Encapsulations (short encaps) are the central data type for all PFASST++ algorithms.
virtual shared_ptr< Encapsulation< time > > get_start_state() const
advection-diffusion sweeper with semi-implicit time-integration.
virtual LevelIter coarsest()
Convenience accessor to the coarsest level.
error_map get_residuals()
tuple< error_map, residual_map > run_serial_mlsdc(size_t nlevs, size_t nsteps_in=4, double step_size_in=0.01, size_t num_iter_in=8, size_t nnodes_in=5, size_t ndofs_in=128)
Advection/diffusion example using an encapsulated IMEX sweeper.