Commit 27981d42 by Mark Olesen

ENH: add clip() method to GeometricField

parent c6ee663e
 ... @@ -692,7 +692,7 @@ void Foam::multiphaseSystem::solve() ... @@ -692,7 +692,7 @@ void Foam::multiphaseSystem::solve() phase.alphaRhoPhi() = fvc::interpolate(phase.rho())*phase.alphaPhi(); phase.alphaRhoPhi() = fvc::interpolate(phase.rho())*phase.alphaPhi(); // Ensure the phase-fractions are bounded // Ensure the phase-fractions are bounded phase.maxMin(0, 1); phase.clip(0, 1); } } calcAlphas(); calcAlphas(); ... ...
 ... @@ -403,7 +403,7 @@ void Foam::twoPhaseSystem::solve() ... @@ -403,7 +403,7 @@ void Foam::twoPhaseSystem::solve() << endl; << endl; // Ensure the phase-fractions are bounded // Ensure the phase-fractions are bounded alpha1.maxMin(0, 1); alpha1.clip(0, 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; ... ...
 ... @@ -1095,6 +1095,17 @@ void Foam::GeometricField::replace ... @@ -1095,6 +1095,17 @@ void Foam::GeometricField::replace } } template class PatchField, class GeoMesh> void Foam::GeometricField::min ( const dimensioned& dt ) { Foam::min(primitiveFieldRef(), primitiveField(), dt.value()); Foam::min(boundaryFieldRef(), boundaryField(), dt.value()); } template class PatchField, class GeoMesh> template class PatchField, class GeoMesh> void Foam::GeometricField::max void Foam::GeometricField::max ( ( ... @@ -1107,27 +1118,38 @@ void Foam::GeometricField::max ... @@ -1107,27 +1118,38 @@ void Foam::GeometricField::max template class PatchField, class GeoMesh> template class PatchField, class GeoMesh> void Foam::GeometricField::min void Foam::GeometricField::clip ( ( const dimensioned& dt const dimensioned>& range ) ) { { Foam::min(primitiveFieldRef(), primitiveField(), dt.value()); Foam::clip(primitiveFieldRef(), primitiveField(), range.value()); Foam::min(boundaryFieldRef(), boundaryField(), dt.value()); Foam::clip(boundaryFieldRef(), boundaryField(), range.value()); } template class PatchField, class GeoMesh> void Foam::GeometricField::clip ( const dimensioned& minVal, const dimensioned& maxVal ) { MinMax range(minVal.value(), maxVal.value()); Foam::clip(primitiveFieldRef(), primitiveField(), range); Foam::clip(boundaryFieldRef(), boundaryField(), range); } } template class PatchField, class GeoMesh> template class PatchField, class GeoMesh> void Foam::GeometricField::maxMin void Foam::GeometricField::maxMin ( ( const dimensioned& minDt, const dimensioned& minVal, const dimensioned& maxDt const dimensioned& maxVal ) ) { { Foam::max(primitiveFieldRef(), primitiveField(), minDt.value()); this->clip(minVal, maxVal); Foam::max(boundaryFieldRef(), boundaryField(), minDt.value()); Foam::min(primitiveFieldRef(), primitiveField(), maxDt.value()); Foam::min(boundaryFieldRef(), boundaryField(), maxDt.value()); } } ... ...
 ... @@ -3,7 +3,7 @@ ... @@ -3,7 +3,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-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- License License This file is part of OpenFOAM. This file is part of OpenFOAM. ... @@ -598,12 +598,24 @@ public: ... @@ -598,12 +598,24 @@ public: // This sets the \em floor on the field values // This sets the \em floor on the field values void max(const dimensioned& dt); void max(const dimensioned& dt); void maxMin //- Clip the field to be bounded within the specified range void clip(const dimensioned>& range); //- Clip the field to be bounded within the specified range void clip ( ( const dimensioned& minDt, const dimensioned& minVal, const dimensioned& maxDt const dimensioned& maxVal ); ); //- Deprecated(2019-01) identical to clip() // \deprecated(2019-01) identical to clip() void maxMin ( const dimensioned& minVal, const dimensioned& maxVal ) FOAM_DEPRECATED_FOR(2019-01, "clip() method"); // Member Operators // Member Operators ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!