24#ifndef DUMUX_TIMESTEPPING_MULTISTAGE_TIMESTEPPER_HH
25#define DUMUX_TIMESTEPPING_MULTISTAGE_TIMESTEPPER_HH
35class MultiStageMethod;
50 params_.resize(size_);
51 for (std::size_t k = 0; k < size_; ++k)
60 p.skipTemporal = (abs(p.alpha) < 1e-6);
61 p.skipSpatial = (abs(p.betaDt) < 1e-6);
70 {
return params_[k].alpha; }
74 {
return params_[k].betaDt; }
78 {
return params_[k].timeAtStage; }
82 {
return params_[k].dtFraction; }
86 {
return params_[k].skipTemporal; }
90 {
return params_[k].skipSpatial; }
94 std::vector<Params> params_;
103template<
class PDESolver>
120 : pdeSolver_(pdeSolver)
121 , msMethod_(msMethod)
132 void step(Variables& vars,
const Scalar t,
const Scalar dt)
135 pdeSolver_->assembler().clearStages();
137 for (
auto stageIdx = 1UL; stageIdx <= msMethod_->numStages(); ++stageIdx)
140 auto stageParams = std::make_shared<StageParams>(*msMethod_, stageIdx, t, dt);
143 pdeSolver_->assembler().prepareStage(vars, stageParams);
146 pdeSolver_->solve(vars);
150 pdeSolver_->assembler().clearStages();
157 { msMethod_ = msMethod; }
160 std::shared_ptr<PDESolver> pdeSolver_;
161 std::shared_ptr<const MultiStageMethod<Scalar>> msMethod_;
Definition: variables.hh:32
Detail::AssemblerVariables< Assembler > Variables
export the type of variables that represent a numerical solution
Definition: common/pdesolver.hh:82
typename ScalarT< X >::type Scalar
export the underlying scalar type
Definition: variables.hh:67
Abstract interface for one-step multi-stage method parameters in Shu/Osher form.
Definition: multistagemethods.hh:71
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:40
Scalar timeAtStage(std::size_t k) const
the time at which we have to evaluate the operators
Definition: multistagetimestepper.hh:77
Scalar spatialWeight(std::size_t k) const
weights of the spatial operator residual ( )
Definition: multistagetimestepper.hh:73
Scalar timeStepFraction(std::size_t k) const
the fraction of a time step corresponding to the k-th stage
Definition: multistagetimestepper.hh:81
Scalar skipTemporal(std::size_t k) const
If .
Definition: multistagetimestepper.hh:85
std::size_t size() const
Definition: multistagetimestepper.hh:65
Scalar skipSpatial(std::size_t k) const
If .
Definition: multistagetimestepper.hh:89
Scalar temporalWeight(std::size_t k) const
weights of the temporal operator residual ( )
Definition: multistagetimestepper.hh:69
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:47
Time stepping with a multi-stage method.
Definition: multistagetimestepper.hh:105
void setMethod(std::shared_ptr< const MultiStageMethod< Scalar > > msMethod)
Set/change the time step method.
Definition: multistagetimestepper.hh:156
void step(Variables &vars, const Scalar t, const Scalar dt)
Advance one time step of the given time loop.
Definition: multistagetimestepper.hh:132
MultiStageTimeStepper(std::shared_ptr< PDESolver > pdeSolver, std::shared_ptr< const MultiStageMethod< Scalar > > msMethod)
The constructor.
Definition: multistagetimestepper.hh:118