diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index be2114fbcd..d9aeeded84 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -699,6 +699,9 @@ void Foam::multiphaseSystem::solve() { phaseModel& phase = phases()[phasei]; phase.alphaRhoPhi() = fvc::interpolate(phase.rho())*phase.alphaPhi(); + + // Ensure the phase-fractions are bounded + phase.maxMin(0, 1); } calcAlphas(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 62bbe6af40..1ab0d22780 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -403,8 +403,7 @@ void Foam::twoPhaseSystem::solve() << endl; // Ensure the phase-fractions are bounded - alpha1.max(0); - alpha1.min(1); + alpha1.maxMin(0, 1); // Update the phase-fraction of the other phase alpha2 = scalar(1) - alpha1; diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index db2e29a7a5..6f2c45eb6f 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -1153,6 +1153,20 @@ void Foam::GeometricField::min } +template class PatchField, class GeoMesh> +void Foam::GeometricField::maxMin +( + const dimensioned& minDt, + const dimensioned& 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 PatchField, class GeoMesh> void Foam::GeometricField::negate() { diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 051df928c9..3162084d4d 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / 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. ------------------------------------------------------------------------------- License @@ -564,6 +564,12 @@ public: void max(const dimensioned&); void min(const dimensioned&); + void maxMin + ( + const dimensioned& minDt, + const dimensioned& maxDt + ); + void max ( const GeometricField&,