ParticleCollector.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "ParticleCollector.H"
27 #include "Pstream.H"
28 #include "surfaceWriter.H"
29 #include "unitConversion.H"
30 #include "Random.H"
31 #include "triangle.H"
32 #include "cloud.H"
33 
34 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35 
36 template<class CloudType>
38 (
39  const faceList& faces,
40  const Field<point>& points,
41  const Field<scalar>& area
42 )
43 {
44  // Create the output file if not already created
45  if (log_)
46  {
47  if (debug)
48  {
49  Info<< "Creating output file" << endl;
50  }
51 
52  if (Pstream::master())
53  {
54  // Create directory if does not exist
55  mkDir(this->outputTimeDir());
56 
57  // Open new file at start up
58  outputFilePtr_.reset
59  (
60  new OFstream(this->outputTimeDir()/(type() + ".dat"))
61  );
62 
63  outputFilePtr_()
64  << "# Source : " << type() << nl
65  << "# Bins : " << faces.size() << nl
66  << "# Total area : " << sum(area) << nl;
67 
68  outputFilePtr_()
69  << "# Geometry :" << nl
70  << '#'
71  << tab << "Bin"
72  << tab << "(Centre_x Centre_y Centre_z)"
73  << tab << "Area"
74  << nl;
75 
76  forAll(faces, i)
77  {
78  outputFilePtr_()
79  << '#'
80  << tab << i
81  << tab << faces[i].centre(points)
82  << tab << area[i]
83  << nl;
84  }
85 
86  outputFilePtr_()
87  << '#' << nl
88  << "# Output format:" << nl;
89 
90  forAll(faces, i)
91  {
92  word id = Foam::name(i);
93  word binId = "bin_" + id;
94 
95  outputFilePtr_()
96  << '#'
97  << tab << "Time"
98  << tab << binId
99  << tab << "mass[" << id << "]"
100  << tab << "massFlowRate[" << id << "]"
101  << endl;
102  }
103  }
104  }
105 }
106 
107 
108 template<class CloudType>
110 (
111  const List<Field<point> >& polygons
112 )
113 {
114  mode_ = mtPolygon;
115 
116  label nPoints = 0;
117  forAll(polygons, polyI)
118  {
119  label np = polygons[polyI].size();
120  if (np < 3)
121  {
122  FatalIOErrorInFunction(this->coeffDict())
123  << "polygons must consist of at least 3 points"
124  << exit(FatalIOError);
125  }
126 
127  nPoints += np;
128  }
129 
130  label pointOffset = 0;
131  points_.setSize(nPoints);
132  faces_.setSize(polygons.size());
133  faceTris_.setSize(polygons.size());
134  area_.setSize(polygons.size());
135  forAll(faces_, faceI)
136  {
137  const Field<point>& polyPoints = polygons[faceI];
138  face f(identity(polyPoints.size()) + pointOffset);
139  UIndirectList<point>(points_, f) = polyPoints;
140  area_[faceI] = f.mag(points_);
141 
142  DynamicList<face> tris;
143  f.triangles(points_, tris);
144  faceTris_[faceI].transfer(tris);
145 
146  faces_[faceI].transfer(f);
147 
148  pointOffset += polyPoints.size();
149  }
150 }
151 
152 
153 template<class CloudType>
155 {
156  mode_ = mtConcentricCircle;
157 
158  vector origin(this->coeffDict().lookup("origin"));
159 
160  radius_ = this->coeffDict().lookup("radius");
161  nSector_ = readLabel(this->coeffDict().lookup("nSector"));
162 
163  label nS = nSector_;
164 
165  vector refDir;
166  if (nSector_ > 1)
167  {
168  refDir = this->coeffDict().lookup("refDir");
169  refDir -= normal_[0]*(normal_[0] & refDir);
170  refDir /= mag(refDir);
171  }
172  else
173  {
174  // set 4 quadrants for single sector cases
175  nS = 4;
176 
177  vector tangent = vector::zero;
178  scalar magTangent = 0.0;
179 
180  Random rnd(1234);
181  while (magTangent < SMALL)
182  {
183  vector v = rnd.vector01();
184 
185  tangent = v - (v & normal_[0])*normal_[0];
186  magTangent = mag(tangent);
187  }
188 
189  refDir = tangent/magTangent;
190  }
191 
192  scalar dTheta = 5.0;
193  scalar dThetaSector = 360.0/scalar(nS);
194  label intervalPerSector = max(1, ceil(dThetaSector/dTheta));
195  dTheta = dThetaSector/scalar(intervalPerSector);
196 
197  label nPointPerSector = intervalPerSector + 1;
198 
199  label nPointPerRadius = nS*(nPointPerSector - 1);
200  label nPoint = radius_.size()*nPointPerRadius;
201  label nFace = radius_.size()*nS;
202 
203  // add origin
204  nPoint++;
205 
206  points_.setSize(nPoint);
207  faces_.setSize(nFace);
208  area_.setSize(nFace);
209 
210  coordSys_ = cylindricalCS("coordSys", origin, normal_[0], refDir, false);
211 
212  List<label> ptIDs(identity(nPointPerRadius));
213 
214  points_[0] = origin;
215 
216  // points
217  forAll(radius_, radI)
218  {
219  label pointOffset = radI*nPointPerRadius + 1;
220 
221  for (label i = 0; i < nPointPerRadius; i++)
222  {
223  label pI = i + pointOffset;
224  point pCyl(radius_[radI], degToRad(i*dTheta), 0.0);
225  points_[pI] = coordSys_.globalPosition(pCyl);
226  }
227  }
228 
229  // faces
230  DynamicList<label> facePts(2*nPointPerSector);
231  forAll(radius_, radI)
232  {
233  if (radI == 0)
234  {
235  for (label secI = 0; secI < nS; secI++)
236  {
237  facePts.clear();
238 
239  // append origin point
240  facePts.append(0);
241 
242  for (label ptI = 0; ptI < nPointPerSector; ptI++)
243  {
244  label i = ptI + secI*(nPointPerSector - 1);
245  label id = ptIDs.fcIndex(i - 1) + 1;
246  facePts.append(id);
247  }
248 
249  label faceI = secI + radI*nS;
250 
251  faces_[faceI] = face(facePts);
252  area_[faceI] = faces_[faceI].mag(points_);
253  }
254  }
255  else
256  {
257  for (label secI = 0; secI < nS; secI++)
258  {
259  facePts.clear();
260 
261  label offset = (radI - 1)*nPointPerRadius + 1;
262 
263  for (label ptI = 0; ptI < nPointPerSector; ptI++)
264  {
265  label i = ptI + secI*(nPointPerSector - 1);
266  label id = offset + ptIDs.fcIndex(i - 1);
267  facePts.append(id);
268  }
269  for (label ptI = nPointPerSector-1; ptI >= 0; ptI--)
270  {
271  label i = ptI + secI*(nPointPerSector - 1);
272  label id = offset + nPointPerRadius + ptIDs.fcIndex(i - 1);
273  facePts.append(id);
274  }
275 
276  label faceI = secI + radI*nS;
277 
278  faces_[faceI] = face(facePts);
279  area_[faceI] = faces_[faceI].mag(points_);
280  }
281  }
282  }
283 }
284 
285 
286 template<class CloudType>
288 (
289  const point& p1,
290  const point& p2
291 ) const
292 {
293  label dummyNearType = -1;
294  label dummyNearLabel = -1;
295 
296  forAll(faces_, faceI)
297  {
298  const label facePoint0 = faces_[faceI][0];
299 
300  const point& pf = points_[facePoint0];
301 
302  const scalar d1 = normal_[faceI] & (p1 - pf);
303  const scalar d2 = normal_[faceI] & (p2 - pf);
304 
305  if (sign(d1) == sign(d2))
306  {
307  // did not cross polygon plane
308  continue;
309  }
310 
311  // intersection point
312  const point pIntersect = p1 + (d1/(d1 - d2))*(p2 - p1);
313 
314  const List<face>& tris = faceTris_[faceI];
315 
316  // identify if point is within poly bounds
317  forAll(tris, triI)
318  {
319  const face& tri = tris[triI];
320  triPointRef t
321  (
322  points_[tri[0]],
323  points_[tri[1]],
324  points_[tri[2]]
325  );
326 
327  if (t.classify(pIntersect, dummyNearType, dummyNearLabel))
328  {
329  hitFaceIDs_.append(faceI);
330  }
331  }
332  }
333 }
334 
335 
336 template<class CloudType>
338 (
339  const point& p1,
340  const point& p2
341 ) const
342 {
343  label secI = -1;
344 
345  const scalar d1 = normal_[0] & (p1 - coordSys_.origin());
346  const scalar d2 = normal_[0] & (p2 - coordSys_.origin());
347 
348  if (sign(d1) == sign(d2))
349  {
350  // did not cross plane
351  return;
352  }
353 
354  // intersection point in cylindrical co-ordinate system
355  const point pCyl = coordSys_.localPosition(p1 + (d1/(d1 - d2))*(p2 - p1));
356 
357  scalar r = pCyl[0];
358 
359  if (r < radius_.last())
360  {
361  label radI = 0;
362  while (r > radius_[radI])
363  {
364  radI++;
365  }
366 
367  if (nSector_ == 1)
368  {
369  secI = 4*radI;
370  }
371  else
372  {
373  scalar theta = pCyl[1] + constant::mathematical::pi;
374 
375  secI =
376  nSector_*radI
377  + floor
378  (
379  scalar(nSector_)*theta/constant::mathematical::twoPi
380  );
381  }
382 
383  hitFaceIDs_.append(secI);
384  }
385 }
386 
387 
388 template<class CloudType>
390 {
391  const fvMesh& mesh = this->owner().mesh();
392  const Time& time = mesh.time();
393  scalar timeNew = time.value();
394  scalar timeElapsed = timeNew - timeOld_;
395 
396  totalTime_ += timeElapsed;
397 
398  const scalar alpha = (totalTime_ - timeElapsed)/totalTime_;
399  const scalar beta = timeElapsed/totalTime_;
400 
401  forAll(faces_, faceI)
402  {
403  massFlowRate_[faceI] =
404  alpha*massFlowRate_[faceI] + beta*mass_[faceI]/timeElapsed;
405  massTotal_[faceI] += mass_[faceI];
406  }
407 
408  const label procI = Pstream::myProcNo();
409 
410  Info<< type() << " output:" << nl;
411 
412  Field<scalar> faceMassTotal(mass_.size(), 0.0);
413  this->getModelProperty("massTotal", faceMassTotal);
414 
415  Field<scalar> faceMassFlowRate(massFlowRate_.size(), 0.0);
416  this->getModelProperty("massFlowRate", faceMassFlowRate);
417 
418 
419  scalar sumTotalMass = 0.0;
420  scalar sumAverageMFR = 0.0;
421  forAll(faces_, faceI)
422  {
423  scalarList allProcMass(Pstream::nProcs());
424  allProcMass[procI] = massTotal_[faceI];
425  Pstream::gatherList(allProcMass);
426  faceMassTotal[faceI] += sum(allProcMass);
427 
428  scalarList allProcMassFlowRate(Pstream::nProcs());
429  allProcMassFlowRate[procI] = massFlowRate_[faceI];
430  Pstream::gatherList(allProcMassFlowRate);
431  faceMassFlowRate[faceI] += sum(allProcMassFlowRate);
432 
433  sumTotalMass += faceMassTotal[faceI];
434  sumAverageMFR += faceMassFlowRate[faceI];
435 
436  if (outputFilePtr_.valid())
437  {
438  outputFilePtr_()
439  << time.timeName()
440  << tab << faceI
441  << tab << faceMassTotal[faceI]
442  << tab << faceMassFlowRate[faceI]
443  << endl;
444  }
445  }
446 
447  Info<< " sum(total mass) = " << sumTotalMass << nl
448  << " sum(average mass flow rate) = " << sumAverageMFR << nl
449  << endl;
450 
451 
452  if (surfaceFormat_ != "none")
453  {
454  if (Pstream::master())
455  {
457  (
459  (
460  surfaceFormat_,
461  this->coeffDict().subOrEmptyDict("formatOptions").
462  subOrEmptyDict(surfaceFormat_)
463  )
464  );
465 
466  writer->write
467  (
468  this->outputTimeDir(),
469  "collector",
470  points_,
471  faces_,
472  "massTotal",
473  faceMassTotal,
474  false
475  );
476 
477  writer->write
478  (
479  this->outputTimeDir(),
480  "collector",
481  points_,
482  faces_,
483  "massFlowRate",
484  faceMassFlowRate,
485  false
486  );
487  }
488  }
489 
490 
491  if (resetOnWrite_)
492  {
493  Field<scalar> dummy(faceMassTotal.size(), 0.0);
494  this->setModelProperty("massTotal", dummy);
495  this->setModelProperty("massFlowRate", dummy);
496 
497  timeOld_ = timeNew;
498  totalTime_ = 0.0;
499  }
500  else
501  {
502  this->setModelProperty("massTotal", faceMassTotal);
503  this->setModelProperty("massFlowRate", faceMassFlowRate);
504  }
505 
506  forAll(faces_, faceI)
507  {
508  mass_[faceI] = 0.0;
509  massTotal_[faceI] = 0.0;
510  massFlowRate_[faceI] = 0.0;
511  }
512 }
513 
514 
515 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
516 
517 template<class CloudType>
519 (
520  const dictionary& dict,
521  CloudType& owner,
522  const word& modelName
523 )
524 :
525  CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
526  mode_(mtUnknown),
527  parcelType_(this->coeffDict().lookupOrDefault("parcelType", -1)),
528  removeCollected_(this->coeffDict().lookup("removeCollected")),
529  points_(),
530  faces_(),
531  faceTris_(),
532  nSector_(0),
533  radius_(),
534  coordSys_(false),
535  normal_(),
536  negateParcelsOppositeNormal_
537  (
538  readBool(this->coeffDict().lookup("negateParcelsOppositeNormal"))
539  ),
540  surfaceFormat_(this->coeffDict().lookup("surfaceFormat")),
541  resetOnWrite_(this->coeffDict().lookup("resetOnWrite")),
542  totalTime_(0.0),
543  mass_(),
544  massTotal_(),
545  massFlowRate_(),
546  log_(this->coeffDict().lookup("log")),
547  outputFilePtr_(),
548  timeOld_(owner.mesh().time().value()),
549  hitFaceIDs_()
550 {
551  normal_ /= mag(normal_);
552 
553  word mode(this->coeffDict().lookup("mode"));
554  if (mode == "polygon")
555  {
556  List<Field<point> > polygons(this->coeffDict().lookup("polygons"));
557 
558  initPolygons(polygons);
559 
560  vector n0(this->coeffDict().lookup("normal"));
561  normal_ = vectorField(faces_.size(), n0);
562  }
563  else if (mode == "polygonWithNormal")
564  {
565  List<Tuple2<Field<point>, vector> > polygonAndNormal
566  (
567  this->coeffDict().lookup("polygons")
568  );
569 
570  List<Field<point> > polygons(polygonAndNormal.size());
571  normal_.setSize(polygonAndNormal.size());
572 
573  forAll(polygons, polyI)
574  {
575  polygons[polyI] = polygonAndNormal[polyI].first();
576  normal_[polyI] = polygonAndNormal[polyI].second();
577  normal_[polyI] /= mag(normal_[polyI]) + ROOTVSMALL;
578  }
579 
580  initPolygons(polygons);
581  }
582  else if (mode == "concentricCircle")
583  {
584  vector n0(this->coeffDict().lookup("normal"));
585  normal_ = vectorField(1, n0);
586 
587  initConcentricCircles();
588  }
589  else
590  {
591  FatalIOErrorInFunction(this->coeffDict())
592  << "Unknown mode " << mode << ". Available options are "
593  << "polygon, polygonWithNormal and concentricCircle"
594  << exit(FatalIOError);
595  }
596 
597  mass_.setSize(faces_.size(), 0.0);
598  massTotal_.setSize(faces_.size(), 0.0);
599  massFlowRate_.setSize(faces_.size(), 0.0);
600 
601  makeLogFile(faces_, points_, area_);
602 }
603 
604 
605 template<class CloudType>
607 (
609 )
610 :
612  mode_(pc.mode_),
613  parcelType_(pc.parcelType_),
614  removeCollected_(pc.removeCollected_),
615  points_(pc.points_),
616  faces_(pc.faces_),
617  faceTris_(pc.faceTris_),
618  nSector_(pc.nSector_),
619  radius_(pc.radius_),
620  coordSys_(pc.coordSys_),
621  normal_(pc.normal_),
622  negateParcelsOppositeNormal_(pc.negateParcelsOppositeNormal_),
623  surfaceFormat_(pc.surfaceFormat_),
624  resetOnWrite_(pc.resetOnWrite_),
625  totalTime_(pc.totalTime_),
626  mass_(pc.mass_),
627  massTotal_(pc.massTotal_),
628  massFlowRate_(pc.massFlowRate_),
629  log_(pc.log_),
630  outputFilePtr_(),
631  timeOld_(0.0),
632  hitFaceIDs_()
633 {}
634 
635 
636 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
637 
638 template<class CloudType>
640 {}
641 
642 
643 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
644 
645 template<class CloudType>
647 (
648  parcelType& p,
649  const label cellI,
650  const scalar dt,
651  const point& position0,
652  bool& keepParticle
653 )
654 {
655  if ((parcelType_ != -1) && (parcelType_ != p.typeId()))
656  {
657  return;
658  }
659 
660  // slightly extend end position to avoid falling within tracking tolerances
661  const point position1 = position0 + 1.0001*(p.position() - position0);
662 
663  hitFaceIDs_.clear();
664 
665  switch (mode_)
666  {
667  case mtPolygon:
668  {
669  collectParcelPolygon(position0, position1);
670  break;
671  }
672  case mtConcentricCircle:
673  {
674  collectParcelConcentricCircles(position0, position1);
675  break;
676  }
677  default:
678  {
679  }
680  }
681 
682 
683  forAll(hitFaceIDs_, i)
684  {
685  label faceI = hitFaceIDs_[i];
686  scalar m = p.nParticle()*p.mass();
687 
688  if (negateParcelsOppositeNormal_)
689  {
690  vector Uhat = p.U();
691  Uhat /= mag(Uhat) + ROOTVSMALL;
692  if ((Uhat & normal_[faceI]) < 0)
693  {
694  m *= -1.0;
695  }
696  }
697 
698  // add mass contribution
699  mass_[faceI] += m;
700 
701  if (nSector_ == 1)
702  {
703  mass_[faceI + 1] += m;
704  mass_[faceI + 2] += m;
705  mass_[faceI + 3] += m;
706  }
707 
708  if (removeCollected_)
709  {
710  keepParticle = false;
711  }
712  }
713 }
714 
715 
716 // ************************************************************************* //
Foam::ParticleCollector::totalTime_
scalar totalTime_
Total time.
Definition: ParticleCollector.H:179
beta
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
Foam::Random
Simple random number generator.
Definition: Random.H:49
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::ParticleCollector::parcelType_
const label parcelType_
Index of parcel types to collect (-1 by default = all particles)
Definition: ParticleCollector.H:134
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::ParticleCollector::~ParticleCollector
virtual ~ParticleCollector()
Destructor.
Definition: ParticleCollector.C:639
Foam::compressible::New
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
Definition: turbulentFluidThermoModel.C:36
Foam::ParticleCollector::ParticleCollector
ParticleCollector(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ParticleCollector.C:519
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
triangle.H
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:56
Foam::ParticleCollector::write
void write()
Write post-processing info.
Definition: ParticleCollector.C:389
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:216
Foam::triangle::classify
bool classify(const point &p, label &nearType, label &nearLabel) const
Classify nearest point to p in triangle plane.
Definition: triangleI.H:684
Foam::ParticleCollector::radius_
List< scalar > radius_
List of radii.
Definition: ParticleCollector.H:157
Foam::writer::write
virtual void write(const coordSet &, const wordList &, const List< const Field< Type > * > &, Ostream &) const =0
General entry point for writing.
cloud.H
unitConversion.H
Unit conversion functions.
Foam::FatalIOError
IOerror FatalIOError
Foam::ParticleCollector::parcelType
CloudType::parcelType parcelType
Convenience typedef for parcel type.
Definition: ParticleCollector.H:128
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::cylindricalCS
Cylindrical coordinate system.
Definition: cylindricalCS.H:48
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:261
Foam::ParticleCollector::initConcentricCircles
void initConcentricCircles()
Initialise concentric circle collectors.
Definition: ParticleCollector.C:154
Foam::constant::mathematical::twoPi
const scalar twoPi(2 *pi)
surfaceWriter.H
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::sign
dimensionedScalar sign(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:179
Foam::mode
mode_t mode(const fileName &)
Return the file mode.
Definition: POSIX.C:573
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::ParticleCollector::massFlowRate_
List< scalar > massFlowRate_
Mass flow rate storage.
Definition: ParticleCollector.H:188
Foam::triangle
A triangle primitive used to calculate face normals and swept volumes.
Definition: triangle.H:59
Foam::ParticleCollector::nSector_
label nSector_
Number of sectors per circle.
Definition: ParticleCollector.H:154
Foam::ParticleCollector::surfaceFormat_
const word surfaceFormat_
Surface output format.
Definition: ParticleCollector.H:173
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::ParticleCollector::makeLogFile
void makeLogFile(const faceList &faces, const Field< point > &points, const Field< scalar > &area)
Helper function to create log files.
Definition: ParticleCollector.C:38
Foam::Field< point >
Foam::DSMCCloud::mesh
const fvMesh & mesh() const
Return refernce to the mesh.
Definition: DSMCCloudI.H:41
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::ParticleCollector::coordSys_
cylindricalCS coordSys_
Cylindrical co-ordinate system.
Definition: ParticleCollector.H:160
Foam::DynamicList::clear
void clear()
Clear the addressed list, i.e. set the size to zero.
Definition: DynamicListI.H:242
Foam::ParticleCollector::log_
Switch log_
Flag to indicate whether data should be written to file.
Definition: ParticleCollector.H:191
vectorField
volVectorField vectorField(fieldObject, mesh)
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::ParticleCollector::negateParcelsOppositeNormal_
bool negateParcelsOppositeNormal_
Remove mass of parcel travelling in opposite direction to normal_.
Definition: ParticleCollector.H:170
Foam::identity
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
dict
dictionary dict
Definition: searchingEngine.H:14
ParticleCollector.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::ParticleCollector::massTotal_
List< scalar > massTotal_
Mass total storage.
Definition: ParticleCollector.H:185
Foam::ParticleCollector::resetOnWrite_
Switch resetOnWrite_
Flag to indicate whether data should be reset/cleared on writing.
Definition: ParticleCollector.H:176
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::writer
Base class for graphics format writing. Entry points are.
Definition: writer.H:78
Pstream.H
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::Random::vector01
vector vector01()
Vector with every component scalar01.
Definition: Random.C:73
Random.H
Foam::DynamicList::append
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::OFstream
Output to file stream.
Definition: OFstream.H:81
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::ParticleCollector::mode_
modeType mode_
Collector mode type.
Definition: ParticleCollector.H:131
Foam::tab
static const char tab
Definition: Ostream.H:259
f
labelList f(nPoints)
Foam::Vector< scalar >
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::ParticleCollector::points_
Field< point > points_
List of points.
Definition: ParticleCollector.H:140
Foam::CloudFunctionObject
Templated cloud function object base class.
Definition: CloudFunctionObject.H:56
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:333
Foam::readLabel
label readLabel(Istream &is)
Definition: label.H:64
Foam::ParticleCollector::initPolygons
void initPolygons(const List< Field< point > > &polygons)
Initialise polygon collectors.
Definition: ParticleCollector.C:110
Foam::constant::mathematical::pi
const scalar pi(M_PI)
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Foam::UIndirectList
A List with indirect addressing.
Definition: fvMatrix.H:106
Foam::ParticleCollector
Function object to collect the parcel mass- and mass flow rate over a set of polygons....
Definition: ParticleCollector.H:107
Foam::ParticleCollector::collectParcelPolygon
void collectParcelPolygon(const point &p1, const point &p2) const
Collect parcels in polygon collectors.
Definition: ParticleCollector.C:288
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:330
Foam::ParticleCollector::postMove
virtual void postMove(parcelType &p, const label cellI, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
Definition: ParticleCollector.C:647
Foam::readBool
bool readBool(Istream &)
Definition: boolIO.C:60
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::ParticleCollector::faceTris_
List< List< face > > faceTris_
Triangulation of faces.
Definition: ParticleCollector.H:149
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::ParticleCollector::mass_
List< scalar > mass_
Mass storage.
Definition: ParticleCollector.H:182
Foam::ParticleCollector::collectParcelConcentricCircles
void collectParcelConcentricCircles(const point &p1, const point &p2) const
Collect parcels in concentric circle collectors.
Definition: ParticleCollector.C:338
Foam::mkDir
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:419
Foam::ParticleCollector::normal_
Field< vector > normal_
Polygon normal vector per face.
Definition: ParticleCollector.H:167
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::ParticleCollector::removeCollected_
Switch removeCollected_
Flag to remove collected particles.
Definition: ParticleCollector.H:137
Foam::ParticleCollector::faces_
List< face > faces_
List of faces.
Definition: ParticleCollector.H:143
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress
Foam::degToRad
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Definition: unitConversion.H:45