regionSizeDistribution.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
6  \\/ M anipulation |
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 "regionSizeDistribution.H"
27 #include "fvcVolumeIntegrate.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  namespace functionObjects
35  {
36  defineTypeNameAndDebug(regionSizeDistribution, 0);
37 
39  (
40  functionObject,
41  regionSizeDistribution,
42  dictionary
43  );
44  }
45 
46  //- Plus op for FixedList<scalar>
47  template<class T, unsigned Size>
49  {
50  public:
51  void operator()
52  (
54  const FixedList<T, Size>& y
55  ) const
56  {
57  forAll(x, i)
58  {
59  x[i] += y[i];
60  }
61  }
62  };
63 }
64 
65 
66 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
67 
68 void Foam::functionObjects::regionSizeDistribution::writeAlphaFields
69 (
70  const regionSplit& regions,
71  const Map<label>& patchRegions,
72  const Map<scalar>& regionVolume,
73  const volScalarField& alpha
74 ) const
75 {
76  const scalar maxDropletVol = 1.0/6.0*pow(maxDiam_, 3);
77 
78  // Split alpha field
79  // ~~~~~~~~~~~~~~~~~
80  // Split into
81  // - liquidCore : region connected to inlet patches
82  // - per region a volume : for all other regions
83  // - backgroundAlpha : remaining alpha
84 
85 
86  // Construct field
87  volScalarField liquidCore
88  (
89  IOobject
90  (
91  alphaName_ + "_liquidCore",
92  obr_.time().timeName(),
93  obr_,
95  ),
96  alpha,
98  );
99 
100  volScalarField backgroundAlpha
101  (
102  IOobject
103  (
104  alphaName_ + "_background",
105  obr_.time().timeName(),
106  obr_,
108  ),
109  alpha,
111  );
112 
113 
114  // Knock out any cell not in patchRegions
115  forAll(liquidCore, celli)
116  {
117  label regionI = regions[celli];
118  if (patchRegions.found(regionI))
119  {
120  backgroundAlpha[celli] = 0;
121  }
122  else
123  {
124  liquidCore[celli] = 0;
125 
126  scalar regionVol = regionVolume[regionI];
127  if (regionVol < maxDropletVol)
128  {
129  backgroundAlpha[celli] = 0;
130  }
131  }
132  }
133  liquidCore.correctBoundaryConditions();
134  backgroundAlpha.correctBoundaryConditions();
135 
136  Info<< " Volume of liquid-core = "
137  << fvc::domainIntegrate(liquidCore).value()
138  << endl;
139  Info<< " Volume of background = "
140  << fvc::domainIntegrate(backgroundAlpha).value()
141  << endl;
142 
143  Info<< " Writing liquid-core field to " << liquidCore.name() << endl;
144  liquidCore.write();
145  Info<< " Writing background field to " << backgroundAlpha.name() << endl;
146  backgroundAlpha.write();
147 }
148 
149 
151 Foam::functionObjects::regionSizeDistribution::findPatchRegions
152 (
153  const regionSplit& regions
154 ) const
155 {
156  // Mark all regions starting at patches
157  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158 
159  // Count number of patch faces (just for initial sizing)
160  const labelHashSet patchIDs(mesh_.boundaryMesh().patchSet(patchNames_));
161 
162  label nPatchFaces = 0;
163  forAllConstIter(labelHashSet, patchIDs, iter)
164  {
165  nPatchFaces += mesh_.boundaryMesh()[iter.key()].size();
166  }
167 
168 
169  Map<label> patchRegions(nPatchFaces);
170  forAllConstIter(labelHashSet, patchIDs, iter)
171  {
172  const polyPatch& pp = mesh_.boundaryMesh()[iter.key()];
173 
174  // Collect all regions on the patch
175  const labelList& faceCells = pp.faceCells();
176 
177  forAll(faceCells, i)
178  {
179  patchRegions.insert
180  (
181  regions[faceCells[i]],
182  Pstream::myProcNo() // dummy value
183  );
184  }
185  }
186 
187 
188  // Make sure all the processors have the same set of regions
189  Pstream::mapCombineGather(patchRegions, minEqOp<label>());
190  Pstream::mapCombineScatter(patchRegions);
191 
192  return patchRegions;
193 }
194 
195 
196 template<class Type>
198 Foam::functionObjects::regionSizeDistribution::divide
199 (
200  const Field<Type>& num,
201  const scalarField& denom
202 )
203 {
204  tmp<Field<Type>> tresult(new Field<Type>(num.size()));
205  Field<Type>& result = tresult.ref();
206 
207  forAll(denom, i)
208  {
209  if (denom[i] != 0)
210  {
211  result[i] = num[i]/denom[i];
212  }
213  else
214  {
215  result[i] = Zero;
216  }
217  }
218 
219  return tresult;
220 }
221 
222 
223 template<class Type>
224 void Foam::functionObjects::regionSizeDistribution::generateFields
225 (
226  const word& fieldName, // name of field
227  const labelList& indices, // index of bin for each region
228  const Field<Type>& sortedField, // per region field data
229  const scalarField& binCount, // per bin number of regions
230  wordList& fieldNames,
231  PtrList<Field<Type>>& fields
232 ) const
233 {
234  if (Pstream::master())
235  {
236  // Calculate per-bin sum
237  Field<Type> binSum(nBins_, Zero);
238  forAll(sortedField, i)
239  {
240  binSum[indices[i]] += sortedField[i];
241  }
242 
243  // Calculate per-bin average
244  Field<Type> binAvg(divide(binSum, binCount));
245 
246  // Append
247  fields.setSize(fieldNames.size());
248  fieldNames.append(fieldName + "_sum");
249  fields.append(binSum);
250  fieldNames.append(fieldName + "_avg");
251  fields.append(binAvg);
252  }
253 }
254 
255 
256 void Foam::functionObjects::regionSizeDistribution::generateFields
257 (
258  const word& fieldName, // name of field
259  const labelList& indices, // index of bin for each region
260  const scalarField& sortedField, // per region field data
261  const scalarField& binCount, // per bin number of regions
262  wordList& fieldNames,
263  PtrList<scalarField>& fields
264 ) const
265 {
266  if (Pstream::master())
267  {
268  // Calculate per-bin sum
269  scalarField binSum(nBins_, Zero);
270  forAll(sortedField, i)
271  {
272  binSum[indices[i]] += sortedField[i];
273  }
274 
275  // Calculate per-bin average
276  scalarField binAvg(divide(binSum, binCount));
277 
278  // Calculate per-bin deviation
279  scalarField binSqrSum(nBins_, Zero);
280  forAll(sortedField, i)
281  {
282  binSqrSum[indices[i]] += Foam::sqr(sortedField[i]);
283  }
284  scalarField binDev
285  (
286  sqrt(divide(binSqrSum, binCount) - Foam::sqr(binAvg))
287  );
288 
289  // Append
290  fields.setSize(fieldNames.size());
291  fieldNames.append(fieldName + "_sum");
292  fields.append(binSum);
293  fieldNames.append(fieldName + "_avg");
294  fields.append(binAvg);
295  fieldNames.append(fieldName + "_dev");
296  fields.append(binDev);
297  }
298 }
299 
300 
301 template<class Type>
302 void Foam::functionObjects::regionSizeDistribution::generateFields
303 (
304  const word& fieldName, // name of field
305  const Field<Type>& cellField, // per cell field data
306  const regionSplit& regions, // per cell the region(=droplet)
307  const labelList& sortedRegions, // valid regions in sorted order
308  const scalarField& sortedNormalisation,
309  const labelList& indices, // index of bin for each region
310  const scalarField& binCount, // per bin number of regions
311  wordList& fieldNames,
312  PtrList<Field<Type>>& fields
313 ) const
314 {
315  // Sum on a per-region basis. Parallel reduced.
316  Map<Type> regionField(regionSum(regions, cellField));
317 
318  // Extract in region order
319  Field<Type> sortedField
320  (
321  sortedNormalisation*extractData(sortedRegions, regionField)
322  );
323 
324  // Generate fields
325  generateFields
326  (
327  fieldName, // name of field
328  indices, // index of bin for each region
329  sortedField, // per region field data
330  binCount, // per bin number of regions
331  fieldNames,
332  fields
333  );
334 }
335 
336 
337 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
338 
340 (
341  const word& name,
342  const Time& runTime,
343  const dictionary& dict
344 )
345 :
346  fvMeshFunctionObject(name, runTime, dict),
347  file_(obr_, name),
348  alphaName_(dict.lookup("alpha")),
349  patchNames_(dict.lookup("patches"))
350 {
351  read(dict);
352 }
353 
354 
355 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
356 
358 {}
359 
360 
361 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
362 
364 {
365  dict.lookup("alpha") >> alphaName_;
366  dict.lookup("patches") >> patchNames_;
367  dict.lookup("threshold") >> threshold_;
368  dict.lookup("maxDiameter") >> maxDiam_;
369  minDiam_ = 0.0;
370  dict.readIfPresent("minDiameter", minDiam_);
371  dict.lookup("nBins") >> nBins_;
372  dict.lookup("fields") >> fields_;
373 
374  formatterPtr_ = setWriter::New(dict.lookup("setFormat"), dict);
375 
376  return true;
377 }
378 
379 
381 {
382  wordList fields(fields_);
383  fields.append(alphaName_);
384  return fields;
385 }
386 
387 
389 {
390  return true;
391 }
392 
393 
395 {
396  Info<< type() << " " << name() << " write:" << nl;
397 
398  autoPtr<volScalarField> alphaPtr;
399  if (obr_.foundObject<volScalarField>(alphaName_))
400  {
401  Info<< " Looking up field " << alphaName_ << endl;
402  }
403  else
404  {
405  Info<< " Reading field " << alphaName_ << endl;
406  alphaPtr.reset
407  (
408  new volScalarField
409  (
410  IOobject
411  (
412  alphaName_,
413  mesh_.time().timeName(),
414  mesh_,
417  ),
418  mesh_
419  )
420  );
421  }
422 
423 
424  const volScalarField& alpha =
425  (
426  alphaPtr.valid()
427  ? alphaPtr()
428  : obr_.lookupObject<volScalarField>(alphaName_)
429  );
430 
431  Info<< " Volume of alpha = "
432  << fvc::domainIntegrate(alpha).value()
433  << endl;
434 
435  const scalar meshVol = gSum(mesh_.V());
436  const scalar maxDropletVol = 1.0/6.0*pow(maxDiam_, 3);
437  const scalar delta = (maxDiam_-minDiam_)/nBins_;
438 
439  Info<< " Mesh volume = " << meshVol << endl;
440  Info<< " Maximum droplet diameter = " << maxDiam_ << endl;
441  Info<< " Maximum droplet volume = " << maxDropletVol << endl;
442 
443 
444  // Determine blocked faces
445  boolList blockedFace(mesh_.nFaces(), false);
446  label nBlocked = 0;
447 
448  {
449  for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
450  {
451  scalar ownVal = alpha[mesh_.faceOwner()[facei]];
452  scalar neiVal = alpha[mesh_.faceNeighbour()[facei]];
453 
454  if
455  (
456  (ownVal < threshold_ && neiVal > threshold_)
457  || (ownVal > threshold_ && neiVal < threshold_)
458  )
459  {
460  blockedFace[facei] = true;
461  nBlocked++;
462  }
463  }
464 
465  // Block coupled faces
466  forAll(alpha.boundaryField(), patchi)
467  {
468  const fvPatchScalarField& fvp = alpha.boundaryField()[patchi];
469  if (fvp.coupled())
470  {
471  tmp<scalarField> townFld(fvp.patchInternalField());
472  const scalarField& ownFld = townFld();
473  tmp<scalarField> tnbrFld(fvp.patchNeighbourField());
474  const scalarField& nbrFld = tnbrFld();
475 
476  label start = fvp.patch().patch().start();
477 
478  forAll(ownFld, i)
479  {
480  scalar ownVal = ownFld[i];
481  scalar neiVal = nbrFld[i];
482 
483  if
484  (
485  (ownVal < threshold_ && neiVal > threshold_)
486  || (ownVal > threshold_ && neiVal < threshold_)
487  )
488  {
489  blockedFace[start+i] = true;
490  nBlocked++;
491  }
492  }
493  }
494  }
495  }
496 
497 
498  regionSplit regions(mesh_, blockedFace);
499 
500  Info<< " Determined " << regions.nRegions()
501  << " disconnected regions" << endl;
502 
503 
504  if (debug)
505  {
506  volScalarField region
507  (
508  IOobject
509  (
510  "region",
511  mesh_.time().timeName(),
512  mesh_,
515  ),
516  mesh_,
518  );
519  Info<< " Dumping region as volScalarField to " << region.name()
520  << endl;
521 
522  forAll(regions, celli)
523  {
524  region[celli] = regions[celli];
525  }
526  region.correctBoundaryConditions();
527  region.write();
528  }
529 
530 
531  // Determine regions connected to supplied patches
532  Map<label> patchRegions(findPatchRegions(regions));
533 
534 
535  // Sum all regions
536  const scalarField alphaVol(alpha.primitiveField()*mesh_.V());
537  Map<scalar> allRegionVolume(regionSum(regions, mesh_.V()));
538  Map<scalar> allRegionAlphaVolume(regionSum(regions, alphaVol));
539  Map<label> allRegionNumCells
540  (
541  regionSum
542  (
543  regions,
544  labelField(mesh_.nCells(), 1.0)
545  )
546  );
547 
548  if (debug)
549  {
550  Info<< " " << tab << "Region"
551  << tab << "Volume(mesh)"
552  << tab << "Volume(" << alpha.name() << "):"
553  << tab << "nCells"
554  << endl;
555  scalar meshSumVol = 0.0;
556  scalar alphaSumVol = 0.0;
557  label nCells = 0;
558 
559  Map<scalar>::const_iterator vIter = allRegionVolume.begin();
560  Map<scalar>::const_iterator aIter = allRegionAlphaVolume.begin();
561  Map<label>::const_iterator numIter = allRegionNumCells.begin();
562  for
563  (
564  ;
565  vIter != allRegionVolume.end()
566  && aIter != allRegionAlphaVolume.end();
567  ++vIter, ++aIter, ++numIter
568  )
569  {
570  Info<< " " << tab << vIter.key()
571  << tab << vIter()
572  << tab << aIter()
573  << tab << numIter()
574  << endl;
575 
576  meshSumVol += vIter();
577  alphaSumVol += aIter();
578  nCells += numIter();
579  }
580  Info<< " " << tab << "Total:"
581  << tab << meshSumVol
582  << tab << alphaSumVol
583  << tab << nCells
584  << endl;
585  Info<< endl;
586  }
587 
588 
589 
590 
591  {
592  Info<< " Patch connected regions (liquid core):" << endl;
593  Info<< tab << " Region"
594  << tab << "Volume(mesh)"
595  << tab << "Volume(" << alpha.name() << "):"
596  << endl;
597  forAllConstIter(Map<label>, patchRegions, iter)
598  {
599  label regionI = iter.key();
600  Info<< " " << tab << iter.key()
601  << tab << allRegionVolume[regionI]
602  << tab << allRegionAlphaVolume[regionI] << endl;
603 
604  }
605  Info<< endl;
606  }
607 
608  {
609  Info<< " Background regions:" << endl;
610  Info<< " " << tab << "Region"
611  << tab << "Volume(mesh)"
612  << tab << "Volume(" << alpha.name() << "):"
613  << endl;
614  Map<scalar>::const_iterator vIter = allRegionVolume.begin();
615  Map<scalar>::const_iterator aIter = allRegionAlphaVolume.begin();
616 
617  for
618  (
619  ;
620  vIter != allRegionVolume.end()
621  && aIter != allRegionAlphaVolume.end();
622  ++vIter, ++aIter
623  )
624  {
625  if
626  (
627  !patchRegions.found(vIter.key())
628  && vIter() >= maxDropletVol
629  )
630  {
631  Info<< " " << tab << vIter.key()
632  << tab << vIter()
633  << tab << aIter() << endl;
634  }
635  }
636  Info<< endl;
637  }
638 
639 
640 
641  // Split alpha field
642  // ~~~~~~~~~~~~~~~~~
643  // Split into
644  // - liquidCore : region connected to inlet patches
645  // - per region a volume : for all other regions
646  // - backgroundAlpha : remaining alpha
647  writeAlphaFields(regions, patchRegions, allRegionVolume, alpha);
648 
649 
650  // Extract droplet-only allRegionVolume, i.e. delete liquid core
651  // (patchRegions) and background regions from maps.
652  // Note that we have to use mesh volume (allRegionVolume) and not
653  // allRegionAlphaVolume since background might not have alpha in it.
654  forAllIter(Map<scalar>, allRegionVolume, vIter)
655  {
656  label regionI = vIter.key();
657  if
658  (
659  patchRegions.found(regionI)
660  || vIter() >= maxDropletVol
661  )
662  {
663  allRegionVolume.erase(vIter);
664  allRegionAlphaVolume.erase(regionI);
665  allRegionNumCells.erase(regionI);
666  }
667  }
668 
669  if (allRegionVolume.size())
670  {
671  // Construct mids of bins for plotting
672  scalarField xBin(nBins_);
673  scalar x = 0.5*delta;
674  forAll(xBin, i)
675  {
676  xBin[i] = x;
677  x += delta;
678  }
679 
680  // Get in region order the alpha*volume and diameter
681  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
682 
683  const labelList sortedRegions = allRegionAlphaVolume.sortedToc();
684 
685  scalarField sortedVols
686  (
687  extractData
688  (
689  sortedRegions,
690  allRegionAlphaVolume
691  )
692  );
693 
694  // Calculate the diameters
695  scalarField sortedDiameters(sortedVols.size());
696  forAll(sortedDiameters, i)
697  {
698  sortedDiameters[i] = Foam::cbrt
699  (
700  sortedVols[i]
702  );
703  }
704 
705  // Determine the bin index for all the diameters
706  labelList indices(sortedDiameters.size());
707  forAll(sortedDiameters, i)
708  {
709  indices[i] = (sortedDiameters[i]-minDiam_)/delta;
710  }
711 
712  // Calculate the counts per diameter bin
713  scalarField binCount(nBins_, 0.0);
714  forAll(sortedDiameters, i)
715  {
716  binCount[indices[i]] += 1.0;
717  }
718 
719  // Write to log
720  {
721  Info<< " Bins:" << endl;
722  Info<< " " << tab << "Bin"
723  << tab << "Min diameter"
724  << tab << "Count:"
725  << endl;
726 
727  scalar diam = 0.0;
728  forAll(binCount, binI)
729  {
730  Info<< " " << tab << binI
731  << tab << diam
732  << tab << binCount[binI] << endl;
733  diam += delta;
734  }
735  Info<< endl;
736  }
737 
738  // Declare fields and field names
740  #define DeclareTypeFields(Type, nullArg) \
741  PtrList<Field<Type>> Type##Fields;
743  #undef DeclareTypeFields
744 
745  // Add the bin count
746  fieldNames.append("binCount");
747  #define TypeFieldsAppend(Type, nullArg) \
748  appendFields(binCount, Type##Fields);
749  #undef TypeFieldsAppend
750 
751  // Add the volumes
752  generateFields
753  (
754  "volume",
755  indices,
756  sortedVols,
757  binCount,
758  fieldNames,
759  scalarFields
760  );
761 
762  // Add other sampled fields
763  forAll(fields_, fieldi)
764  {
765  bool found = false;
766 
767  #define GenerateTypeFields(Type, nullArg) \
768  \
769  if (obr_.foundObject<VolField<Type>>(fields_[fieldi])) \
770  { \
771  found = true; \
772  \
773  const VolField<Type>& field = \
774  obr_.lookupObject<VolField<Type>>(fields_[fieldi]); \
775  \
776  generateFields \
777  ( \
778  fields_[fieldi], \
779  (alphaVol*field)(), \
780  regions, \
781  sortedRegions, \
782  1.0/sortedVols, \
783  indices, \
784  binCount, \
785  fieldNames, \
786  Type##Fields \
787  ); \
788  }
790  #undef GenerateTypeFields
791 
792  if (!found) cannotFindObject(fields_[fieldi]);
793  }
794 
795  // Expand all field lists
796  #define TypeFieldsExpand(Type, nullArg) \
797  Type##Fields.setSize(fieldNames.size());
799  #undef TypeFieldsAppend
800 
801  // Write
802  formatterPtr_().write
803  (
804  file_.baseTimeDir(),
805  typeName,
806  coordSet(true, "diameter", xBin),
807  fieldNames
808  #define TypeFieldsParameter(Type, nullArg) , Type##Fields
810  #undef TypeFieldsParameter
811  );
812  }
813 
814  return true;
815 }
816 
817 
818 // ************************************************************************* //
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
Definition: setWriter.C:279
#define TypeFieldsExpand(Type, nullArg)
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
scalar delta
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
Definition: regionSplit.H:116
void append(T *)
Append an element at the end of the list.
Definition: PtrListI.H:39
dictionary dict
Field< label > labelField
Specialisation of Field<T> for label.
Definition: labelField.H:49
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
virtual bool write()
Calculate the regionSizeDistribution and write.
virtual Ostream & write(const char)=0
Write character.
const word & name() const
Return name.
Definition: IOobject.H:315
An STL-conforming const_iterator.
Definition: HashTable.H:481
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
Definition: autoPtrI.H:114
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
Definition: HashTable.H:112
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:54
static const char tab
Definition: Ostream.H:259
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
const Boundary & boundaryField() const
Return const-reference to the boundary field.
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: polyPatch.C:297
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:459
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:429
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Plus op for FixedList<scalar>
static bool master(const label communicator=0)
Am I the master process.
Definition: UPstream.H:423
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
const dimensionSet dimless
#define TypeFieldsParameter(Type, nullArg)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
regionSizeDistribution(const word &name, const Time &runTime, const dictionary &)
Construct for given objectRegistry and dictionary.
Macros for easy insertion into run-time selection tables.
static List< word > fieldNames
Definition: globalFoam.H:46
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
Definition: HashTable.C:371
static void mapCombineScatter(const List< commsStruct > &comms, Container &Values, const int tag, const label comm)
Scatter data. Reverse of combineGather.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
virtual wordList fields() const
Return the list of fields required.
scalar y
bool read(const char *, int32_t &)
Definition: int32IO.C:85
const Key & key() const
Return the Key corresponding to the iterator.
Definition: HashTableI.H:254
Holds list of sampling positions.
Definition: coordSet.H:50
Type gSum(const FieldField< Field, Type > &f)
const labelUList & faceCells() const
Return face-cell addressing.
Definition: polyPatch.C:340
bool found(const Key &) const
Return true if hashedEntry is found in table.
Definition: HashTable.C:113
Pre-declare SubField and related Field type.
Definition: Field.H:56
A class for handling words, derived from string.
Definition: word.H:59
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:139
void append(const T &)
Append an element at the end of the list.
Definition: ListI.H:178
dimensionedScalar cbrt(const dimensionedScalar &ds)
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
virtual bool coupled() const
Return true if this patch field is coupled.
Definition: fvPatchField.H:323
Volume integrate volField creating a volField.
static const zero Zero
Definition: zero.H:97
static void mapCombineGather(const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm)
iterator begin()
Iterator set to the beginning of the HashTable.
Definition: HashTableI.H:411
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
Definition: autoPtrI.H:83
virtual bool read(const dictionary &)
Read the regionSizeDistribution data.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:131
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:351
#define DeclareTypeFields(Type, nullArg)
static const char nl
Definition: Ostream.H:260
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Definition: fvPatchField.C:174
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
defineTypeNameAndDebug(Qdot, 0)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Info<< "Reading field p_rgh\"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);pressureReference pressureReference(p, p_rgh, pimple.dict(), thermo.incompressible());mesh.schemes().setFluxRequired(p_rgh.name());hydrostaticInitialisation(p_rgh, p, rho, U, gh, ghf, pRef, thermo, pimple.dict());Info<< "Creating field dpdt\"<< endl;volScalarField dpdt(IOobject("dpdt", runTime.timeName(), mesh), mesh, dimensionedScalar(p.dimensions()/dimTime, 0));Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));dimensionedScalar initialMass=fvc::domainIntegrate(rho);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:131
label patchi
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
List< label > sortedToc() const
Return the table of contents as a sorted list.
Definition: HashTable.C:217
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:306
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
label nRegions() const
Return total number of regions.
Definition: regionSplit.H:198
messageStream Info
FOR_ALL_FIELD_TYPES(DefineFvWallInfoType)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for managing temporary objects.
Definition: PtrList.H:53
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
#define GenerateTypeFields(Type, nullArg)
virtual tmp< Field< Type > > patchNeighbourField(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking) const
Return patchField on the opposite patch of a coupled patch.
Definition: fvPatchField.H:433
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
bool found
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864