Cantera  2.1.2
MultiJac.h
Go to the documentation of this file.
1 /**
2  * @file MultiJac.h
3  */
4 
5 /*
6  * Copyright 2002 California Institute of Technology
7  */
8 
9 #ifndef CT_MULTIJAC_H
10 #define CT_MULTIJAC_H
11 
13 #include "OneDim.h"
14 #include "time.h"
15 
16 namespace Cantera
17 {
18 
19 /**
20  * Class MultiJac evaluates the Jacobian of a system of equations
21  * defined by a residual function supplied by an instance of class
22  * OneDim. The residual function may consist of several linked
23  * 1D domains, with different variables in each domain.
24  * @ingroup onedim
25  */
26 class MultiJac : public BandMatrix
27 {
28 public:
29  MultiJac(OneDim& r);
30 
31  /**
32  * Evaluate the Jacobian at x0. The unperturbed residual
33  * function is resid0, which must be supplied on input. The
34  * third parameter 'rdt' is the reciprocal of the time
35  * step. If zero, the steady-state Jacobian is evaluated.
36  */
37  void eval(doublereal* x0, doublereal* resid0, double rdt);
38 
39  //! Elapsed CPU time spent computing the Jacobian.
40  doublereal elapsedTime() const {
41  return m_elapsed;
42  }
43 
44  //! Number of Jacobian evaluations.
45  int nEvals() const {
46  return m_nevals;
47  }
48 
49  //! Number of times 'incrementAge' has been called since the last
50  //! evaluation
51  int age() const {
52  return m_age;
53  }
54 
55  //! Increment the Jacobian age.
56  void incrementAge() {
57  m_age++;
58  }
59 
60  void updateTransient(doublereal rdt, integer* mask);
61 
62  //! Set the Jacobian age.
63  void setAge(int age) {
64  m_age = age;
65  }
66 
67  vector_int& transientMask() {
68  return m_mask;
69  }
70 
71  void incrementDiagonal(int j, doublereal d);
72 
73 protected:
74  //! Residual evaluator for this jacobian
75  /*!
76  * This is a pointer to the residual evaluator. This object isn't owned
77  * by this jacobian object.
78  */
80 
81  vector_fp m_r1;
82  doublereal m_rtol, m_atol;
83  doublereal m_elapsed;
84  vector_fp m_ssdiag;
85  vector_int m_mask;
86  int m_nevals;
87  int m_age;
88  size_t m_size;
89  size_t m_points;
90 };
91 }
92 
93 #endif
Container class for multiple-domain 1D problems.
Definition: OneDim.h:22
int nEvals() const
Number of Jacobian evaluations.
Definition: MultiJac.h:45
int age() const
Number of times 'incrementAge' has been called since the last evaluation.
Definition: MultiJac.h:51
void incrementAge()
Increment the Jacobian age.
Definition: MultiJac.h:56
OneDim * m_resid
Residual evaluator for this jacobian.
Definition: MultiJac.h:79
std::vector< int > vector_int
Vector of ints.
Definition: ct_defs.h:167
void setAge(int age)
Set the Jacobian age.
Definition: MultiJac.h:63
void eval(doublereal *x0, doublereal *resid0, double rdt)
Evaluate the Jacobian at x0.
Definition: MultiJac.cpp:48
Class MultiJac evaluates the Jacobian of a system of equations defined by a residual function supplie...
Definition: MultiJac.h:26
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:165
doublereal elapsedTime() const
Elapsed CPU time spent computing the Jacobian.
Definition: MultiJac.h:40
Declarations for the class BandMatrix which is a child class of GeneralMatrix for banded matrices han...
A class for banded matrices, involving matrix inversion processes.
Definition: BandMatrix.h:37