[oneD] Introduce isFree()

This commit is contained in:
Ingmar Schoegl 2023-07-24 09:16:20 -06:00 committed by Ray Speth
parent 378ff71c1c
commit abfa8ae847
5 changed files with 24 additions and 13 deletions

View File

@ -292,8 +292,19 @@ public:
return m_rho[j];
}
//! @deprecated To be removed after %Cantera 3.0. Superseded by isFree()
virtual bool fixed_mdot();
/**
* Retrieve flag indicating whether flow is freely propagating.
* The flow is unstrained and the axial mass flow rate is not specified.
* For free flame propagation, the axial velocity is determined by the solver.
* @since New in %Cantera 3.0
*/
bool isFree() const {
return m_isFree;
}
void setViscosityFlag(bool dovisc) {
m_dovisc = dovisc;
}

View File

@ -193,15 +193,15 @@ void Inlet1D::eval(size_t jg, double* xg, double* rg,
rb[c_offset_T] -= m_temp;
}
if (m_flow->fixed_mdot()) {
// The flow domain sets this to -rho*u. Add mdot to specify the mass
// flow rate.
rb[c_offset_L] += m_mdot;
} else {
if (m_flow->isFree()) {
// 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];
rb[c_offset_L] = xb[c_offset_L];
} else {
// The flow domain sets this to -rho*u. Add mdot to specify the mass
// flow rate.
rb[c_offset_L] += m_mdot;
}
// add the convective term to the species residual equations
@ -390,7 +390,7 @@ void Outlet1D::eval(size_t jg, double* xg, double* rg, integer* diagg,
int* db = diag - nc;
// zero Lambda
if (m_flow_left->fixed_mdot()) {
if (!m_flow_left->isFree()) {
rb[c_offset_U] = xb[c_offset_L];
}
@ -493,9 +493,7 @@ void OutletRes1D::eval(size_t jg, double* xg, double* rg,
double* rb = r - nc;
int* db = diag - nc;
if (!m_flow_left->fixed_mdot()) {
;
} else {
if (m_flow_left->isFree()) {
rb[c_offset_U] = xb[c_offset_L]; // zero Lambda
}
if (m_flow_left->doEnergy(m_flow_left->nPoints()-1)) {

View File

@ -688,7 +688,7 @@ int Sim1D::setFixedTemperature(double t)
StFlow* d_free = dynamic_cast<StFlow*>(&domain(n));
size_t npnow = d.nPoints();
size_t nstart = znew.size();
if (d_free && !d_free->fixed_mdot()) {
if (d_free && d_free->isFree()) {
for (size_t m = 0; m < npnow - 1; m++) {
bool fixedpt = false;
double t1 = value(n, c_offset_T, m);
@ -766,7 +766,7 @@ double Sim1D::fixedTemperature()
double t_fixed = std::numeric_limits<double>::quiet_NaN();
for (size_t n = 0; n < nDomains(); n++) {
StFlow* d = dynamic_cast<StFlow*>(&domain(n));
if (d && !d->fixed_mdot() && d->m_tfixed > 0) {
if (d && d->isFree() && d->m_tfixed > 0) {
t_fixed = d->m_tfixed;
break;
}
@ -779,7 +779,7 @@ double Sim1D::fixedTemperatureLocation()
double z_fixed = std::numeric_limits<double>::quiet_NaN();
for (size_t n = 0; n < nDomains(); n++) {
StFlow* d = dynamic_cast<StFlow*>(&domain(n));
if (d && !d->fixed_mdot() && d->m_tfixed > 0) {
if (d && d->isFree() && d->m_tfixed > 0) {
z_fixed = d->m_zfixed;
break;
}

View File

@ -298,6 +298,8 @@ void StFlow::setGasAtMidpoint(const double* x, size_t j)
}
bool StFlow::fixed_mdot() {
warn_deprecated("StFlow::fixed_mdot", "To be removed after"
" Cantera 3.0. Replaced by isFree().");
return !m_isFree;
}

View File

@ -181,7 +181,7 @@ int Refiner::analyze(size_t n, const double* z, const double* x)
}
// Keep the point where the temperature is fixed
if (fflame && !fflame->fixed_mdot() && z[j] == fflame->m_zfixed) {
if (fflame && fflame->isFree() && z[j] == fflame->m_zfixed) {
m_keep[j] = 1;
}
}