Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
bdf.h File Reference
#include <core/parameters.h>
#include <deal.II/lac/vector.h>
#include <vector>
Include dependency graph for bdf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

Vector< double > calculate_bdf_coefficients (Parameters::SimulationControl::TimeSteppingMethod method, const std::vector< double > &time_steps)
Vector< double > delta (unsigned int order, unsigned int n, unsigned int j, const Vector< double > &times)
unsigned int maximum_number_of_previous_solutions ()
unsigned int number_of_previous_solutions (const Parameters::SimulationControl::TimeSteppingMethod method)
template<typename DataType>
void bdf_extrapolate (const std::vector< double > &time_vector, const std::vector< std::vector< DataType > > &solution_vector, const unsigned int number_of_previous_solutions, std::vector< DataType > &extrapolated_solution)

Function Documentation

◆ bdf_extrapolate()

template<typename DataType>
void bdf_extrapolate ( const std::vector< double > & time_vector,
const std::vector< std::vector< DataType > > & solution_vector,
const unsigned int number_of_previous_solutions,
std::vector< DataType > & extrapolated_solution )

Extrapolate vector of solution to time_vector[0] using previous solution times and previous solutions.

Template Parameters
DataTypeType of the variable being extrapolated (e.g. double, Tensor<1,dim>)
Parameters
[in]time_vectorVector of times. The solution will be extrapolated to time 0. It should be of size number_of_previous_solutions+1.
[in]solution_vectorVector of solution. The solution will be extrapolated to index 0. It should be at least of size number_of_previous_solutions.
[in]number_of_previous_solutionsNumber of previous solutions used to extrapolate.
[out]extrapolated_solutionVector of extrapolated solution.

Definition at line 133 of file bdf.h.

References number_of_previous_solutions().

◆ calculate_bdf_coefficients()

Vector< double > calculate_bdf_coefficients ( Parameters::SimulationControl::TimeSteppingMethod method,
const std::vector< double > & time_steps )

Calculate the coefficients required for backward differentiation formula (BDF) integration of order \(n\).

The coefficients are determined through a recursion algorithm. The algorithm is taken from: Hay, Alexander, et al. "hp-Adaptive time integration based on the BDF for viscous flows." Journal of Computational Physics 291 (2015): 151-176.

Parameters
[in]methodTime stepping method.
[in]time_stepsVector containing all the time steps. The time steps should be in decreasing order.

For example, if the method is a BDF2 ( \(n=2\)), it uses three values for the time: \(t\), \(t-\Delta t_1\) and \(t-\Delta t_2\). Thus, the time_steps vector should contain \(\Delta t_1\) and \(\Delta t_2\).

Returns
Vector containing BDF integration coefficient values.
Note
At the moment, the highest implemented scheme is bdf3 (order=3).

Definition at line 42 of file bdf.cc.

References Parameters::SimulationControl::bdf1, Parameters::SimulationControl::bdf2, Parameters::SimulationControl::bdf3, bdf_coefficients(), and Parameters::SimulationControl::steady_bdf.

◆ delta()

Vector< double > delta ( unsigned int order,
unsigned int n,
unsigned int j,
const Vector< double > & times )

Recursive function for calculating the \(j^{th}\) order divided differences ( \(\delta^j\)) that is used for calculating backward differentiation formula (BDF) coefficients.

The algorithm is taken from: Hay, Alexander, et al. "hp-Adaptive time integration based on the BDF for viscous flows." Journal of Computational Physics 291 (2015): 151-176.

Parameters
[in]orderOrder of the BDF method.
[in]nInteger required for the recursive function calculation.
[in]jOrder of the divided difference of the value of interest.
[in]timesVector of times values corresponding to the various iteration in decreasing order.

For example, if the method is a BDF2 ( \(n=2\)), three values of the time must be in the array: \(t\), \(t-\Delta t_1\) and \(t-\Delta t_2\).

Returns
Vector of \(n\) divided differences ( \(\delta^j\)) used in the calculation of BDF coefficients.

Definition at line 63 of file bdf.cc.

References delta().

◆ maximum_number_of_previous_solutions()

unsigned int maximum_number_of_previous_solutions ( )
inline

Get the maximum number of previous time steps supposed by the BDF schemes implemented in Lethe.

Returns
Value of the maximum number of previous time steps used in BDF schemes implemented in Lethe.
Note
At the moment, this is hardcoded to 3, but eventually this could be made larger or smaller depending on the methods used.

Definition at line 84 of file bdf.h.

◆ number_of_previous_solutions()

unsigned int number_of_previous_solutions ( const Parameters::SimulationControl::TimeSteppingMethod method)
inline

Get the number of previous time steps for a specific BDF scheme.

Parameters
[in]methodTime stepping method of the simulation.
Returns
Number of previous time steps used in a given BDF scheme.

Definition at line 97 of file bdf.h.

References Parameters::SimulationControl::bdf1, Parameters::SimulationControl::bdf2, Parameters::SimulationControl::bdf3, and Parameters::SimulationControl::steady_bdf.