From 985b1f07a896b4dfe363a92d090fc8d6dd81e62e Mon Sep 17 00:00:00 2001 From: Victor Brunini Date: Mon, 26 Nov 2012 20:20:52 +0000 Subject: [PATCH] Correctly size grad_lnAC so that we don't write past the end of it for 2D and 3D problems. Fix the creation of the Stefan-Maxwell matrix coefficients. --- src/transport/LiquidTransport.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/transport/LiquidTransport.cpp b/src/transport/LiquidTransport.cpp index a0e5a061d..374d96043 100644 --- a/src/transport/LiquidTransport.cpp +++ b/src/transport/LiquidTransport.cpp @@ -416,7 +416,7 @@ bool LiquidTransport::initLiquid(LiquidTransportParams& tr) m_chargeSpecies[i] = m_thermo->charge(i); } m_volume_spec.resize(m_nsp, 0.0); - m_Grad_lnAC.resize(m_nsp, 0.0); + m_Grad_lnAC.resize(m_nDim * m_nsp, 0.0); m_spwork.resize(m_nsp, 0.0); // resize the internal gradient variables @@ -1692,9 +1692,9 @@ void LiquidTransport::stefan_maxwell_solve() //if ( !( m_bdiff(i,j) > 0.0 ) ) //throw CanteraError("LiquidTransport::stefan_maxwell_solve", // "m_bdiff has zero entry in non-diagonal."); - tmp = m_molefracs_tran[j] * m_bdiff(i,j); + tmp = m_molefracs_tran[i] * m_molefracs_tran[j] * m_bdiff(i,j); m_A(i,i) -= tmp; - m_A(i,j) = + tmp; + m_A(i,j) = tmp; } } } @@ -1756,9 +1756,9 @@ void LiquidTransport::stefan_maxwell_solve() //if ( !( m_bdiff(i,j) > 0.0 ) ) //throw CanteraError("LiquidTransport::stefan_maxwell_solve", // "m_bdiff has zero entry in non-diagonal."); - tmp = m_molefracs_tran[j] * m_bdiff(i,j); + tmp = m_molefracs_tran[i] * m_molefracs_tran[j] * m_bdiff(i,j); m_A(i,i) -= tmp; - m_A(i,j) = + tmp; + m_A(i,j) = tmp; } } } @@ -1801,9 +1801,9 @@ void LiquidTransport::stefan_maxwell_solve() //if ( !( m_bdiff(i,j) > 0.0 ) ) //throw CanteraError("LiquidTransport::stefan_maxwell_solve", // "m_bdiff has zero entry in non-diagonal."); - tmp = m_molefracs_tran[j] * m_bdiff(i,j); + tmp = m_molefracs_tran[i] * m_molefracs_tran[j] * m_bdiff(i,j); m_A(i,i) -= tmp; - m_A(i,j) = + tmp; + m_A(i,j) = tmp; } } }