From 4b8f8b692adefd558a0d3b21e8c2c69e4129374b Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 17 May 2016 23:18:05 -0400 Subject: [PATCH] [Reactor] Deprecate Wall-based method for adding surface chemistry The new method using class ReactorSurface should be used instead. --- include/cantera/zeroD/Wall.h | 34 +++++++++++++++++-- interfaces/cython/cantera/reactor.pyx | 19 ++++++----- interfaces/matlab/toolbox/@Wall/Wall.m | 13 +++---- interfaces/matlab/toolbox/@Wall/setKinetics.m | 4 +++ src/zeroD/Wall.cpp | 2 ++ 5 files changed, 52 insertions(+), 20 deletions(-) diff --git a/include/cantera/zeroD/Wall.h b/include/cantera/zeroD/Wall.h index 2703356f2..16913ba00 100644 --- a/include/cantera/zeroD/Wall.h +++ b/include/cantera/zeroD/Wall.h @@ -18,9 +18,8 @@ class SurfPhase; //! Represents a wall between between two ReactorBase objects. /*! - * Walls can move (changing the volume of the adjacent reactors), allow heat - * transfer between reactors, and provide a location for surface reactions to - * take place. + * Walls can move (changing the volume of the adjacent reactors) and allow heat + * transfer between reactors. */ class Wall { @@ -144,51 +143,80 @@ public: //! Specify the heterogeneous reaction mechanisms for each side of the //! wall. Passing a null pointer indicates that there is no reaction //! mechanism for the corresponding wall surface. + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. void setKinetics(Kinetics* leftMechanism, Kinetics* rightMechanism); //! Return a pointer to the surface phase object for the left //! (`leftright=0`) or right (`leftright=1`) wall surface. + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. SurfPhase* surface(int leftright) { return m_surf[leftright].thermo(); } + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. ReactorSurface* reactorSurface(int leftright) { return &m_surf[leftright]; } //! Return a pointer to the surface kinetics object for the left //! (`leftright=0`) or right (`leftright=1`) wall surface. + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. Kinetics* kinetics(int leftright) { return m_surf[leftright].kinetics(); } //! Set the surface coverages on the left (`leftright = 0`) or right //! (`leftright = 1`) surface to the values in array `cov`. + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. void setCoverages(int leftright, const doublereal* cov); //! Set the surface coverages on the left (`leftright = 0`) or right //! (`leftright = 1`) surface to the values in array `cov`. + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. void setCoverages(int leftright, const compositionMap& cov); //! Set the surface coverages on the left (`leftright = 0`) or right //! (`leftright = 1`) surface to the values in array `cov`. + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. void setCoverages(int leftright, const std::string& cov); //! Write the coverages of the left or right surface into array `cov`. + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. void getCoverages(int leftright, doublereal* cov); //! Set the coverages in the surface phase object to the values for this //! wall surface. + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. void syncCoverages(int leftright); //! Number of sensitivity parameters associated with reactions on the left //! (`lr = 0`) or right (`lr = 1`) side of the wall. + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. size_t nSensParams(int lr) const { return m_surf[lr].nSensParams(); } + + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. void addSensitivityReaction(int leftright, size_t rxn); + + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. void setSensitivityParameters(double* params); + + //! @deprecated Use class ReactorSurface instead. To be removed after + //! Cantera 2.3. void resetSensitivityParameters(); protected: diff --git a/interfaces/cython/cantera/reactor.pyx b/interfaces/cython/cantera/reactor.pyx index 22cef1f27..5351dd2b9 100644 --- a/interfaces/cython/cantera/reactor.pyx +++ b/interfaces/cython/cantera/reactor.pyx @@ -353,6 +353,10 @@ cdef class FlowReactor(Reactor): cdef class WallSurface: """ Represents a wall surface in contact with the contents of a reactor. + + .. deprecated:: 2.2 + Use class ReactorSurface to implement reactor surface chemistry. To be + removed after Cantera 2.3. """ def __cinit__(self, Wall wall, int side): self.wall = wall @@ -501,13 +505,6 @@ cdef class Wall: conduction/convection, and :math:`\epsilon` is the emissivity. The function :math:`q_0(t)` is a specified function of time. The heat flux is positive when heat flows from the reactor on the left to the reactor on the right. - - A heterogeneous reaction mechanism may be specified for one or both of the - wall surfaces. The mechanism object (typically an instance of class - `Interface`) must be constructed so that it is properly linked to - the object representing the fluid in the reactor the surface in question - faces. The surface temperature on each side is taken to be equal to the - temperature of the reactor it faces. """ # The signature of this function causes warnings for Sphinx documentation @@ -539,7 +536,8 @@ cdef class Wall: surface, respectively. These must be instances of class Kinetics, or of a class derived from Kinetics, such as Interface. If chemistry occurs on only one side, enter ``None`` for the - non-reactive side. + non-reactive side. *Deprecated. To be removed after + Cantera 2.3.* """ self.left_surface = WallSurface(self, 0) self.right_surface = WallSurface(self, 1) @@ -668,6 +666,11 @@ cdef class Wall: return self.wall.Q(t) def _set_kinetics(self): + """ + .. deprecated:: 2.2 + Use class ReactorSurface to implement reactor surface chemistry. To + be removed after Cantera 2.3. + """ cdef CxxKinetics* L = (self.left_surface._kinetics.kinetics if self.left_surface._kinetics else NULL) cdef CxxKinetics* R = (self.right_surface._kinetics.kinetics diff --git a/interfaces/matlab/toolbox/@Wall/Wall.m b/interfaces/matlab/toolbox/@Wall/Wall.m index dde629bd3..d5064a2ec 100644 --- a/interfaces/matlab/toolbox/@Wall/Wall.m +++ b/interfaces/matlab/toolbox/@Wall/Wall.m @@ -26,13 +26,6 @@ function x = Wall(left, right, area, k, u, q, v, kleft, kright) % :math:`q_0(t)` is a specified function of time. The heat flux is positive % when heat flows from the reactor on the left to the reactor on the right. % -% A heterogeneous reaction mechanism may be specified for one or both of the -% wall surfaces. The mechanism object (typically an instance of class -% :mat:func:`Interface`) must be constructed so that it is properly linked to -% the object representing the fluid in the reactor the surface in question -% faces. The surface temperature on each side is taken to be equal to the -% temperature of the reactor it faces. -% % Note: all of the arguments are optional and can be activated after initial % construction by using the various methods of the :mat:func:`Wall` class. % Any improperly specified arguments will generate warnings; these can be ignored @@ -64,11 +57,13 @@ function x = Wall(left, right, area, k, u, q, v, kleft, kright) % :param kleft: % Surface reaction mechanisms for the left-facing surface. This must be an % instance of class :mat:func:`Kinetics`, or of a class derived from Kinetics, -% such as :mat:func:`Interface`. +% such as :mat:func:`Interface`. This argument is deprecated. Use class +% :mat:func:`ReactorSurface` instead. To be removed after Cantera 2.3. % :param kright: % Surface reaction mechanisms for the right-facing surface. This must be an % instance of class :mat:func:`Kinetics`, or of a class derived from Kinetics, -% such as :mat:func:`Interface`. +% such as :mat:func:`Interface`. This argument is deprecated. Use class +% :mat:func:`ReactorSurface` instead. To be removed after Cantera 2.3. % :return: % Instance of class :mat:func:`Wall` diff --git a/interfaces/matlab/toolbox/@Wall/setKinetics.m b/interfaces/matlab/toolbox/@Wall/setKinetics.m index a09dc0cdf..d675f3041 100644 --- a/interfaces/matlab/toolbox/@Wall/setKinetics.m +++ b/interfaces/matlab/toolbox/@Wall/setKinetics.m @@ -1,6 +1,8 @@ function setKinetics(w, left, right) % SETKINETICS Set the surface reaction mechanisms on a wall. % setKinetics(w, left, right) +% Use class ReactorSurface instead. To be removed after Cantera 2.3. +% % :param w: % Instance of class :mat:func:`Wall` % :param left: @@ -15,6 +17,8 @@ function setKinetics(w, left, right) % an instance of class :mat:func:`Interface` % +warning('This function is deprecated, and will be removed after Cantera 2.3. Use class ReactorSurface instead.'); + ileft = 0; iright = 0; if isa(left, 'Kinetics') diff --git a/src/zeroD/Wall.cpp b/src/zeroD/Wall.cpp index 87ac5020b..e75d49376 100644 --- a/src/zeroD/Wall.cpp +++ b/src/zeroD/Wall.cpp @@ -31,6 +31,8 @@ bool Wall::install(ReactorBase& rleft, ReactorBase& rright) void Wall::setKinetics(Kinetics* left, Kinetics* right) { + warn_deprecated("Wall::setKinetics", "Use class ReactorSurface instead. " + "To be removed after Cantera 2.3."); m_surf[0].setKinetics(left); m_surf[1].setKinetics(right); }