Alsvinn  0.5.3
The fast FVM simulator with UQ support
Public Member Functions | Protected Member Functions | List of all members
alsfvm::integrator::Integrator Class Referenceabstract

#include <alsfvm/integrator/Integrator.hpp>

Inheritance diagram for alsfvm::integrator::Integrator:
alsfvm::integrator::ForwardEuler alsfvm::integrator::RungeKutta2 alsfvm::integrator::RungeKutta3 alsfvm::integrator::RungeKutta4

Public Member Functions

virtual ~Integrator ()
 
virtual size_t getNumberOfSubsteps () const =0
 
virtual real performSubstep (std::vector< alsfvm::shared_ptr< volume::Volume > > &inputConserved, rvec3 spatialCellSizes, real dt, real cfl, volume::Volume &output, size_t substep, const simulator::TimestepInformation &timestepInformation)=0
 
real computeTimestep (const rvec3 &waveSpeeds, const rvec3 &cellLengths, real cfl, const simulator::TimestepInformation &timestepInformation) const
 
void addTimestepAdjuster (alsfvm::shared_ptr< TimestepAdjuster > &adjuster)
 addTimestepAdjuster adds a timestep adjuster More...
 
void addWaveSpeedAdjuster (WaveSpeedAdjusterPtr adjuster)
 

Protected Member Functions

real adjustTimestep (real dt, const simulator::TimestepInformation &timestepInformation) const
 adjustTimestep adjusts the timesteps according to the timestepsadjusters More...
 

Detailed Description

Base interface for all integrators. An integrator will solve the system

\[u_t+Q(u)=0\]

where the function $Q$ is supplied (usually a numerical flux).

We assume the time integrator is divided into a number of subtimesteps, so that it can be run in the following manner

// PSEUDOCODE!!!
// For each substep we need one buffer to hold the output
buffers = makeBuffers(integrator.getNumberOfSubsteps());
setupInput(buffers[0]);
const size_t numberOfSubsteps = integrator.getNumberOfSubsteps();
while(t < tEnd) {
for(size_t subStep = 0; subStep < numberOfSubsteps; subStep++) {
integrator.performSubstep(buffers[subStep].conserved(),
buffers[(subStep+1) % numberOfSubsteps].conserved(), substep);
buffers[(subStep+1) % numberOfSubsteps].computeExtra();
}
t += dt;
}

Constructor & Destructor Documentation

◆ ~Integrator()

virtual alsfvm::integrator::Integrator::~Integrator ( )
inlinevirtual

Member Function Documentation

◆ addTimestepAdjuster()

void alsfvm::integrator::Integrator::addTimestepAdjuster ( alsfvm::shared_ptr< TimestepAdjuster > &  adjuster)

addTimestepAdjuster adds a timestep adjuster

Parameters
adjusterthe adjuster to add

◆ addWaveSpeedAdjuster()

void alsfvm::integrator::Integrator::addWaveSpeedAdjuster ( WaveSpeedAdjusterPtr  adjuster)

◆ adjustTimestep()

real alsfvm::integrator::Integrator::adjustTimestep ( real  dt,
const simulator::TimestepInformation timestepInformation 
) const
protected

adjustTimestep adjusts the timesteps according to the timestepsadjusters

Parameters
dtthe current timestep
timestepInformationthe current timestep information
Returns
the new timestep (or dt if unchanged)

◆ computeTimestep()

real alsfvm::integrator::Integrator::computeTimestep ( const rvec3 waveSpeeds,
const rvec3 cellLengths,
real  cfl,
const simulator::TimestepInformation timestepInformation 
) const

Computes the timestep (dt).

Parameters
[in]waveSpeedsthe wave speeds in each direction
[in]cellLengthsthe cell lengths in each direction
[in]cflthe CFL number
[in]timestepInformationthe timestep information.

◆ getNumberOfSubsteps()

virtual size_t alsfvm::integrator::Integrator::getNumberOfSubsteps ( ) const
pure virtual

Returns the number of substeps this integrator uses. For ForwardEuler this is 1, for RK4 this is 4, etc.

Implemented in alsfvm::integrator::RungeKutta2, alsfvm::integrator::ForwardEuler, alsfvm::integrator::RungeKutta3, and alsfvm::integrator::RungeKutta4.

◆ performSubstep()

virtual real alsfvm::integrator::Integrator::performSubstep ( std::vector< alsfvm::shared_ptr< volume::Volume > > &  inputConserved,
rvec3  spatialCellSizes,
real  dt,
real  cfl,
volume::Volume output,
size_t  substep,
const simulator::TimestepInformation timestepInformation 
)
pure virtual

Performs one substep and stores the result to output.

Parameters
inputConservedshould have the output from the previous invocations in this substep, if this is the first invocation, then this will have one element, second timestep 2 elements, etc.
spatialCellSizesshould be the cell size in each direction
dtis the timestep
substepis the currently computed substep, starting at 0.
outputwhere to write the output
cflthe cfl number to use.
timestepInformationthe current timestepInformation (needed for current time)
Note
the next invocation to performSubstep will get as input the previuosly calculated outputs
Returns
the newly computed timestep (each integrator may choose to change the timestep)

Implemented in alsfvm::integrator::RungeKutta2, alsfvm::integrator::ForwardEuler, alsfvm::integrator::RungeKutta3, and alsfvm::integrator::RungeKutta4.


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