diff --git a/src/fvOptions/cellSetOption/cellSetOption.C b/src/fvOptions/cellSetOption/cellSetOption.C index 56a664432c..665b98343d 100644 --- a/src/fvOptions/cellSetOption/cellSetOption.C +++ b/src/fvOptions/cellSetOption/cellSetOption.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,6 +89,32 @@ void Foam::fv::cellSetOption::setSelection(const dictionary& dict) } +void Foam::fv::cellSetOption::setVol() +{ + scalar VOld = V_; + + // Set volume information + V_ = 0.0; + forAll(cells_, i) + { + V_ += mesh_.V()[cells_[i]]; + } + reduce(V_, sumOp()); + + + // Convert both volumes to representation using current writeprecision + word VOldName(Time::timeName(VOld, IOstream::defaultPrecision())); + word VName(Time::timeName(V_, IOstream::defaultPrecision())); + + if (VName != VOldName) + { + Info<< indent + << "- selected " << returnReduce(cells_.size(), sumOp