Skip to content
Snippets Groups Projects
Commit 4ef3e7eb authored by Andreas Lauser's avatar Andreas Lauser
Browse files

immiscible flash: fixes for more than two phases

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7596 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent b37b3cc2
No related branches found
No related tags found
No related merge requests found
......@@ -363,8 +363,18 @@ protected:
for (int phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx)
sumSat += fluidState.saturation(phaseIdx);
// make sure that the last saturation does not get out of range [0, 1]
sumSat = std::min(1.0, std::max(0.0, sumSat));
if (sumSat > 1.0) {
// make sure that the last saturation does not become
// negative
for (int phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx)
{
Scalar S = fluidState.saturation(phaseIdx);
fluidState.setSaturation(phaseIdx, S/sumSat);
}
sumSat = 1;
}
// set the last saturation
fluidState.setSaturation(/*phaseIdx=*/numPhases - 1, 1.0 - sumSat);
// update the pressures using the material law (saturations
......@@ -485,8 +495,8 @@ protected:
int phaseIdx = pvIdx - 1;
// make sure that the first M-1 saturations does not get
// out of the [0, 1] intervall
value = std::min(1.0, std::max(0.0, value));
// negative
value = std::max(0.0, value);
fs.setSaturation(phaseIdx, value);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment