88
99#include " cantera/base/ctexceptions.h"
1010#include " cantera/zeroD/ReactorBase.h"
11+ #include " cantera/numerics/eigen_sparse.h"
1112
1213namespace Cantera
1314{
@@ -115,6 +116,42 @@ class WallBase
115116 m_time = time;
116117 }
117118
119+ /* ! Build the Jacobian terms specific to the flow device for the given connected reactor.
120+ * @param r a pointer to the calling reactor
121+ * @param jacVector a vector of triplets to be added to the jacobian for the reactor
122+ * @warning This function is an experimental part of the %Cantera API and may be changed
123+ * or removed without notice.
124+ * @since New in %Cantera 3.0.
125+ */
126+ virtual void buildReactorJacobian (ReactorBase* r, vector<Eigen::Triplet<double >>& jacVector) {
127+ throw NotImplementedError (" WallBase::buildReactorJacobian" );
128+ }
129+
130+ /* ! Build the Jacobian terms specific to the flow device for the network. These terms
131+ * will be adjusted to the networks indexing system outside of the reactor.
132+ * @param jacVector a vector of triplets to be added to the jacobian for the reactor
133+ * @warning This function is an experimental part of the %Cantera API and may be changed
134+ * or removed without notice.
135+ * @since New in %Cantera 3.0.
136+ */
137+ virtual void buildNetworkJacobian (vector<Eigen::Triplet<double >>& jacVector) {
138+ throw NotImplementedError (" WallBase::buildNetworkJacobian" );
139+ }
140+
141+ /* ! Specify the jacobian terms have been calculated and should not be recalculated.
142+ * @warning This function is an experimental part of the %Cantera API and may be changed
143+ * or removed without notice.
144+ * @since New in %Cantera 3.0.
145+ */
146+ void jacobianCalculated () { m_jac_calculated = true ; };
147+
148+ /* ! Specify that jacobian terms have not been calculated and should be recalculated.
149+ * @warning This function is an experimental part of the %Cantera API and may be changed
150+ * or removed without notice.
151+ * @since New in %Cantera 3.0.
152+ */
153+ void jacobianNotCalculated () { m_jac_calculated = false ; };
154+
118155protected:
119156 ReactorBase* m_left = nullptr ;
120157 ReactorBase* m_right = nullptr ;
@@ -123,6 +160,10 @@ class WallBase
123160 double m_time = 0.0 ;
124161
125162 double m_area = 1.0 ;
163+
164+ // ! a variable to switch on and off so calculations are not doubled by the calling
165+ // ! reactor or network
166+ bool m_jac_calculated = false ;
126167};
127168
128169// ! Represents a wall between between two ReactorBase objects.
@@ -255,6 +296,10 @@ class Wall : public WallBase
255296 return m_k;
256297 }
257298
299+ virtual void buildReactorJacobian (ReactorBase* r, vector<Eigen::Triplet<double >>& jacVector) override ;
300+
301+ virtual void buildNetworkJacobian (vector<Eigen::Triplet<double >>& jacVector) override ;
302+
258303protected:
259304
260305 // ! expansion rate coefficient
0 commit comments