From 014f7a0891c9edd4a1b28fe5fdad06cd9bfc22f0 Mon Sep 17 00:00:00 2001
From: william <william>
Date: Fri, 20 Dec 2013 16:38:20 +0000
Subject: [PATCH] ENH: added packed particle number info to MPPIC Cloud

---
 .../clouds/Templates/MPPICCloud/MPPICCloud.C  | 31 ++++++++++++-------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C
index f22cac7b0ff..eb436471ea5 100644
--- a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C
@@ -273,26 +273,33 @@ void Foam::MPPICCloud<CloudType>::info()
 
     tmp<volScalarField> alpha = this->theta();
 
-    Info<< "    Min cell volume fraction        = "
-        << gMin(alpha().internalField()) << endl;
-    Info<< "    Max cell volume fraction        = "
-        << gMax(alpha().internalField()) << endl;
+    const scalar alphaMin = gMin(alpha().internalField());
+    const scalar alphaMax = gMax(alpha().internalField());
 
-    label nOutside = 0;
+    Info<< "    Min cell volume fraction        = " << alphaMin << endl;
+    Info<< "    Max cell volume fraction        = " << alphaMax << endl;
 
-    forAllIter(typename CloudType, *this, iter)
+    if (alphaMax < SMALL)
     {
-        typename CloudType::parcelType& p = iter();
-        const tetIndices tetIs(p.cell(), p.tetFace(), p.tetPt(), this->mesh());
-        nOutside += !tetIs.tet(this->mesh()).inside(p.position());
+        return;
     }
 
-    reduce(nOutside, plusOp<label>());
+    scalar nMin = GREAT;
 
-    if (nOutside > 0)
+    forAll(this->mesh().cells(), cellI)
     {
-        Info<< "    Number of parcels outside tets  = " << nOutside << endl;
+        const label n = this->cellOccupancy()[cellI].size();
+        const scalar nPack = n*alphaMax/alpha()[cellI];
+
+        if (n > 0 && nPack < nMin)
+        {
+            nMin = nPack;
+        }
     }
+
+    reduce(nMin, minOp<scalar>());
+
+    Info<< "    Min dense number of parcels     = " << nMin << endl;
 }
 
 
-- 
GitLab