#include <OdeLinearSystemSolver.hpp>
Public Member Functions | |
OdeLinearSystemSolver (unsigned systemSize, double timeStep) | |
~OdeLinearSystemSolver () | |
double | GetTimeStep () |
Mat & | rGetLhsMatrix () |
Vec & | rGetForceVector () |
void | SetInitialConditionVector (Vec initialConditionsVector) |
Vec | SolveOneTimeStep () |
Private Attributes | |
double | mTimeStep |
LinearSystem | mLinearSystem |
Vec | mForceVector |
Vec | mCurrentSolution |
M dr/dt = f(t,r),
where M is a matrix, typically large and sparse, and r and f are vectors.
This differs from the OdeSolver classes in the ode component, which are for systems of the form dr/dt = f(t,r) and for small numbers of unknowns.
The solver uses forward euler to dicretise as M r^{n+1} = M r^{n} + dt f and solves this linear system.
The calling code is responsible with setting up M and f each timestep.
Definition at line 48 of file OdeLinearSystemSolver.hpp.
OdeLinearSystemSolver::OdeLinearSystemSolver | ( | unsigned | systemSize, | |
double | timeStep | |||
) |
Constructor.
systemSize | size of the ODE system | |
timeStep | the time step used to integrate the ODE system |
Definition at line 33 of file OdeLinearSystemSolver.cpp.
References PetscTools::CreateAndSetVec(), mCurrentSolution, mForceVector, and mTimeStep.
OdeLinearSystemSolver::~OdeLinearSystemSolver | ( | ) |
Destructor.
Definition at line 44 of file OdeLinearSystemSolver.cpp.
References mCurrentSolution, and mForceVector.
double OdeLinearSystemSolver::GetTimeStep | ( | ) |
Get the timestep for the solver.
Definition at line 50 of file OdeLinearSystemSolver.cpp.
References mTimeStep.
Mat & OdeLinearSystemSolver::rGetLhsMatrix | ( | ) |
Get the matrix.
Definition at line 55 of file OdeLinearSystemSolver.cpp.
References mLinearSystem, and LinearSystem::rGetLhsMatrix().
Vec & OdeLinearSystemSolver::rGetForceVector | ( | ) |
Get the force vector.
Definition at line 60 of file OdeLinearSystemSolver.cpp.
References mForceVector.
void OdeLinearSystemSolver::SetInitialConditionVector | ( | Vec | initialConditionsVector | ) |
Set the initial conditions.
initialConditionsVector | the initial condition |
Definition at line 65 of file OdeLinearSystemSolver.cpp.
References mCurrentSolution.
Vec OdeLinearSystemSolver::SolveOneTimeStep | ( | ) |
Solve the ODE system over one time step.
Definition at line 70 of file OdeLinearSystemSolver.cpp.
References PetscVecTools::AddScaledVector(), mCurrentSolution, mForceVector, mLinearSystem, mTimeStep, LinearSystem::rGetLhsMatrix(), LinearSystem::rGetRhsVector(), and LinearSystem::Solve().
double OdeLinearSystemSolver::mTimeStep [private] |
Timestep for solver.
Definition at line 53 of file OdeLinearSystemSolver.hpp.
Referenced by GetTimeStep(), OdeLinearSystemSolver(), and SolveOneTimeStep().
The LHS matrix and the force vector. Solve() is called on this.
Definition at line 56 of file OdeLinearSystemSolver.hpp.
Referenced by rGetLhsMatrix(), and SolveOneTimeStep().
Vec OdeLinearSystemSolver::mForceVector [private] |
Force vector (f in M dr/dt = f).
Definition at line 59 of file OdeLinearSystemSolver.hpp.
Referenced by OdeLinearSystemSolver(), rGetForceVector(), SolveOneTimeStep(), and ~OdeLinearSystemSolver().
Vec OdeLinearSystemSolver::mCurrentSolution [private] |
Solution at current timestep.
Definition at line 62 of file OdeLinearSystemSolver.hpp.
Referenced by OdeLinearSystemSolver(), SetInitialConditionVector(), SolveOneTimeStep(), and ~OdeLinearSystemSolver().