Page MenuHomec4science

BDF.h
No OneTemporary

File Metadata

Created
Wed, Aug 28, 06:21
#ifndef ODELIBRARY_BDF_H
#define ODELIBRARY_BDF_H
#include <iostream>
#include <Eigen/Dense>
#include <list>
#include <vector>
#include "MultistepAbstractSolver.h"
class BDF:public MultistepAbstractSolver{
private:
/**
* When applying an implicit multistep method to solve a linear ODE system, at each iteration the update on the
* y value is performed solving a suitable linear system. The matrix that defines this system is constant through-out the
* iterations, whereas the rhs vector of the linear system updateMatrix*yNext=rhsVector is computed at each iteration.
*/
Eigen::MatrixXd updateMatrix;
/**
* This method sets the coefficients defining the Adams Bashforth method.
*/
void setBCoeff();
/**
* This function defines the update which is performed at each step of Adams Moulton method.
* @param y : reference to the last computed value of y
* @param t : time corresponding to the last computed value of y. The function computes y at time t+stepSize.
*/
void step(Eigen::VectorXd &y, double t) override;
public:
BDF();
BDF(double t0,double tf,int n,int steps,Eigen::VectorXd& y0);
/**
* This method sets the number of steps defining the multistep Adams Bashforth algorithm.
* @param n : number of steps.
*/
void setStepsAlgo(int n);
/**
* This method overrides the setRightHandSide method of the abstract mother class. This operation is needed for implicit multistep
* methods, because the matrix employed at each iteration for the update of y, updateMatrix, has to be computed and stored
* as a variable of this class.
* @param rhsMatrix: Matrix defining the ODE linear system
* @param g_: function of t, part of the rhs expression.
*/
void setRightHandSide(Eigen::MatrixXd & rhsMatrix, Eigen::VectorXd (*g_)(double t)) override ;
void setRightHandSide(Eigen::MatrixXd & rhsMatrix, std::function<Eigen::VectorXd(double)> g_) override ;
};
#endif

Event Timeline