mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fluid states: fix massFraction() method for the case where the average molar mass is negative
yeah, that's really exotic, but this occationally happens to me. (if i force all mole fractions to be positive, I get worse convergence rates.)
This commit is contained in:
committed by
Andreas Lauser
parent
a1a4191b81
commit
d64a6b802b
@@ -87,10 +87,10 @@ public:
|
||||
Scalar massFraction(int phaseIdx, int compIdx) const
|
||||
{
|
||||
return
|
||||
sumMoleFractions_[phaseIdx]
|
||||
std::abs(sumMoleFractions_[phaseIdx])
|
||||
* moleFraction_[phaseIdx][compIdx]
|
||||
* FluidSystem::molarMass(compIdx)
|
||||
/ std::max(1e-10, averageMolarMass_[phaseIdx]);
|
||||
/ std::max(1e-40, std::abs(averageMolarMass_[phaseIdx]));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -86,10 +86,10 @@ public:
|
||||
Scalar massFraction(int phaseIdx, int compIdx) const
|
||||
{
|
||||
return
|
||||
sumMoleFractions_[phaseIdx]
|
||||
std::abs(sumMoleFractions_[phaseIdx])
|
||||
* moleFraction_[phaseIdx][compIdx]
|
||||
* FluidSystem::molarMass(compIdx)
|
||||
/ std::max(1e-10, averageMolarMass_[phaseIdx]);
|
||||
/ std::max(1e-40, std::abs(averageMolarMass_[phaseIdx]));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user