Skip to content

Commit

Permalink
Bug fix for enforcing quasi-neutrality on low Mach path
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
trevilo committed Aug 27, 2024
1 parent cfa7658 commit 12ec613
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/reactingFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 12ec613

Please sign in to comment.