From 12ec6131cc5896ea4706690770aecae091280d80 Mon Sep 17 00:00:00 2001 From: "Todd A. Oliver" Date: Mon, 26 Aug 2024 20:51:06 -0500 Subject: [PATCH] Bug fix for enforcing quasi-neutrality on low Mach path Was using an incorrectly sized temporary storage Vector. This did not affect the 3 species case (b/c the bug is that the stride between species was too large, which is irrelevant with only 1 active specie) so no existing test cases are affected. Was found while attempting to run 6 species torch case. --- src/reactingFlow.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/reactingFlow.cpp b/src/reactingFlow.cpp index 63fd2e42..860a395d 100644 --- a/src/reactingFlow.cpp +++ b/src/reactingFlow.cpp @@ -1517,12 +1517,12 @@ void ReactingFlow::step() { // Y_electron = sum_{i \in active species} (m_electron / m_i) * q_i * Y_i for (int iSpecies = 0; iSpecies < nActiveSpecies_; iSpecies++) { - setScalarFromVector(Yn_next_, iSpecies, &tmpR1_); + setScalarFromVector(Yn_next_, iSpecies, &tmpR0a_); const double q_sp = mixture_->GetGasParams(iSpecies, GasParams::SPECIES_CHARGES); const double m_sp = mixture_->GetGasParams(iSpecies, GasParams::SPECIES_MW); const double fac = q_sp / m_sp; - tmpR1_ *= fac; - tmpR0_ += tmpR1_; + tmpR0a_ *= fac; + tmpR0_ += tmpR0a_; } const int iElectron = nSpecies_ - 2; // TODO(trevilo): check me! const double m_electron = mixture_->GetGasParams(iElectron, GasParams::SPECIES_MW); @@ -1593,12 +1593,12 @@ void ReactingFlow::step() { // Y_electron = sum_{i \in active species} (m_electron / m_i) * q_i * Y_i for (int iSpecies = 0; iSpecies < nActiveSpecies_; iSpecies++) { - setScalarFromVector(Yn_, iSpecies, &tmpR1_); + setScalarFromVector(Yn_, iSpecies, &tmpR0a_); const double q_sp = mixture_->GetGasParams(iSpecies, GasParams::SPECIES_CHARGES); const double m_sp = mixture_->GetGasParams(iSpecies, GasParams::SPECIES_MW); const double fac = q_sp / m_sp; - tmpR1_ *= fac; - tmpR0_ += tmpR1_; + tmpR0a_ *= fac; + tmpR0_ += tmpR0a_; } const int iElectron = nSpecies_ - 2; // TODO(trevilo): check me! const double m_electron = mixture_->GetGasParams(iElectron, GasParams::SPECIES_MW);