10 #ifndef ADAPTIVEPRECONDITIONER_H
11 #define ADAPTIVEPRECONDITIONER_H
14 #include "cantera/numerics/eigen_sparse.h"
38 void setup()
override;
40 void solve(
const size_t stateSize,
double* rhs_vector,
double* output)
override;
42 void setValue(
size_t row,
size_t col,
double value)
override;
54 Eigen::SparseMatrix<double> jacobian_mat(
m_dim,
m_dim);
60 Eigen::SparseMatrix<double>
matrix() {
Declarations for the class PreconditionerBase which is a virtual base class for preconditioning syste...
AdaptivePreconditioner a preconditioner designed for use with large mechanisms that leverages sparse ...
double threshold()
Get the threshold value for setting elements.
Eigen::IncompleteLUT< double > m_solver
Solver used in solving the linear system.
double ilutDropTol()
Get ILUT drop tolerance.
Eigen::SparseMatrix< double > matrix()
Return the internal preconditioner matrix.
double m_fill_factor
ILUT fill factor.
void setIlutDropTol(double droptol)
Set drop tolerance for ILUT.
double m_drop_tol
ILUT drop tolerance.
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.
double m_prune_precon
Bool set whether to prune the matrix or not.
double m_threshold
Minimum value a non-diagonal element must be to be included in the preconditioner.
void initialize(size_t networkSize) override
Called during setup for any processes that need to be completed prior to setup functions used in sund...
vector< Eigen::Triplet< double > > m_jac_trips
Vector of triples representing the jacobian used in preconditioning.
void setIlutFillFactor(int fillFactor)
Set the fill factor for ILUT solver.
Eigen::SparseMatrix< double > m_identity
Storage of appropriately sized identity matrix for making the preconditioner.
void printPreconditioner() override
Print preconditioner contents.
void setup() override
Perform preconditioner specific post-reactor setup operations such as factorize.
void stateAdjustment(vector< double > &state) override
Adjust the state vector based on the preconditioner, e.g., Adaptive preconditioning uses a strictly p...
void updatePreconditioner() override
Transform Jacobian vector and write into preconditioner, P = (I - gamma * J)
void prunePreconditioner()
Prune preconditioner elements.
void printJacobian()
Print jacobian contents.
Eigen::SparseMatrix< double > m_precon_matrix
Container that is the sparse preconditioner.
void setThreshold(double threshold)
Set the threshold value to compare elements against.
void reset() override
Reset preconditioner parameters as needed.
double ilutFillFactor()
Get ILUT fill factor.
PreconditionerBase serves as an abstract type to extend different preconditioners.
size_t m_dim
Dimension of the preconditioner.
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Eigen::SparseMatrix< double > jacobian()
Return semi-analytical Jacobian of an AdaptivePreconditioner object.
Namespace for the Cantera kernel.