Skip to content

Commit

Permalink
[plasma] add safe guard to prevent negative Te in updateElectronTempe…
Browse files Browse the repository at this point in the history
…ratureFromEnergyDist
  • Loading branch information
BangShiuh committed Nov 19, 2024
1 parent 72998bb commit b1ac6e9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/thermo/PlasmaPhase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,17 @@ void PlasmaPhase::updateElectronTemperatureFromEnergyDist()
Eigen::ArrayXd eps52 = m_electronEnergyLevels.pow(5./2.);
double epsilon_m = 2.0 / 5.0 * numericalQuadrature(m_quadratureMethod,
m_electronEnergyDist, eps52);
if (epsilon_m < 0.0 && m_quadratureMethod == "simpson") {
// try trapezoidal method
epsilon_m = 2.0 / 5.0 * numericalQuadrature(
"trapezoidal", m_electronEnergyDist, eps52);
}

if (epsilon_m < 0.0) {
throw CanteraError("PlasmaPhase::updateElectronTemperatureFromEnergyDist",
"The electron energy distribution produces negative electron temperature.");
}

m_electronTemp = 2.0 / 3.0 * epsilon_m * ElectronCharge / Boltzmann;
}

Expand Down

0 comments on commit b1ac6e9

Please sign in to comment.