AdaptivePreconditioner Class Reference#
AdaptivePreconditioner a preconditioner designed for use with large mechanisms that leverages sparse solvers. More...
#include <AdaptivePreconditioner.h>
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()
|
overridevirtual |
Called during setup for any processes that need to be completed prior to setup functions used in sundials.
- Parameters
-
networkSize the number of variables in the associated reactor network
Reimplemented from PreconditionerBase.
Definition at line 29 of file AdaptivePreconditioner.cpp.
◆ reset()
|
inlineoverridevirtual |
Reset preconditioner parameters as needed.
Reimplemented from PreconditionerBase.
Definition at line 33 of file AdaptivePreconditioner.h.
◆ setup()
|
overridevirtual |
Perform preconditioner specific post-reactor setup operations such as factorize.
Reimplemented from PreconditionerBase.
Definition at line 57 of file AdaptivePreconditioner.cpp.
◆ solve()
|
overridevirtual |
Solve a linear system Ax=b where A is the preconditioner.
- Parameters
-
[in] stateSize length of the rhs and output vectors [in] rhs_vector right hand side vector used in linear system [out] output output vector for solution
Reimplemented from PreconditionerBase.
Definition at line 96 of file AdaptivePreconditioner.cpp.
◆ setValue()
|
overridevirtual |
Set a value at the specified row and column of the jacobian triplet vector.
- Parameters
-
row row in the jacobian matrix col column in the jacobian matrix value value of the element at row and col
Reimplemented from PreconditionerBase.
Definition at line 17 of file AdaptivePreconditioner.cpp.
◆ stateAdjustment()
|
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
-
state a vector containing the state to be updated
Reimplemented from PreconditionerBase.
Definition at line 22 of file AdaptivePreconditioner.cpp.
◆ 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()
|
inline |
Return the internal preconditioner matrix.
Definition at line 60 of file AdaptivePreconditioner.h.
◆ threshold()
|
inline |
Get the threshold value for setting elements.
Definition at line 66 of file AdaptivePreconditioner.h.
◆ ilutFillFactor()
|
inline |
Get ILUT fill factor.
Definition at line 69 of file AdaptivePreconditioner.h.
◆ ilutDropTol()
|
inline |
Get ILUT drop tolerance.
Definition at line 72 of file AdaptivePreconditioner.h.
◆ setThreshold()
|
inline |
Set the threshold value to compare elements against.
- Parameters
-
threshold double value used in setting by threshold
Definition at line 76 of file AdaptivePreconditioner.h.
◆ setIlutDropTol()
|
inline |
Set drop tolerance for ILUT.
- Parameters
-
droptol double value used in setting solver drop tolerance
Definition at line 83 of file AdaptivePreconditioner.h.
◆ setIlutFillFactor()
|
inline |
Set the fill factor for ILUT solver.
- Parameters
-
fillFactor fill in factor for ILUT solver
Definition at line 90 of file AdaptivePreconditioner.h.
◆ 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
|
protected |
ILUT fill factor.
Definition at line 103 of file AdaptivePreconditioner.h.
◆ m_drop_tol
|
protected |
ILUT drop tolerance.
Definition at line 106 of file AdaptivePreconditioner.h.
◆ m_jac_trips
|
protected |
Vector of triples representing the jacobian used in preconditioning.
Definition at line 109 of file AdaptivePreconditioner.h.
◆ m_identity
|
protected |
Storage of appropriately sized identity matrix for making the preconditioner.
Definition at line 112 of file AdaptivePreconditioner.h.
◆ m_precon_matrix
|
protected |
Container that is the sparse preconditioner.
Definition at line 115 of file AdaptivePreconditioner.h.
◆ m_solver
|
protected |
Solver used in solving the linear system.
Definition at line 118 of file AdaptivePreconditioner.h.
◆ m_threshold
|
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
|
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:
Generated by 1.9.7