From af5bbf74a43f95abdd4cefb2afe4a93272509c48 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 14 Mar 2016 18:17:00 -0400 Subject: [PATCH] [1D] Improve Jacobian evaluation for ReactingSurf1D Don't normalize coverages when evaluating the residual normally -- only as part of recovering from a failed timestep, like what is done in StFlow. --- include/cantera/oneD/Inlet1D.h | 1 + src/oneD/boundaries1D.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/cantera/oneD/Inlet1D.h b/include/cantera/oneD/Inlet1D.h index 75a4591c2..1c9045660 100644 --- a/include/cantera/oneD/Inlet1D.h +++ b/include/cantera/oneD/Inlet1D.h @@ -354,6 +354,7 @@ public: virtual std::string componentName(size_t n) const; virtual void init(); + virtual void resetBadValues(double* xg); virtual void eval(size_t jg, doublereal* xg, doublereal* rg, integer* diagg, doublereal rdt); diff --git a/src/oneD/boundaries1D.cpp b/src/oneD/boundaries1D.cpp index e130ad367..42eaf3af5 100644 --- a/src/oneD/boundaries1D.cpp +++ b/src/oneD/boundaries1D.cpp @@ -715,6 +715,12 @@ void ReactingSurf1D::init() setTransientTolerances(1.0e-5, 1.0e-4, 0); } +void ReactingSurf1D::resetBadValues(double* xg) { + double* x = xg + loc(); + m_sphase->setCoverages(x+1); + m_sphase->getCoverages(x+1); +} + void ReactingSurf1D::eval(size_t jg, doublereal* xg, doublereal* rg, integer* diagg, doublereal rdt) { @@ -738,7 +744,7 @@ void ReactingSurf1D::eval(size_t jg, doublereal* xg, doublereal* rg, sum += x[k+1]; } m_sphase->setTemperature(x[0]); - m_sphase->setCoverages(m_work.data()); + m_sphase->setCoveragesNoNorm(m_work.data()); // set the left gas state to the adjacent point