12#ifndef DUMUX_TIMESTEPPING_MULTISTAGE_TIMESTEPPER_HH
13#define DUMUX_TIMESTEPPING_MULTISTAGE_TIMESTEPPER_HH
23class MultiStageMethod;
38 params_.resize(size_);
39 for (std::size_t k = 0; k < size_; ++k)
48 p.skipTemporal = (abs(p.alpha) < 1e-6);
49 p.skipSpatial = (abs(p.betaDt) < 1e-6);
58 {
return params_[k].alpha; }
62 {
return params_[k].betaDt; }
66 {
return params_[k].timeAtStage; }
70 {
return params_[k].dtFraction; }
74 {
return params_[k].skipTemporal; }
78 {
return params_[k].skipSpatial; }
82 std::vector<Params> params_;
91template<
class PDESolver>
108 : pdeSolver_(pdeSolver)
109 , msMethod_(msMethod)
120 void step(Variables& vars,
const Scalar t,
const Scalar dt)
123 pdeSolver_->assembler().clearStages();
125 for (
auto stageIdx = 1UL; stageIdx <= msMethod_->numStages(); ++stageIdx)
128 auto stageParams = std::make_shared<StageParams>(*msMethod_, stageIdx, t, dt);
131 pdeSolver_->assembler().prepareStage(vars, stageParams);
134 pdeSolver_->solve(vars);
138 pdeSolver_->assembler().clearStages();
145 { msMethod_ = msMethod; }
148 std::shared_ptr<PDESolver> pdeSolver_;
149 std::shared_ptr<const MultiStageMethod<Scalar>> msMethod_;
Abstract interface for one-step multi-stage method parameters in Shu/Osher form.
Definition: multistagemethods.hh:59
virtual Scalar timeStepWeight(std::size_t k) const =0
time step weights for each stage ( )
virtual Scalar temporalWeight(std::size_t i, std::size_t k) const =0
weights of the temporal operator residual ( )
virtual Scalar spatialWeight(std::size_t i, std::size_t k) const =0
weights of the spatial operator residual ( )
Data object for the parameters of a given stage.
Definition: multistagetimestepper.hh:28
Scalar timeAtStage(std::size_t k) const
the time at which we have to evaluate the operators
Definition: multistagetimestepper.hh:65
Scalar spatialWeight(std::size_t k) const
weights of the spatial operator residual ( )
Definition: multistagetimestepper.hh:61
Scalar timeStepFraction(std::size_t k) const
the fraction of a time step corresponding to the k-th stage
Definition: multistagetimestepper.hh:69
Scalar skipTemporal(std::size_t k) const
If .
Definition: multistagetimestepper.hh:73
std::size_t size() const
Definition: multistagetimestepper.hh:53
Scalar skipSpatial(std::size_t k) const
If .
Definition: multistagetimestepper.hh:77
Scalar temporalWeight(std::size_t k) const
weights of the temporal operator residual ( )
Definition: multistagetimestepper.hh:57
MultiStageParams(const MultiStageMethod< Scalar > &m, std::size_t i, const Scalar t, const Scalar dt)
Extract params for stage i from method m.
Definition: multistagetimestepper.hh:35
Time stepping with a multi-stage method.
Definition: multistagetimestepper.hh:93
void setMethod(std::shared_ptr< const MultiStageMethod< Scalar > > msMethod)
Set/change the time step method.
Definition: multistagetimestepper.hh:144
void step(Variables &vars, const Scalar t, const Scalar dt)
Advance one time step of the given time loop.
Definition: multistagetimestepper.hh:120
MultiStageTimeStepper(std::shared_ptr< PDESolver > pdeSolver, std::shared_ptr< const MultiStageMethod< Scalar > > msMethod)
The constructor.
Definition: multistagetimestepper.hh:106
typename ScalarT< X >::type Scalar
export the underlying scalar type
Definition: variables.hh:57
Detail::PDESolver::AssemblerVariables< Assembler > Variables
export the type of variables that represent a numerical solution
Definition: common/pdesolver.hh:71
Definition: variables.hh:21