[Reactor] Deprecate Wall-based method for adding surface chemistry

The new method using class ReactorSurface should be used instead.
This commit is contained in:
Ray Speth 2016-05-17 23:18:05 -04:00
parent a7aec575a9
commit 4b8f8b692a
5 changed files with 52 additions and 20 deletions

View file

@ -18,9 +18,8 @@ class SurfPhase;
//! Represents a wall between between two ReactorBase objects. //! Represents a wall between between two ReactorBase objects.
/*! /*!
* Walls can move (changing the volume of the adjacent reactors), allow heat * Walls can move (changing the volume of the adjacent reactors) and allow heat
* transfer between reactors, and provide a location for surface reactions to * transfer between reactors.
* take place.
*/ */
class Wall class Wall
{ {
@ -144,51 +143,80 @@ public:
//! Specify the heterogeneous reaction mechanisms for each side of the //! Specify the heterogeneous reaction mechanisms for each side of the
//! wall. Passing a null pointer indicates that there is no reaction //! wall. Passing a null pointer indicates that there is no reaction
//! mechanism for the corresponding wall surface. //! mechanism for the corresponding wall surface.
//! @deprecated Use class ReactorSurface instead. To be removed after
//! Cantera 2.3.
void setKinetics(Kinetics* leftMechanism, void setKinetics(Kinetics* leftMechanism,
Kinetics* rightMechanism); Kinetics* rightMechanism);
//! Return a pointer to the surface phase object for the left //! Return a pointer to the surface phase object for the left
//! (`leftright=0`) or right (`leftright=1`) wall surface. //! (`leftright=0`) or right (`leftright=1`) wall surface.
//! @deprecated Use class ReactorSurface instead. To be removed after
//! Cantera 2.3.
SurfPhase* surface(int leftright) { SurfPhase* surface(int leftright) {
return m_surf[leftright].thermo(); return m_surf[leftright].thermo();
} }
//! @deprecated Use class ReactorSurface instead. To be removed after
//! Cantera 2.3.
ReactorSurface* reactorSurface(int leftright) { ReactorSurface* reactorSurface(int leftright) {
return &m_surf[leftright]; return &m_surf[leftright];
} }
//! Return a pointer to the surface kinetics object for the left //! Return a pointer to the surface kinetics object for the left
//! (`leftright=0`) or right (`leftright=1`) wall surface. //! (`leftright=0`) or right (`leftright=1`) wall surface.
//! @deprecated Use class ReactorSurface instead. To be removed after
//! Cantera 2.3.
Kinetics* kinetics(int leftright) { Kinetics* kinetics(int leftright) {
return m_surf[leftright].kinetics(); return m_surf[leftright].kinetics();
} }
//! Set the surface coverages on the left (`leftright = 0`) or right //! Set the surface coverages on the left (`leftright = 0`) or right
//! (`leftright = 1`) surface to the values in array `cov`. //! (`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); void setCoverages(int leftright, const doublereal* cov);
//! Set the surface coverages on the left (`leftright = 0`) or right //! Set the surface coverages on the left (`leftright = 0`) or right
//! (`leftright = 1`) surface to the values in array `cov`. //! (`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); void setCoverages(int leftright, const compositionMap& cov);
//! Set the surface coverages on the left (`leftright = 0`) or right //! Set the surface coverages on the left (`leftright = 0`) or right
//! (`leftright = 1`) surface to the values in array `cov`. //! (`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); void setCoverages(int leftright, const std::string& cov);
//! Write the coverages of the left or right surface into array `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); void getCoverages(int leftright, doublereal* cov);
//! Set the coverages in the surface phase object to the values for this //! Set the coverages in the surface phase object to the values for this
//! wall surface. //! wall surface.
//! @deprecated Use class ReactorSurface instead. To be removed after
//! Cantera 2.3.
void syncCoverages(int leftright); void syncCoverages(int leftright);
//! Number of sensitivity parameters associated with reactions on the left //! Number of sensitivity parameters associated with reactions on the left
//! (`lr = 0`) or right (`lr = 1`) side of the wall. //! (`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 { size_t nSensParams(int lr) const {
return m_surf[lr].nSensParams(); return m_surf[lr].nSensParams();
} }
//! @deprecated Use class ReactorSurface instead. To be removed after
//! Cantera 2.3.
void addSensitivityReaction(int leftright, size_t rxn); void addSensitivityReaction(int leftright, size_t rxn);
//! @deprecated Use class ReactorSurface instead. To be removed after
//! Cantera 2.3.
void setSensitivityParameters(double* params); void setSensitivityParameters(double* params);
//! @deprecated Use class ReactorSurface instead. To be removed after
//! Cantera 2.3.
void resetSensitivityParameters(); void resetSensitivityParameters();
protected: protected:

View file

@ -353,6 +353,10 @@ cdef class FlowReactor(Reactor):
cdef class WallSurface: cdef class WallSurface:
""" """
Represents a wall surface in contact with the contents of a reactor. 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): def __cinit__(self, Wall wall, int side):
self.wall = wall self.wall = wall
@ -501,13 +505,6 @@ cdef class Wall:
conduction/convection, and :math:`\epsilon` is the emissivity. The function 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 :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. 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 # 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, surface, respectively. These must be instances of class Kinetics,
or of a class derived from Kinetics, such as Interface. If or of a class derived from Kinetics, such as Interface. If
chemistry occurs on only one side, enter ``None`` for the 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.left_surface = WallSurface(self, 0)
self.right_surface = WallSurface(self, 1) self.right_surface = WallSurface(self, 1)
@ -668,6 +666,11 @@ cdef class Wall:
return self.wall.Q(t) return self.wall.Q(t)
def _set_kinetics(self): 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 cdef CxxKinetics* L = (self.left_surface._kinetics.kinetics
if self.left_surface._kinetics else NULL) if self.left_surface._kinetics else NULL)
cdef CxxKinetics* R = (self.right_surface._kinetics.kinetics cdef CxxKinetics* R = (self.right_surface._kinetics.kinetics

View file

@ -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 % :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. % 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 % 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. % construction by using the various methods of the :mat:func:`Wall` class.
% Any improperly specified arguments will generate warnings; these can be ignored % 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: % :param kleft:
% Surface reaction mechanisms for the left-facing surface. This must be an % 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, % 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: % :param kright:
% Surface reaction mechanisms for the right-facing surface. This must be an % 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, % 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: % :return:
% Instance of class :mat:func:`Wall` % Instance of class :mat:func:`Wall`

View file

@ -1,6 +1,8 @@
function setKinetics(w, left, right) function setKinetics(w, left, right)
% SETKINETICS Set the surface reaction mechanisms on a wall. % SETKINETICS Set the surface reaction mechanisms on a wall.
% setKinetics(w, left, right) % setKinetics(w, left, right)
% Use class ReactorSurface instead. To be removed after Cantera 2.3.
%
% :param w: % :param w:
% Instance of class :mat:func:`Wall` % Instance of class :mat:func:`Wall`
% :param left: % :param left:
@ -15,6 +17,8 @@ function setKinetics(w, left, right)
% an instance of class :mat:func:`Interface` % 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; ileft = 0;
iright = 0; iright = 0;
if isa(left, 'Kinetics') if isa(left, 'Kinetics')

View file

@ -31,6 +31,8 @@ bool Wall::install(ReactorBase& rleft, ReactorBase& rright)
void Wall::setKinetics(Kinetics* left, Kinetics* right) 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[0].setKinetics(left);
m_surf[1].setKinetics(right); m_surf[1].setKinetics(right);
} }