From 21100f1cb0d0c2c01b9bb6a7e44429de117bfc12 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 5 Mar 2012 20:44:46 +0000 Subject: [PATCH] Fixed Jacobian evaluation problems in AxiStagnFlow::eval --- src/oneD/StFlow.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/oneD/StFlow.cpp b/src/oneD/StFlow.cpp index 62d0bba42..af2e7476e 100644 --- a/src/oneD/StFlow.cpp +++ b/src/oneD/StFlow.cpp @@ -358,32 +358,31 @@ void AxiStagnFlow::eval(size_t jg, doublereal* xg, doublereal* rsd = rg + loc(); integer* diag = diagg + loc(); - size_t jmin, jmax, jpt; - jpt = jg - firstPoint(); + size_t jmin, jmax; + if (jg == npos) { // evaluate all points jmin = 0; jmax = m_points - 1; } else { // evaluate points for Jacobian - jmin = std::max(jpt-1, 0); + size_t jpt = (jg == 0) ? 0 : jg - firstPoint(); + jmin = std::max(jpt, 1) - 1; jmax = std::min(jpt+1,m_points-1); } // properties are computed for grid points from j0 to j1 - size_t j0 = std::max(jmin-1,0); + size_t j0 = std::max(jmin, 1) - 1; size_t j1 = std::min(jmax+1,m_points-1); - size_t j, k; - //----------------------------------------------------- // update properties //----------------------------------------------------- // update thermodynamic properties only if a Jacobian is not // being evaluated - if (jpt == npos) { //if (jpt < 0 || (m_transport_option == c_Multi_Transport)) { + if (jg == npos) { updateThermo(x, j0, j1); // update transport properties only if a Jacobian is not being