Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce unstrained-flow for BurnerFlame #1477

Merged
merged 2 commits into from Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 16 additions & 5 deletions include/cantera/oneD/StFlow.h
Expand Up @@ -171,21 +171,31 @@ class StFlow : public Domain1D
virtual shared_ptr<SolutionArray> asArray(const double* soln) const;
virtual void fromArray(SolutionArray& arr, double* soln);

//! Set flow configuration for freely-propagating flames, using an internal
//! point with a fixed temperature as the condition to determine the inlet
//! mass flux.
//! Set flow configuration for freely-propagating flames, using an internal point
//! with a fixed temperature as the condition to determine the inlet mass flux.
void setFreeFlow() {
m_type = cFreeFlow;
m_dovisc = false;
m_isFree = true;
m_usesLambda = false;
}

//! Set flow configuration for axisymmetric counterflow or burner-stabilized
//! flames, using specified inlet mass fluxes.
//! Set flow configuration for axisymmetric counterflow flames, using specified
//! inlet mass fluxes.
void setAxisymmetricFlow() {
m_type = cAxisymmetricStagnationFlow;
m_dovisc = true;
m_isFree = false;
m_usesLambda = true;
}

//! Set flow configuration for burner-stabilized flames, using specified inlet mass
//! fluxes.
void setUnstrainedFlow() {
m_type = cAxisymmetricStagnationFlow;
m_dovisc = false;
m_isFree = false;
m_usesLambda = false;
}

//! Return the type of flow domain being represented, either "Free Flame" or
Expand Down Expand Up @@ -482,6 +492,7 @@ class StFlow : public Domain1D

bool m_dovisc;
bool m_isFree;
bool m_usesLambda;

//! Update the transport properties at grid points in the range from `j0`
//! to `j1`, based on solution `x`.
Expand Down
23 changes: 19 additions & 4 deletions interfaces/cython/cantera/_onedim.pyx
Expand Up @@ -733,6 +733,20 @@ cdef class FreeFlow(_FlowBase):
_domain_type = "free-flow"


cdef class UnstrainedFlow(_FlowBase):
r"""An unstrained flow domain. The equations solved are standard equations for
adiabatic one-dimensional flow. The solution variables are:

*velocity*
axial velocity
*T*
temperature
*Y_k*
species mass fractions
"""
_domain_type = "unstrained-flow"


cdef class AxisymmetricFlow(_FlowBase):
r"""
An axisymmetric flow domain. The equations solved are the similarity equations for
Expand Down Expand Up @@ -794,14 +808,15 @@ cdef class IdealGasFlow(_FlowBase):

.. deprecated:: 3.0

Class to be removed after Cantera 3.0; replaced by `FreeFlow` and
s`AxisymmetricFlow`.
Class to be removed after Cantera 3.0; replaced by `FreeFlow`,
`AxisymmetricFlow` and `UnstrainedFlow`.
"""
_domain_type = "gas-flow"

def __init__(self, *args, **kwargs):
warnings.warn("Class to be removed after Cantera 3.0; use 'FreeFlow' "
"or AxisymmetricFlow' instead.", DeprecationWarning)
warnings.warn("Class to be removed after Cantera 3.0; use 'FreeFlow', "
"'AxisymmetricFlow' or 'UnstrainedFlow' instead.",
DeprecationWarning)
super().__init__(*args, **kwargs)


Expand Down
6 changes: 3 additions & 3 deletions interfaces/cython/cantera/onedim.py
Expand Up @@ -1067,7 +1067,7 @@ def __init__(self, gas, grid=None, width=None):
Defines a grid on the interval [0, width] with internal points
determined automatically by the solver.

A domain of class `AxisymmetricFlow` named ``flame`` will be created to
A domain of class `UnstrainedFlow` named ``flame`` will be created to
represent the flame. The three domains comprising the stack are stored as
``self.burner``, ``self.flame``, and ``self.outlet``.
"""
Expand All @@ -1080,8 +1080,8 @@ def __init__(self, gas, grid=None, width=None):

if not hasattr(self, 'flame'):
# Create flame domain if not already instantiated by a child class
#: `AxisymmetricFlow` domain representing the flame
self.flame = AxisymmetricFlow(gas, name='flame')
#: `UnstrainedFlow` domain representing the flame
self.flame = UnstrainedFlow(gas, name='flame')

if width is not None:
grid = np.array([0.0, 0.1, 0.2, 0.3, 0.5, 0.7, 1.0]) * width
Expand Down
5 changes: 5 additions & 0 deletions src/oneD/DomainFactory.cpp
Expand Up @@ -53,6 +53,11 @@ DomainFactory::DomainFactory()
ret->setAxisymmetricFlow();
return ret;
});
reg("unstrained-flow", [](shared_ptr<Solution> solution, const string& id) {
StFlow* ret = new StFlow(solution, id);
ret->setUnstrainedFlow();
return ret;
});
}

DomainFactory* DomainFactory::factory()
Expand Down
9 changes: 6 additions & 3 deletions src/oneD/StFlow.cpp
Expand Up @@ -132,7 +132,10 @@ string StFlow::type() const {
if (m_isFree) {
return "free-flow";
}
return "axisymmetric-flow";
if (m_usesLambda) {
return "axisymmetric-flow";
}
return "unstrained-flow";
}

void StFlow::setThermo(IdealGasPhase& th) {
Expand Down Expand Up @@ -730,9 +733,9 @@ bool StFlow::componentActive(size_t n) const
{
switch (n) {
case c_offset_V: // spread_rate
return !m_isFree;
return m_usesLambda;
case c_offset_L: // lambda
return !m_isFree;
return m_usesLambda;
case c_offset_E: // eField
return false;
default:
Expand Down