reactingMultiphaseEulerFoam: Limited phase-fractions

for consistency with reactingTwoPhaseEulerFoam and to ensure correct operation
of models requiring formal boundedness of phase-fractions.

Resolves bug-report https://bugs.openfoam.org/view.php?id=2589
This commit is contained in:
Henry Weller
2017-06-26 16:24:57 +01:00
committed by Andrew Heather
parent 7b2d419157
commit cc9ffdffbb
4 changed files with 25 additions and 3 deletions

View File

@ -699,6 +699,9 @@ void Foam::multiphaseSystem::solve()
{ {
phaseModel& phase = phases()[phasei]; phaseModel& phase = phases()[phasei];
phase.alphaRhoPhi() = fvc::interpolate(phase.rho())*phase.alphaPhi(); phase.alphaRhoPhi() = fvc::interpolate(phase.rho())*phase.alphaPhi();
// Ensure the phase-fractions are bounded
phase.maxMin(0, 1);
} }
calcAlphas(); calcAlphas();

View File

@ -403,8 +403,7 @@ void Foam::twoPhaseSystem::solve()
<< endl; << endl;
// Ensure the phase-fractions are bounded // Ensure the phase-fractions are bounded
alpha1.max(0); alpha1.maxMin(0, 1);
alpha1.min(1);
// Update the phase-fraction of the other phase // Update the phase-fraction of the other phase
alpha2 = scalar(1) - alpha1; alpha2 = scalar(1) - alpha1;

View File

@ -1153,6 +1153,20 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::min
} }
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::maxMin
(
const dimensioned<Type>& minDt,
const dimensioned<Type>& maxDt
)
{
Foam::max(primitiveFieldRef(), primitiveField(), minDt.value());
Foam::max(boundaryFieldRef(), boundaryField(), minDt.value());
Foam::min(primitiveFieldRef(), primitiveField(), maxDt.value());
Foam::min(boundaryFieldRef(), boundaryField(), maxDt.value());
}
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::negate() void Foam::GeometricField<Type, PatchField, GeoMesh>::negate()
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -564,6 +564,12 @@ public:
void max(const dimensioned<Type>&); void max(const dimensioned<Type>&);
void min(const dimensioned<Type>&); void min(const dimensioned<Type>&);
void maxMin
(
const dimensioned<Type>& minDt,
const dimensioned<Type>& maxDt
);
void max void max
( (
const GeometricField<Type, PatchField, GeoMesh>&, const GeometricField<Type, PatchField, GeoMesh>&,