diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.C b/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.C index e09af175..26b7035b 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.C @@ -94,8 +94,17 @@ particleCellVolume::particleCellVolume ), upperThreshold_(readScalar(propsDict_.lookup("upperThreshold"))), lowerThreshold_(readScalar(propsDict_.lookup("lowerThreshold"))), - verbose_(propsDict_.found("verbose")) + verbose_(propsDict_.found("verbose")), + writeToFile_(propsDict_.lookupOrDefault("writeToFile",false)), + filePtr_() { + // create the path and output file + if(writeToFile_) + { + fileName path(particleCloud_.IOM().createTimeDir("postProcessing/particleCellVolume")); + filePtr_ = new OFstream(path/"particleCellVolume.txt"); + filePtr_() << "# time | total particle volume in cells | total volume of cells with particles | average volume fraction | min(voidfraction) | max(voidfraction)" << endl; + } } @@ -120,6 +129,8 @@ void particleCellVolume::setForce() const scalar fieldValue=-1; scalar cellVol=-1; + scalar minFieldVal=1e18; + scalar maxFieldVal=-1e18; forAll(field,cellI) { @@ -129,6 +140,8 @@ void particleCellVolume::setForce() const cellVol = mesh_.V()[cellI]; scalarField_[cellI] = (1-fieldValue) * cellVol; scalarField2_[cellI] = cellVol; + minFieldVal = min(minFieldVal, fieldValue); + maxFieldVal = max(maxFieldVal, fieldValue); } else { @@ -138,6 +151,8 @@ void particleCellVolume::setForce() const } scalarField_.ref() = gSum(scalarField_); scalarField2_.ref() = gSum(scalarField2_); + reduce(minFieldVal, minOp()); + reduce(maxFieldVal, maxOp()); if(verbose_) { @@ -147,8 +162,20 @@ void particleCellVolume::setForce() const << ", and > " << lowerThreshold_ << ",\n the total volume of cells holding particles = " << scalarField2_[0] << ",\n this results in an average volume fraction of:" << scalarField_[0]/(scalarField2_[0]+SMALL) + << ",\n the min occurring " << scalarFieldName_ << " is:" << minFieldVal + << ",\n the max occurring " << scalarFieldName_ << " is:" << maxFieldVal << endl; } + + if(writeToFile_) + { + filePtr_() << mesh_.time().value() << " " + << scalarField_[0] << " " + << scalarField2_[0] << " " + << scalarField_[0]/(scalarField2_[0]+SMALL) << " " + << minFieldVal << " " + << maxFieldVal << endl; + } }// end if time >= startTime_ } diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.H b/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.H index b70f5329..f0bf2b94 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.H @@ -74,6 +74,10 @@ private: const Switch verbose_; + const Switch writeToFile_; + + mutable autoPtr filePtr_; + public: //- Runtime type information