[1D] Throw an exception if transport state is inconsistent

The user can enable Soret (thermal) diffusion or multicomponent
transport in either order, but attempts to solve flame problems with
Soret enabled and the mixture-averaged transport approximation will
result in an error
This commit is contained in:
Bryan W. Weber 2018-03-05 18:36:24 -05:00
parent c9b0bce8b9
commit a03afbd56e
No known key found for this signature in database
GPG key ID: 3A93E209C87E1FE7
3 changed files with 14 additions and 14 deletions

View file

@ -78,7 +78,12 @@ public:
//! set the transport manager
void setTransport(Transport& trans);
void enableSoret(bool withSoret);
//! Enable thermal diffusion, also known as Soret diffusion.
//! Requires that multicomponent transport properties be
//! enabled to carry out calculations.
void enableSoret(bool withSoret) {
m_do_soret = withSoret;
}
bool withSoret() const {
return m_do_soret;
}

View file

@ -748,7 +748,7 @@ cdef extern from "cantera/oneD/Sim1D.h":
void setMaxGridPoints(int, size_t) except +translate_exception
size_t maxGridPoints(size_t) except +translate_exception
void setGridMin(int, double) except +translate_exception
void setFixedTemperature(double)
void setFixedTemperature(double) except +translate_exception
void setInterrupt(CxxFunc1*) except +translate_exception
void setTimeStepCallback(CxxFunc1*)
void setSteadyCallback(CxxFunc1*)

View file

@ -132,7 +132,7 @@ void StFlow::setupGrid(size_t n, const doublereal* z)
}
}
void StFlow::resetBadValues(double* xg)
void StFlow::resetBadValues(double* xg)
{
double* x = xg + loc();
for (size_t j = 0; j < m_points; j++) {
@ -154,17 +154,6 @@ void StFlow::setTransport(Transport& trans)
}
}
void StFlow::enableSoret(bool withSoret)
{
if (m_do_multicomponent) {
m_do_soret = withSoret;
} else {
throw CanteraError("setTransport",
"Thermal diffusion (the Soret effect) "
"requires using a multicomponent transport model.");
}
}
void StFlow::_getInitialSoln(double* x)
{
for (size_t j = 0; j < m_points; j++) {
@ -195,6 +184,12 @@ void StFlow::setGasAtMidpoint(const doublereal* x, size_t j)
void StFlow::_finalize(const doublereal* x)
{
if (!m_do_multicomponent && m_do_soret) {
throw CanteraError("_finalize",
"Thermal diffusion (the Soret effect) is enabled, and requires "
"using a multicomponent transport model.");
}
size_t nz = m_zfix.size();
bool e = m_do_energy[0];
for (size_t j = 0; j < m_points; j++) {