| Cantera 3.0.0

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
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.
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
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

## ◆ PreconditionerBase()

PreconditionerBase | ( |  | ) |
| inline

Definition at line 33 of file PreconditionerBase.h.

## ◆ ~PreconditionerBase()

virtual ~PreconditionerBase | ( |  | ) |
| inline virtual

Definition at line 35 of file PreconditionerBase.h.

## Member Function Documentation

## ◆ setValue()

virtual void setValue | ( | size_t | row,
|  | size_t | col,
|  | double | value
| ) |  |
| inline virtual

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 in AdaptivePreconditioner.

Definition at line 41 of file PreconditionerBase.h.

## ◆ stateAdjustment()

virtual void stateAdjustment | ( | vector< double > & | state | ) |
| inline virtual

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

## ◆ setPreconditionerSide()

virtual void setPreconditionerSide | ( | const string & | preconSide | ) |
| inline virtual

Definition at line 58 of file PreconditionerBase.h.

## ◆ solve()

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

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 in AdaptivePreconditioner.

Definition at line 66 of file PreconditionerBase.h.

## ◆ setup()

virtual void setup | ( |  | ) |
| inline virtual

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 | ( |  | ) |
| inline virtual

Reset preconditioner parameters as needed.

Reimplemented in AdaptivePreconditioner.

Definition at line 76 of file PreconditionerBase.h.

## ◆ initialize()

virtual void initialize | ( | size_t | networkSize | ) |
| inline virtual

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 in AdaptivePreconditioner.

Definition at line 83 of file PreconditionerBase.h.

## ◆ printPreconditioner()

virtual void printPreconditioner | ( |  | ) |
| inline virtual

Print preconditioner contents.

Reimplemented in AdaptivePreconditioner.

Definition at line 88 of file PreconditionerBase.h.

## ◆ updatePreconditioner()

virtual void updatePreconditioner | ( |  | ) |
| inline virtual

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 | ) |
| inline virtual

Set gamma used in preconditioning.

Parameters

  gamma | used in M = I - gamma*J

Definition at line 100 of file PreconditionerBase.h.

## ◆ gamma()

virtual double gamma | ( |  | ) |
| inline virtual

Get gamma used in preconditioning.

Definition at line 105 of file PreconditionerBase.h.

## ◆ setAbsoluteTolerance()

virtual void setAbsoluteTolerance | ( | double | atol | ) |
| inline virtual

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

Parameters

  atol | the 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.

## ◆ m_precon_side

string m_precon_side = "none"
| protected

Definition at line 128 of file PreconditionerBase.h.

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

- PreconditionerBase.h