Skip to content

Commit

Permalink
zLeft and zRight outputs added for assessing two point control. Extra…
Browse files Browse the repository at this point in the history
… comments added
  • Loading branch information
wandadars committed Oct 3, 2023
1 parent 3b432bb commit f97c934
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 12 deletions.
40 changes: 31 additions & 9 deletions include/cantera/oneD/StFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ namespace Cantera
//! Offsets of solution components in the 1D solution array.
enum offset
{
c_offset_U //! axial velocity
c_offset_U //! axial velocity [m/s]
, c_offset_V //! strain rate
, c_offset_T //! temperature
, c_offset_T //! temperature [Kelvin]
, c_offset_L //! (1/r)dP/dr
, c_offset_E //! electric field
, c_offset_Uo //! oxidizer axial velocity
, c_offset_Uo //! oxidizer axial velocity [m/s]
, c_offset_Y //! mass fractions
};

Expand Down Expand Up @@ -241,33 +241,55 @@ class StFlow : public Domain1D
//! In this method there are control points that are designated in a domain, and
//! the value of the solution at these points is fixed. The values of the control
//! points are dictated and thus serve as a boundary condition that affects the
//! solution of the goerning equations in the 1D domain. The imposition of fixed
//! points in the domain means that the original set of governign equations' boundary
//! solution of the governing equations in the 1D domain. The imposition of fixed
//! points in the domain means that the original set of governing equations' boundary
//! conditions would over-specify the problem. Thus, the boundary conditions are changed
//! to reflect the fact that the control points are serving as internal boundary conditions.
//!
//! This method is based on the work of M. Nishioka, C.K. Law, and T. Takeno (1996) titled
//! "A Flame-Controlling Continuation Method for Generating S-Curve Responses with
//! Detailed Chemistry"

//! The current left control point temperature
double leftControlPointTemperature() const {
if (m_twoPointControl && (m_zLeft != Undef))
if (m_twoPointControl && (m_zLeft != Undef)) {
return m_tLeft;
}
}

//! The current left control point spatial coordinate
double leftControlPointCoordinate() const {
if (m_twoPointControl && (m_zLeft != Undef)) {
return m_zLeft;
}
}

//! Set the temperature of the left control point
void setLeftControlPointTemperature(double temperature) {
if (m_twoPointControl && (m_zLeft != Undef))
if (m_twoPointControl && (m_zLeft != Undef)) {
m_tLeft = temperature;
}
}

//! The current right control point temperature
double rightControlPointTemperature() const {
if (m_twoPointControl && (m_zRight != Undef))
if (m_twoPointControl && (m_zRight != Undef)) {
return m_tRight;
}
}

//! The current right control point spatial coordinate
double rightControlPointCoordinate() const {
if (m_twoPointControl && (m_zRight != Undef)) {
return m_zRight;
}
}

//! Set the temperature of the right control point
void setRightControlPointTemperature(double temperature) {
if (m_twoPointControl && (m_zRight != Undef))
if (m_twoPointControl && (m_zRight != Undef)) {
m_tRight = temperature;
}
}

//! Set the status of the two-point control
Expand Down
2 changes: 2 additions & 0 deletions interfaces/cython/cantera/_onedim.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ cdef extern from "cantera/oneD/StFlow.h":
void enableTwoPointControl(cbool)
cbool twoPointControlEnabled()
double leftControlPointTemperature()
double leftControlPointCoordinate()
void setLeftControlPointTemperature(double)
double rightControlPointTemperature()
double rightControlPointCoordinate()
void setRightControlPointTemperature(double)


Expand Down
12 changes: 11 additions & 1 deletion interfaces/cython/cantera/_onedim.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,17 @@ cdef class _FlowBase(Domain1D):
return self.flow.rightControlPointTemperature()
def __set__(self, T):
self.flow.setRightControlPointTemperature(T)


property zLeft:
""" Left control point temperature [K] """
def __get__(self):
return self.flow.leftControlPointCoordinate()

property zRight:
""" Right control point temperature [K] """
def __get__(self):
return self.flow.rightControlPointCoordinate()

property two_point_control_enabled:
""" Determines whether or not to enable two point flame control"""
def __get__(self):
Expand Down
10 changes: 10 additions & 0 deletions interfaces/cython/cantera/onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ def tLeft(self):
def tLeft(self, T):
self.flame.tLeft = T

@property
def zLeft(self):
""" Get the left control point coordinate [m] """
return self.flame.zLeft

@property
def tRight(self):
""" Get/Set the right control point temperature [K] """
Expand All @@ -315,6 +320,11 @@ def tRight(self):
def tRight(self, T):
self.flame.tRight = T

@property
def zRight(self):
""" Get the right control point coordinate [m] """
return self.flame.zRight

def elemental_mass_fraction(self, m):
r"""
Get the elemental mass fraction :math:`Z_{\mathrm{mass},m}` of element
Expand Down
3 changes: 1 addition & 2 deletions src/oneD/Boundary1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void Inlet1D::eval(size_t jg, double* xg, double* rg,
// if the flow is a freely-propagating flame, mdot is not specified.
// Set mdot equal to rho*u, and also set lambda to zero.
m_mdot = m_flow->density(0) * xb[c_offset_U];
} else if (m_flow->isStrained()) {
} else if (m_flow->isStrained()) { //axisymmetric flow
if (m_flow->twoPointControlEnabled()) {
m_mdot = m_flow->density(0)*xb[c_offset_U];
} else {
Expand Down Expand Up @@ -235,7 +235,6 @@ void Inlet1D::eval(size_t jg, double* xg, double* rg,
rb[c_offset_T] -= m_flow->T_fixed(m_flow->nPoints() - 1);
}


if (m_flow->twoPointControlEnabled()) {// For point control adjustments
// At the right boundary, the mdot is dictated by the velocity at the
// right boundary, which comes from the Uo variable.
Expand Down

0 comments on commit f97c934

Please sign in to comment.