Loading [MathJax]/extensions/tex2jax.js
Cantera  3.2.0a1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EigenSparseJacobian.h
Go to the documentation of this file.
1//! @file EigenSparseJacobian.h
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at https://cantera.org/license.txt for license and copyright information.
5
6#ifndef EIGENSPARSEJACOBIAN_H
7#define EIGENSPARSEJACOBIAN_H
8
10#include "cantera/numerics/eigen_sparse.h"
11
12namespace Cantera
13{
14
15//! System Jacobians that use Eigen sparse matrices for storage
17{
18public:
19 EigenSparseJacobian() = default;
20 void initialize(size_t networkSize) override;
21 void reset() override;
22 void setValue(size_t row, size_t col, double value) override;
23 void updatePreconditioner() override;
24 void updateTransient(double rdt, int* mask) override;
25
26 //! Return underlying Jacobian matrix
27 //! @ingroup derivGroup
28 Eigen::SparseMatrix<double> jacobian();
29
30 //! Return the internal preconditioner matrix
31 Eigen::SparseMatrix<double> matrix() {
33 return m_matrix;
34 }
35
36 void printPreconditioner() override;
37
38 //! Print jacobian contents
39 void printJacobian();
40
41protected:
42 //! Vector of triples representing the jacobian used in preconditioning
43 vector<Eigen::Triplet<double>> m_jac_trips;
44
45 //! Storage of appropriately sized identity matrix for making the preconditioner
46 Eigen::SparseMatrix<double> m_identity;
47
48 //! Container that is the sparse preconditioner
49 Eigen::SparseMatrix<double> m_matrix;
50};
51
52}
53
54#endif
Declarations for class SystemJacobian.
System Jacobians that use Eigen sparse matrices for storage.
Eigen::SparseMatrix< double > matrix()
Return the internal preconditioner matrix.
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 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.
Eigen::SparseMatrix< double > m_identity
Storage of appropriately sized identity matrix for making the preconditioner.
void printPreconditioner() override
Print preconditioner contents.
void updatePreconditioner() override
Transform Jacobian vector and write into preconditioner, P = (I - gamma * J)
void updateTransient(double rdt, int *mask) override
Update the diagonal terms in the Jacobian by using the transient mask .
void printJacobian()
Print jacobian contents.
void reset() override
Reset parameters as needed.
Eigen::SparseMatrix< double > m_matrix
Container that is the sparse preconditioner.
Abstract base class representing Jacobian matrices and preconditioners used in nonlinear solvers.
Eigen::SparseMatrix< double > jacobian()
Return underlying Jacobian matrix.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595