Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
15 namespace Cantera
16 {
17 
18 /**
19  * Class MultiJac evaluates the Jacobian of a system of equations
20  * defined by a residual function supplied by an instance of class
21  * OneDim. The residual function may consist of several linked
22  * 1D domains, with different variables in each domain.
23  * @ingroup onedim
24  */
25 class MultiJac : public BandMatrix
26 {
27 public:
28  MultiJac(OneDim& r);
29 
30  /**
31  * Evaluate the Jacobian at x0. The unperturbed residual
32  * function is resid0, which must be supplied on input. The
33  * third parameter 'rdt' is the reciprocal of the time
34  * step. If zero, the steady-state Jacobian is evaluated.
35  */
36  void eval(doublereal* x0, doublereal* resid0, double rdt);
37 
38  //! Elapsed CPU time spent computing the Jacobian.
39  doublereal elapsedTime() const {
40  return m_elapsed;
41  }
42 
43  //! Number of Jacobian evaluations.
44  int nEvals() const {
45  return m_nevals;
46  }
47 
48  //! Number of times 'incrementAge' has been called since the last
49  //! evaluation
50  int age() const {
51  return m_age;
52  }
53 
54  //! Increment the Jacobian age.
55  void incrementAge() {
56  m_age++;
57  }
58 
59  void updateTransient(doublereal rdt, integer* mask);
60 
61  //! Set the Jacobian age.
62  void setAge(int age) {
63  m_age = age;
64  }
65 
66  vector_int& transientMask() {
67  return m_mask;
68  }
69 
70  void incrementDiagonal(int j, doublereal d);
71 
72 protected:
73  //! Residual evaluator for this Jacobian
74  /*!
75  * This is a pointer to the residual evaluator. This object isn't owned
76  * by this Jacobian object.
77  */
79 
80  vector_fp m_r1;
81  doublereal m_rtol, m_atol;
82  doublereal m_elapsed;
83  vector_fp m_ssdiag;
84  vector_int m_mask;
85  int m_nevals;
86  int m_age;
87  size_t m_size;
88  size_t m_points;
89 };
90 }
91 
92 #endif
Container class for multiple-domain 1D problems.
Definition: OneDim.h:21
int nEvals() const
Number of Jacobian evaluations.
Definition: MultiJac.h:44
int age() const
Number of times 'incrementAge' has been called since the last evaluation.
Definition: MultiJac.h:50
void incrementAge()
Increment the Jacobian age.
Definition: MultiJac.h:55
OneDim * m_resid
Residual evaluator for this Jacobian.
Definition: MultiJac.h:78
std::vector< int > vector_int
Vector of ints.
Definition: ct_defs.h:159
void setAge(int age)
Set the Jacobian age.
Definition: MultiJac.h:62
void eval(doublereal *x0, doublereal *resid0, double rdt)
Evaluate the Jacobian at x0.
Definition: MultiJac.cpp:50
Class MultiJac evaluates the Jacobian of a system of equations defined by a residual function supplie...
Definition: MultiJac.h:25
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:157
doublereal elapsedTime() const
Elapsed CPU time spent computing the Jacobian.
Definition: MultiJac.h:39
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:33