DUNE PDELab (git)

Dune::PDELab::InstationaryLocalOperatorDefaultMethods< R > Class Template Reference

Default class for additional methods in instationary local operators. More...

#include <dune/pdelab/localoperator/idefault.hh>

Public Member Functions

void setTime (R t_)
 set time for subsequent evaluation More...
 
getTime () const
 get current time More...
 
void preStep (RealType time, RealType dt, int stages)
 to be called once before each time step More...
 
void postStep ()
 to be called once at the end of each time step More...
 
void preStage (RealType time, int r)
 to be called once before each stage More...
 
int getStage () const
 get current stage More...
 
void postStage ()
 to be called once at the end of each stage
 
RealType suggestTimestep (RealType dt) const
 to be called after stage 1 More...
 

Detailed Description

template<class R = double>
class Dune::PDELab::InstationaryLocalOperatorDefaultMethods< R >

Default class for additional methods in instationary local operators.

The algorithm used by the InstationaryGridOperator and the OneStepMethod to advance one step in time is as follows:

  1. Call the method preStep(start_time_of_step, step_size, nstages) on each localoperator.
  2. For each stage1 in [1, nstages]
    1. Call preStage(time_of_stage1, number_of_stage1) on each localoperator.
    2. Assemble constant part of residual: For each stage2 in [0, number_of_stage1-1]
      1. Call setTime(time_of_stage2) for each local operator.
      2. Iterate over grid and evaluate the local operator.
    3. Call setTime(time_of_stage1) for each local operator.
    4. Apply solver: Iterate over grid (possibly multiple times and evaluate local operator.
    5. Call postStage() on each local operator.
  3. Call postStep() on the temporal local operator.

The algorithm used by the InstationaryGridOperator and the ExplicitOneStepMethod to advance one step in time is as follows:

  1. Call the method preStep(start_time_of_step, step_size, nstages) on each localoperator.
  2. For each stage1 in [1, nstages]
    1. Call preStage(time_of_stage1, number_of_stage1) on each localoperator.
    2. Assemble constant part of residual: For each stage2 in [0, number_of_stage1-1]
      1. Call setTime(time_of_stage2) for each local operator.
      2. Iterate over grid and evaluate the local operator.
    3. Call setTime(time_of_stage1) for each local operator.
    4. Assemble matrices to be solved: Iterate over the grid and evaluate the local operator.
    5. If stage1 == 1:
      1. Possibly call suggestTimeStep() and adjust the time step accordingly.
    6. Call postStage() on each local operator.
  3. Call postStep() on the temporal local operator.

The algorithm used by the MultiStepGridOperator and the MultiStepMethod to advance one step in time is as follows:

  1. Call the method preStep(start_time_of_step, step_size, 1) on each localoperator.
  2. Call the method preStage(end_time_of_step, 1) on each local operator.
  3. Assemble constant part of residual: For each step in [1, number_of_steps]
    1. Call setTime(end_time_of_step-step_size*number_of_step) for each local operator.
    2. Iterate over grid and evaluate the local operators.
  4. Call setTime(end_time_of_step) for each local operator.
  5. Apply solver: Iterate over grid (possibly multiple times and evaluate local operator.
  6. Call postStage() on each local operator.
  7. Call postStep() on each local operator.
Examples
recipe-operator-splitting.cc.

Member Function Documentation

◆ getStage()

template<class R = double>
int Dune::PDELab::InstationaryLocalOperatorDefaultMethods< R >::getStage ( ) const
inline

get current stage

Returns
The current stage number previously set by preStage().

◆ getTime()

template<class R = double>
R Dune::PDELab::InstationaryLocalOperatorDefaultMethods< R >::getTime ( ) const
inline

get current time

Returns
The time previously set by setTime().

◆ postStep()

template<class R = double>
void Dune::PDELab::InstationaryLocalOperatorDefaultMethods< R >::postStep ( )
inline

to be called once at the end of each time step

Note
With the OneStepMethod and the ExplicitOneStepMetod, for reasons unknown this is only called for temporal but not for spatial local operators. With the MultiStepMethod this is called for all local operators.

◆ preStage()

template<class R = double>
void Dune::PDELab::InstationaryLocalOperatorDefaultMethods< R >::preStage ( RealType  time,
int  r 
)
inline

to be called once before each stage

Parameters
timeTime of the stage
rNumber of the stage, r ∈ [1, nstages] inclusive, where nstages is the number of stage in the step given in the previous call to preStep()
Note
For ExplicitOneStepMethod the time given here for stage 1 may be incorrect, since the time step size is only finally determined after the first stage has been assembled.
For the MultiStepMethod, this is called once after preStep() with r=1.

◆ preStep()

template<class R = double>
void Dune::PDELab::InstationaryLocalOperatorDefaultMethods< R >::preStep ( RealType  time,
RealType  dt,
int  stages 
)
inline

to be called once before each time step

Parameters
timeTime at beginning of the step.
dtSize of time step.
stagesNumber of stages to do in the step. For the MultiStepMethod this is always 1.
Note
For ExplicitOneStepMethod the dt given here may be incorrect, since the time step size is only finally determined after the first stage has been assembled.
For the MultiStepMethod the number of stages is given as
  1. Since there are no times of evaluation in the middle of the step, a multi-step method is similar to a one step method with one stage.

◆ setTime()

template<class R = double>
void Dune::PDELab::InstationaryLocalOperatorDefaultMethods< R >::setTime ( t_)
inline

set time for subsequent evaluation

This method set the time for subsequent calls to the alpha_*(), lambda_*(), jacobian_*() and jacobian_apply_*() methods.

Note
For ExplicitOneStepMethod the time given here in the first stage may be incorrect, since the time step size is only finally determined after the first stage has been assembled.

Referenced by Dune::PDELab::ConvectionDiffusionDG< T, FiniteElementMap >::setTime().

◆ suggestTimestep()

template<class R = double>
RealType Dune::PDELab::InstationaryLocalOperatorDefaultMethods< R >::suggestTimestep ( RealType  dt) const
inline

to be called after stage 1

Note
Only used by the ExplicitOneStepMethod.

This may be called on the spatial local operator in the case of an explicit one step scheme. It is called after stage 1 has been assembled (so the time given to preStep() may not apply anymore in this case). All the alpha_*() and lambda_*() methods should have been called, so they are a good place to generate the information returned here.


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 3, 22:32, 2024)