Cantera  3.3.0a1
Loading...
Searching...
No Matches
MultiJac.cpp
Go to the documentation of this file.
1//! @file MultiJac.cpp Implementation file for class MultiJac
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
7#include <ctime>
8
9namespace Cantera
10{
11
13{
14 m_mat.bfill(0.0);
15 m_age = 10000;
16}
17
18void MultiJac::initialize(size_t nVars)
19{
20 m_dim = nVars;
22 m_ssdiag.resize(m_dim);
23}
24
26{
27 m_mat.resize(m_dim, bw, bw);
28}
29
30void MultiJac::setValue(size_t row, size_t col, double value)
31{
32 m_mat(row, col) = value;
33 if (row == col) {
34 m_ssdiag[row] = value;
35 }
36}
37
38void MultiJac::updateTransient(double rdt, integer* mask)
39{
40 for (size_t n = 0; n < m_dim; n++) {
41 m_mat.value(n,n) = m_ssdiag[n] - mask[n]*rdt;
42 }
43 factorize();
44}
45
46} // namespace
size_t nSubDiagonals() const
Number of subdiagonals.
void resize(size_t n, size_t kl, size_t ku, double v=0.0)
Resize the matrix problem.
void bfill(double v=0.0)
Fill or zero the matrix.
size_t nSuperDiagonals() const
Number of superdiagonals.
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:59
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:34
vector< double > m_ssdiag
Diagonal of the steady-state Jacobian.
Definition MultiJac.h:60
void reset() override
Reset parameters as needed.
Definition MultiJac.cpp:12
void updateTransient(double rdt, integer *mask) override
Update the diagonal terms in the Jacobian by using the transient mask .
Definition MultiJac.cpp:38
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
size_t m_dim
Dimension of the system.
int m_age
Age of the Jacobian (times incrementAge() has been called)
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595