Cantera
Loading...
Searching...
No Matches
MultiJac.h
Go to the documentation of this file.
1//! @file MultiJac.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 CT_MULTIJAC_H
7#define CT_MULTIJAC_H
8
11
12namespace Cantera
13{
14
15/**
16 * Class MultiJac evaluates the Jacobian of a system of equations defined by a
17 * residual function supplied by an instance of class OneDim. The residual
18 * function may consist of several linked 1D domains, with different variables
19 * in each domain.
20 * @ingroup onedUtilsGroup
21 * @ingroup derivGroup
22 */
23class MultiJac : public SystemJacobian
24{
25public:
26 MultiJac() = default;
27 void reset() override;
28 const string type() const override { return "banded-direct"; }
29 void setValue(size_t row, size_t col, double value) override;
30 void initialize(size_t nVars) override;
31 void setBandwidth(size_t bw) override;
32 void updateTransient(double rdt, span<const int> mask) override;
33 void factorize() override {
34 m_mat.factor();
35 }
36
37 double& value(size_t i, size_t j) {
38 return m_mat.value(i, j);
39 }
40
41 double value(size_t i, size_t j) const {
42 return m_mat.value(i, j);
43 }
44
45 void solve(span<const double> b, span<double> x) override {
46 m_mat.solve(b, x);
47 }
48
49 int info() const override {
50 return m_mat.info();
51 }
52
53protected:
54 BandMatrix m_mat; //!< Underlying matrix storage
55 vector<double> m_ssdiag; //!< Diagonal of the steady-state Jacobian
56};
57
58}
59
60#endif
Declarations for the class BandMatrix which is a child class of GeneralMatrix for banded matrices han...
Declarations for class SystemJacobian.
A class for banded matrices, involving matrix inversion processes.
Definition BandMatrix.h:37
double & value(size_t i, size_t j)
Return a changeable reference to element (i,j).
BandMatrix m_mat
Underlying matrix storage.
Definition MultiJac.h:54
void updateTransient(double rdt, span< const int > mask) override
Update the diagonal terms in the Jacobian by using the transient mask .
Definition MultiJac.cpp:38
void setBandwidth(size_t bw) override
Used to provide system bandwidth for implementations that use banded matrix storage.
Definition MultiJac.cpp:25
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.
Definition MultiJac.cpp:30
void factorize() override
Factorize the system matrix.
Definition MultiJac.h:33
vector< double > m_ssdiag
Diagonal of the steady-state Jacobian.
Definition MultiJac.h:55
const string type() const override
Derived type, corresponding to names registered with SystemJacobianFactory.
Definition MultiJac.h:28
void solve(span< const double > b, span< double > x) override
Solve a linear system using the system matrix M.
Definition MultiJac.h:45
void reset() override
Reset parameters as needed.
Definition MultiJac.cpp:12
int info() const override
Get latest status of linear solver.
Definition MultiJac.h:49
void initialize(size_t nVars) override
Called during setup for any processes that need to be completed prior to setup functions used in sund...
Definition MultiJac.cpp:18
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595