Skip to content

Commit

Permalink
Restore FlowReactor.distance in a deprecated form
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and ischoegl committed Jun 14, 2023
1 parent 3535038 commit cd8756e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/cantera/zeroD/FlowReactor.h
Expand Up @@ -61,6 +61,10 @@ class FlowReactor : public IdealGasReactor
return m_area;
}

//! @deprecated To be removed after Cantera 3.0. Access distance through the
//! ReactorNet object
double distance() const;

//! Sets the area of the reactor [m^2]
void setArea(double area);

Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/reactor.pxd
Expand Up @@ -69,7 +69,7 @@ cdef extern from "cantera/zerodim.h" namespace "Cantera":
CxxFlowReactor()
void setMassFlowRate(double) except +translate_exception
double speed()
double distance()
double distance() except +translate_exception
void setArea(double) except +translate_exception
double area() except +translate_exception
void setSurfaceAreaToVolumeRatio(double) except +translate_exception
Expand Down
11 changes: 11 additions & 0 deletions interfaces/cython/cantera/reactor.pyx
Expand Up @@ -526,6 +526,17 @@ cdef class FlowReactor(Reactor):
""" Speed [m/s] of the flow in the reactor at the current position """
return (<CxxFlowReactor*>self.reactor).speed()

@property
def distance(self):
"""
The distance of the fluid element from the inlet of the reactor.
.. deprecated:: 3.0
To be removed after Cantera 3.0. Access distance via `ReactorNet`.
"""
return (<CxxFlowReactor*>self.reactor).distance()


cdef class ExtensibleReactor(Reactor):
"""
Expand Down
12 changes: 12 additions & 0 deletions src/zeroD/FlowReactor.cpp
Expand Up @@ -9,6 +9,7 @@
#include "cantera/kinetics/Kinetics.h"
#include "cantera/thermo/ThermoPhase.h"
#include "cantera/zeroD/ReactorSurface.h"
#include "cantera/zeroD/ReactorNet.h"
#include "cantera/thermo/SurfPhase.h"
#include "cantera/numerics/DenseMatrix.h"
#include "cantera/kinetics/InterfaceKinetics.h"
Expand Down Expand Up @@ -207,6 +208,17 @@ void FlowReactor::setMassFlowRate(double mdot)
m_u = mdot/(m_rho * m_area);
}

double FlowReactor::distance() const
{
warn_deprecated("FlowReactor::distance", "To be removed after Cantera 3.0."
"Access distance through the ReactorNet object.");
if (m_net != nullptr) {
return m_net->distance();
} else {
return 0.0;
}
}

void FlowReactor::setArea(double area) {
double mdot = m_rho * m_u * m_area;
m_area = area;
Expand Down

0 comments on commit cd8756e

Please sign in to comment.