Cantera  3.1.0a1
PreconditionerBase Class Reference

PreconditionerBase serves as an abstract type to extend different preconditioners. More...

#include <PreconditionerBase.h>

Inheritance diagram for PreconditionerBase:
[legend]

Detailed Description

PreconditionerBase serves as an abstract type to extend different preconditioners.

Definition at line 30 of file PreconditionerBase.h.

Public Member Functions

virtual void setValue (size_t row, size_t col, double value)
 Set a value at the specified row and column of the jacobian triplet vector. More...
 
virtual void stateAdjustment (vector< double > &state)
 Adjust the state vector based on the preconditioner, e.g., Adaptive preconditioning uses a strictly positive composition when preconditioning which is handled by this function. More...
 
string preconditionerSide () const
 Get preconditioner application side for CVODES. More...
 
virtual void setPreconditionerSide (const string &preconSide)
 
virtual void solve (const size_t stateSize, double *rhs_vector, double *output)
 Solve a linear system Ax=b where A is the preconditioner. More...
 
virtual void setup ()
 Perform preconditioner specific post-reactor setup operations such as factorize. More...
 
virtual void reset ()
 Reset preconditioner parameters as needed. More...
 
virtual void initialize (size_t networkSize)
 Called during setup for any processes that need to be completed prior to setup functions used in sundials. More...
 
virtual void printPreconditioner ()
 Print preconditioner contents. More...
 
virtual void updatePreconditioner ()
 Transform Jacobian vector and write into preconditioner, P = (I - gamma * J) More...
 
virtual void setGamma (double gamma)
 Set gamma used in preconditioning. More...
 
virtual double gamma ()
 Get gamma used in preconditioning. More...
 
virtual void setAbsoluteTolerance (double atol)
 Set the absolute tolerance in the solver outside of the network initialization. More...
 

Protected Attributes

size_t m_dim
 Dimension of the preconditioner. More...
 
double m_gamma = 1.0
 gamma value used in M = I - gamma*J More...
 
bool m_init = false
 bool saying whether or not the preconditioner is initialized More...
 
double m_atol = 0
 Absolute tolerance of the ODE solver. More...
 
string m_precon_side = "none"
 

Member Function Documentation

◆ setValue()

virtual void setValue ( size_t  row,
size_t  col,
double  value 
)
inlinevirtual

Set a value at the specified row and column of the jacobian triplet vector.

Parameters
rowrow in the jacobian matrix
colcolumn in the jacobian matrix
valuevalue of the element at row and col

Reimplemented in AdaptivePreconditioner.

Definition at line 41 of file PreconditionerBase.h.

◆ stateAdjustment()

virtual void stateAdjustment ( vector< double > &  state)
inlinevirtual

Adjust the state vector based on the preconditioner, e.g., Adaptive preconditioning uses a strictly positive composition when preconditioning which is handled by this function.

Parameters
statea vector containing the state to be updated

Reimplemented in AdaptivePreconditioner.

Definition at line 49 of file PreconditionerBase.h.

◆ preconditionerSide()

string preconditionerSide ( ) const
inline

Get preconditioner application side for CVODES.

Definition at line 54 of file PreconditionerBase.h.

◆ solve()

virtual void solve ( const size_t  stateSize,
double *  rhs_vector,
double *  output 
)
inlinevirtual

Solve a linear system Ax=b where A is the preconditioner.

Parameters
[in]stateSizelength of the rhs and output vectors
[in]rhs_vectorright hand side vector used in linear system
[out]outputoutput vector for solution

Reimplemented in AdaptivePreconditioner.

Definition at line 66 of file PreconditionerBase.h.

◆ setup()

virtual void setup ( )
inlinevirtual

Perform preconditioner specific post-reactor setup operations such as factorize.

Reimplemented in AdaptivePreconditioner.

Definition at line 71 of file PreconditionerBase.h.

◆ reset()

virtual void reset ( )
inlinevirtual

Reset preconditioner parameters as needed.

Reimplemented in AdaptivePreconditioner.

Definition at line 76 of file PreconditionerBase.h.

◆ initialize()

virtual void initialize ( size_t  networkSize)
inlinevirtual

Called during setup for any processes that need to be completed prior to setup functions used in sundials.

Parameters
networkSizethe number of variables in the associated reactor network

Reimplemented in AdaptivePreconditioner.

Definition at line 83 of file PreconditionerBase.h.

◆ printPreconditioner()

virtual void printPreconditioner ( )
inlinevirtual

Print preconditioner contents.

Reimplemented in AdaptivePreconditioner.

Definition at line 88 of file PreconditionerBase.h.

◆ updatePreconditioner()

virtual void updatePreconditioner ( )
inlinevirtual

Transform Jacobian vector and write into preconditioner, P = (I - gamma * J)

Reimplemented in AdaptivePreconditioner.

Definition at line 94 of file PreconditionerBase.h.

◆ setGamma()

virtual void setGamma ( double  gamma)
inlinevirtual

Set gamma used in preconditioning.

Parameters
gammaused in M = I - gamma*J

Definition at line 100 of file PreconditionerBase.h.

◆ gamma()

virtual double gamma ( )
inlinevirtual

Get gamma used in preconditioning.

Definition at line 105 of file PreconditionerBase.h.

◆ setAbsoluteTolerance()

virtual void setAbsoluteTolerance ( double  atol)
inlinevirtual

Set the absolute tolerance in the solver outside of the network initialization.

Parameters
atolthe specified tolerance

Definition at line 111 of file PreconditionerBase.h.

Member Data Documentation

◆ m_dim

size_t m_dim
protected

Dimension of the preconditioner.

Definition at line 117 of file PreconditionerBase.h.

◆ m_gamma

double m_gamma = 1.0
protected

gamma value used in M = I - gamma*J

Definition at line 120 of file PreconditionerBase.h.

◆ m_init

bool m_init = false
protected

bool saying whether or not the preconditioner is initialized

Definition at line 123 of file PreconditionerBase.h.

◆ m_atol

double m_atol = 0
protected

Absolute tolerance of the ODE solver.

Definition at line 126 of file PreconditionerBase.h.


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