Cantera  3.1.0a1
Loading...
Searching...
No Matches
AdaptivePreconditioner Class Reference

AdaptivePreconditioner a preconditioner designed for use with large mechanisms that leverages sparse solvers. More...

#include <AdaptivePreconditioner.h>

Inheritance diagram for AdaptivePreconditioner:
[legend]

Detailed Description

AdaptivePreconditioner a preconditioner designed for use with large mechanisms that leverages sparse solvers.

It does this by pruning the preconditioner by a threshold value. It also neglects pressure dependence and third body contributions in its formation and has a finite difference approximation for temperature.

Definition at line 26 of file AdaptivePreconditioner.h.

Public Member Functions

void initialize (size_t networkSize) override
 Called during setup for any processes that need to be completed prior to setup functions used in sundials.
 
void reset () override
 Reset preconditioner parameters as needed.
 
void setup () override
 Perform preconditioner specific post-reactor setup operations such as factorize.
 
void solve (const size_t stateSize, double *rhs_vector, double *output) override
 Solve a linear system Ax=b where A is the preconditioner.
 
void setValue (size_t row, size_t col, double value) override
 Set a value at the specified row and column of the jacobian triplet vector.
 
void stateAdjustment (vector< double > &state) override
 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.
 
void updatePreconditioner () override
 Transform Jacobian vector and write into preconditioner, P = (I - gamma * J)
 
void prunePreconditioner ()
 Prune preconditioner elements.
 
Eigen::SparseMatrix< double > jacobian ()
 Return semi-analytical Jacobian of an AdaptivePreconditioner object.
 
Eigen::SparseMatrix< double > matrix ()
 Return the internal preconditioner matrix.
 
double threshold ()
 Get the threshold value for setting elements.
 
double ilutFillFactor ()
 Get ILUT fill factor.
 
double ilutDropTol ()
 Get ILUT drop tolerance.
 
void setThreshold (double threshold)
 Set the threshold value to compare elements against.
 
void setIlutDropTol (double droptol)
 Set drop tolerance for ILUT.
 
void setIlutFillFactor (int fillFactor)
 Set the fill factor for ILUT solver.
 
void printPreconditioner () override
 Print preconditioner contents.
 
void printJacobian ()
 Print jacobian contents.
 
- Public Member Functions inherited from PreconditionerBase
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.
 
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.
 
string preconditionerSide () const
 Get preconditioner application side for CVODES.
 
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.
 
virtual void setup ()
 Perform preconditioner specific post-reactor setup operations such as factorize.
 
virtual void reset ()
 Reset preconditioner parameters as needed.
 
virtual void initialize (size_t networkSize)
 Called during setup for any processes that need to be completed prior to setup functions used in sundials.
 
virtual void printPreconditioner ()
 Print preconditioner contents.
 
virtual void updatePreconditioner ()
 Transform Jacobian vector and write into preconditioner, P = (I - gamma * J)
 
virtual void setGamma (double gamma)
 Set gamma used in preconditioning.
 
virtual double gamma ()
 Get gamma used in preconditioning.
 
virtual void setAbsoluteTolerance (double atol)
 Set the absolute tolerance in the solver outside of the network initialization.
 

Protected Attributes

double m_fill_factor = 0
 ILUT fill factor.
 
double m_drop_tol = 0
 ILUT drop tolerance.
 
vector< Eigen::Triplet< double > > m_jac_trips
 Vector of triples representing the jacobian used in preconditioning.
 
Eigen::SparseMatrix< double > m_identity
 Storage of appropriately sized identity matrix for making the preconditioner.
 
Eigen::SparseMatrix< double > m_precon_matrix
 Container that is the sparse preconditioner.
 
Eigen::IncompleteLUT< double > m_solver
 Solver used in solving the linear system.
 
double m_threshold = 0.0
 Minimum value a non-diagonal element must be to be included in the preconditioner.
 
double m_prune_precon = true
 Bool set whether to prune the matrix or not.
 
- Protected Attributes inherited from PreconditionerBase
size_t m_dim
 Dimension of the preconditioner.
 
double m_gamma = 1.0
 gamma value used in M = I - gamma*J
 
bool m_init = false
 bool saying whether or not the preconditioner is initialized
 
double m_atol = 0
 Absolute tolerance of the ODE solver.
 
string m_precon_side = "none"
 

Constructor & Destructor Documentation

◆ AdaptivePreconditioner()

Definition at line 12 of file AdaptivePreconditioner.cpp.

Member Function Documentation

◆ initialize()

void initialize ( size_t  networkSize)
overridevirtual

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 from PreconditionerBase.

Definition at line 29 of file AdaptivePreconditioner.cpp.

◆ reset()

void reset ( )
inlineoverridevirtual

Reset preconditioner parameters as needed.

Reimplemented from PreconditionerBase.

Definition at line 33 of file AdaptivePreconditioner.h.

◆ setup()

void setup ( )
overridevirtual

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

Reimplemented from PreconditionerBase.

Definition at line 57 of file AdaptivePreconditioner.cpp.

◆ solve()

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

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 from PreconditionerBase.

Definition at line 96 of file AdaptivePreconditioner.cpp.

◆ setValue()

void setValue ( size_t  row,
size_t  col,
double  value 
)
overridevirtual

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 from PreconditionerBase.

Definition at line 17 of file AdaptivePreconditioner.cpp.

◆ stateAdjustment()

void stateAdjustment ( vector< double > &  state)
overridevirtual

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 from PreconditionerBase.

Definition at line 22 of file AdaptivePreconditioner.cpp.

◆ updatePreconditioner()

void updatePreconditioner ( )
overridevirtual

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

Reimplemented from PreconditionerBase.

Definition at line 72 of file AdaptivePreconditioner.cpp.

◆ prunePreconditioner()

void prunePreconditioner ( )

Prune preconditioner elements.

Definition at line 84 of file AdaptivePreconditioner.cpp.

◆ matrix()

Eigen::SparseMatrix< double > matrix ( )
inline

Return the internal preconditioner matrix.

Definition at line 60 of file AdaptivePreconditioner.h.

◆ threshold()

double threshold ( )
inline

Get the threshold value for setting elements.

Definition at line 66 of file AdaptivePreconditioner.h.

◆ ilutFillFactor()

double ilutFillFactor ( )
inline

Get ILUT fill factor.

Definition at line 69 of file AdaptivePreconditioner.h.

◆ ilutDropTol()

double ilutDropTol ( )
inline

Get ILUT drop tolerance.

Definition at line 72 of file AdaptivePreconditioner.h.

◆ setThreshold()

void setThreshold ( double  threshold)
inline

Set the threshold value to compare elements against.

Parameters
thresholddouble value used in setting by threshold

Definition at line 76 of file AdaptivePreconditioner.h.

◆ setIlutDropTol()

void setIlutDropTol ( double  droptol)
inline

Set drop tolerance for ILUT.

Parameters
droptoldouble value used in setting solver drop tolerance

Definition at line 83 of file AdaptivePreconditioner.h.

◆ setIlutFillFactor()

void setIlutFillFactor ( int  fillFactor)
inline

Set the fill factor for ILUT solver.

Parameters
fillFactorfill in factor for ILUT solver

Definition at line 90 of file AdaptivePreconditioner.h.

◆ printPreconditioner()

void printPreconditioner ( )
overridevirtual

Print preconditioner contents.

Reimplemented from PreconditionerBase.

Definition at line 110 of file AdaptivePreconditioner.cpp.

◆ printJacobian()

void printJacobian ( )

Print jacobian contents.

Definition at line 117 of file AdaptivePreconditioner.cpp.

Member Data Documentation

◆ m_fill_factor

double m_fill_factor = 0
protected

ILUT fill factor.

Definition at line 103 of file AdaptivePreconditioner.h.

◆ m_drop_tol

double m_drop_tol = 0
protected

ILUT drop tolerance.

Definition at line 106 of file AdaptivePreconditioner.h.

◆ m_jac_trips

vector<Eigen::Triplet<double> > m_jac_trips
protected

Vector of triples representing the jacobian used in preconditioning.

Definition at line 109 of file AdaptivePreconditioner.h.

◆ m_identity

Eigen::SparseMatrix<double> m_identity
protected

Storage of appropriately sized identity matrix for making the preconditioner.

Definition at line 112 of file AdaptivePreconditioner.h.

◆ m_precon_matrix

Eigen::SparseMatrix<double> m_precon_matrix
protected

Container that is the sparse preconditioner.

Definition at line 115 of file AdaptivePreconditioner.h.

◆ m_solver

Eigen::IncompleteLUT<double> m_solver
protected

Solver used in solving the linear system.

Definition at line 118 of file AdaptivePreconditioner.h.

◆ m_threshold

double m_threshold = 0.0
protected

Minimum value a non-diagonal element must be to be included in the preconditioner.

Definition at line 122 of file AdaptivePreconditioner.h.

◆ m_prune_precon

double m_prune_precon = true
protected

Bool set whether to prune the matrix or not.

Definition at line 125 of file AdaptivePreconditioner.h.


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