Chaste Commit::f2ff7ee04e70ac9d06c57344df8d017dbb12b97b
CardiacNewtonSolver< SIZE, CELLTYPE > Class Template Reference

#include <CardiacNewtonSolver.hpp>

+ Collaboration diagram for CardiacNewtonSolver< SIZE, CELLTYPE >:

Public Member Functions

void Solve (CELLTYPE &rCell, double time, double rCurrentGuess[SIZE])
 

Static Public Member Functions

static CardiacNewtonSolver< SIZE, CELLTYPE > * Instance ()
 

Protected Member Functions

 CardiacNewtonSolver ()
 
 CardiacNewtonSolver (const CardiacNewtonSolver< SIZE, CELLTYPE > &)
 
CardiacNewtonSolver< SIZE, CELLTYPE > & operator= (const CardiacNewtonSolver< SIZE, CELLTYPE > &)
 
void SolveLinearSystem ()
 

Private Attributes

c_vector< double, SIZE > mResidual
 
double mJacobian [SIZE][SIZE]
 
c_vector< double, SIZE > mUpdate
 

Detailed Description

template<unsigned SIZE, typename CELLTYPE>
class CardiacNewtonSolver< SIZE, CELLTYPE >

Specialised Newton solver for solving the nonlinear systems arising when simulating a cardiac cell using Backward Euler.

The class is templated by the size of the nonlinear system, and uses the singleton pattern to ensure only 1 solver for any given system size is created. This allows us to be both computationally and memory efficient.

It would be nice to have a test of this class directly, but you need a cardiac cell in order to test it. So all tests occur when testing particular cardiac cells, e.g. the LuoRudy1991BackwardEuler.

Definition at line 57 of file CardiacNewtonSolver.hpp.

Constructor & Destructor Documentation

◆ CardiacNewtonSolver() [1/2]

template<unsigned SIZE, typename CELLTYPE >
CardiacNewtonSolver< SIZE, CELLTYPE >::CardiacNewtonSolver ( )
inlineprotected

Singleton pattern - protected default constructor.

Definition at line 162 of file CardiacNewtonSolver.hpp.

◆ CardiacNewtonSolver() [2/2]

template<unsigned SIZE, typename CELLTYPE >
CardiacNewtonSolver< SIZE, CELLTYPE >::CardiacNewtonSolver ( const CardiacNewtonSolver< SIZE, CELLTYPE > &  )
protected

Singleton pattern - protected copy constructor. Not implemented.

Member Function Documentation

◆ Instance()

template<unsigned SIZE, typename CELLTYPE >
static CardiacNewtonSolver< SIZE, CELLTYPE > * CardiacNewtonSolver< SIZE, CELLTYPE >::Instance ( )
inlinestatic

Call this method to obtain a solver instance.

Returns
a single instance of the class

Definition at line 65 of file CardiacNewtonSolver.hpp.

◆ operator=()

template<unsigned SIZE, typename CELLTYPE >
CardiacNewtonSolver< SIZE, CELLTYPE > & CardiacNewtonSolver< SIZE, CELLTYPE >::operator= ( const CardiacNewtonSolver< SIZE, CELLTYPE > &  )
protected

Singleton pattern - protected assignment operator. Not implemented.

Returns
(would be reference)

◆ Solve()

template<unsigned SIZE, typename CELLTYPE >
void CardiacNewtonSolver< SIZE, CELLTYPE >::Solve ( CELLTYPE &  rCell,
double  time,
double  rCurrentGuess[SIZE] 
)
inline

Use Newton's method to solve the given cell for the next timestep.

Parameters
rCellthe cell to solve
timethe current time
rCurrentGuessthe current guess at a solution. Will be updated on exit.

Definition at line 78 of file CardiacNewtonSolver.hpp.

References EXCEPTION, CardiacNewtonSolver< SIZE, CELLTYPE >::mJacobian, CardiacNewtonSolver< SIZE, CELLTYPE >::mResidual, CardiacNewtonSolver< SIZE, CELLTYPE >::mUpdate, and CardiacNewtonSolver< SIZE, CELLTYPE >::SolveLinearSystem().

◆ SolveLinearSystem()

template<unsigned SIZE, typename CELLTYPE >
void CardiacNewtonSolver< SIZE, CELLTYPE >::SolveLinearSystem ( )
inlineprotected

Solve a linear system to calculate the Newton update step

This is solving Jacbian . update = residual for update given values of the Jacobian matrix and residual

The implementation does Gaussian elimination with no pivotting and no underflow checking

Definition at line 178 of file CardiacNewtonSolver.hpp.

References CardiacNewtonSolver< SIZE, CELLTYPE >::mJacobian, CardiacNewtonSolver< SIZE, CELLTYPE >::mResidual, and CardiacNewtonSolver< SIZE, CELLTYPE >::mUpdate.

Referenced by CardiacNewtonSolver< SIZE, CELLTYPE >::Solve().

Member Data Documentation

◆ mJacobian

template<unsigned SIZE, typename CELLTYPE >
double CardiacNewtonSolver< SIZE, CELLTYPE >::mJacobian[SIZE][SIZE]
private

◆ mResidual

template<unsigned SIZE, typename CELLTYPE >
c_vector<double, SIZE> CardiacNewtonSolver< SIZE, CELLTYPE >::mResidual
private

◆ mUpdate

template<unsigned SIZE, typename CELLTYPE >
c_vector<double, SIZE> CardiacNewtonSolver< SIZE, CELLTYPE >::mUpdate
private

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