diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index 06a6e3ba5d..68c48405fe 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -107,6 +107,7 @@ void Foam::functionObjects::forces::writeBinHeader writeHeader(os, header + " bins"); writeHeaderValue(os, "bins", nBin_); writeHeaderValue(os, "start", binMin_); + writeHeaderValue(os, "end", binMax_); writeHeaderValue(os, "delta", binDx_); writeHeaderValue(os, "direction", binDir_); @@ -249,14 +250,14 @@ void Foam::functionObjects::forces::initialiseBins() const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); // Determine extents of patches - binMin_ = GREAT; - scalar binMax = -GREAT; + scalar geomMin = GREAT; + scalar geomMax = -GREAT; for (const label patchi : patchSet_) { const polyPatch& pp = pbm[patchi]; scalarField d(pp.faceCentres() & binDir_); - binMin_ = min(min(d), binMin_); - binMax = max(max(d), binMax); + geomMin = min(min(d), geomMin); + geomMax = max(max(d), geomMax); } // Include porosity @@ -276,22 +277,31 @@ void Foam::functionObjects::forces::initialiseBins() { const cellZone& cZone = mesh_.cellZones()[zonei]; const scalarField d(dd, cZone); - binMin_ = min(min(d), binMin_); - binMax = max(max(d), binMax); + geomMin = min(min(d), geomMin); + geomMax = max(max(d), geomMax); } } } - reduce(binMin_, minOp()); - reduce(binMax, maxOp()); + reduce(geomMin, minOp()); + reduce(geomMax, maxOp()); - // Slightly boost binMax so that region of interest is fully - // within bounds - binMax = 1.0001*(binMax - binMin_) + binMin_; + // Slightly boost max so that region of interest is fully within bounds + geomMax = 1.0001*(geomMax - geomMin) + geomMin; - binDx_ = (binMax - binMin_)/scalar(nBin_); + // Use geometry limits if not specified by the user + if (binMin_ == GREAT) + { + binMin_ = geomMin; + } + if (binMax_ == GREAT) + { + binMax_ = geomMax; + } - // Create the bin points used for writing + binDx_ = (binMax_ - binMin_)/scalar(nBin_); + + // Create the bin mid-points used for writing binPoints_.setSize(nBin_); forAll(binPoints_, i) { @@ -723,8 +733,9 @@ Foam::functionObjects::forces::forces porosity_(false), nBin_(1), binDir_(Zero), - binDx_(0.0), + binDx_(0), binMin_(GREAT), + binMax_(GREAT), binPoints_(), binCumulative_(true), writeFields_(false), @@ -767,8 +778,9 @@ Foam::functionObjects::forces::forces porosity_(false), nBin_(1), binDir_(Zero), - binDx_(0.0), + binDx_(0), binMin_(GREAT), + binMax_(GREAT), binPoints_(), binCumulative_(true), writeFields_(false), @@ -848,8 +860,9 @@ bool Foam::functionObjects::forces::read(const dictionary& dict) if (dict.found("binData")) { + Info<< " Activated data bins" << endl; const dictionary& binDict(dict.subDict("binData")); - binDict.readEntry("nBin", nBin_); + nBin_ = binDict.get