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-2026 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  {
37 
39  (
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  time_.name(),
93  obr_,
95  ),
96  alpha,
98  );
99 
100  volScalarField backgroundAlpha
101  (
102  IOobject
103  (
104  alphaName_ + "_background",
105  time_.name(),
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<< indent << "Volume of liquid-core = "
137  << fvc::domainIntegrate(liquidCore).value()
138  << endl;
139  Info<< indent << "Volume of background = "
140  << fvc::domainIntegrate(backgroundAlpha).value()
141  << endl;
142 
143  Info<< indent
144  << "Writing liquid-core field to " << liquidCore.name() << endl;
145  liquidCore.write();
146  Info<< indent
147  << "Writing background field to " << backgroundAlpha.name() << endl;
148  backgroundAlpha.write();
149 }
150 
151 
153 Foam::functionObjects::regionSizeDistribution::findPatchRegions
154 (
155  const regionSplit& regions
156 ) const
157 {
158  // Mark all regions starting at patches
159  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160 
161  // Count number of patch faces (just for initial sizing)
162  const labelHashSet patchIDs(mesh_.poly().boundary().patchSet(patchNames_));
163 
164  label nPatchFaces = 0;
165  forAllConstIter(labelHashSet, patchIDs, iter)
166  {
167  nPatchFaces += mesh_.poly().boundary()[iter.key()].size();
168  }
169 
170 
171  Map<label> patchRegions(nPatchFaces);
172  forAllConstIter(labelHashSet, patchIDs, iter)
173  {
174  const polyPatch& pp = mesh_.poly().boundary()[iter.key()];
175 
176  // Collect all regions on the patch
177  const labelList& faceCells = pp.faceCells();
178 
179  forAll(faceCells, i)
180  {
181  patchRegions.insert
182  (
183  regions[faceCells[i]],
184  Pstream::myProcNo() // dummy value
185  );
186  }
187  }
188 
189 
190  // Make sure all the processors have the same set of regions
191  Pstream::mapCombineGather(patchRegions, minEqOp<label>());
192  Pstream::mapCombineScatter(patchRegions);
193 
194  return patchRegions;
195 }
196 
197 
198 template<class Type>
200 Foam::functionObjects::regionSizeDistribution::divide
201 (
202  const Field<Type>& num,
203  const scalarField& denom
204 )
205 {
206  tmp<Field<Type>> tresult(new Field<Type>(num.size()));
207  Field<Type>& result = tresult.ref();
208 
209  forAll(denom, i)
210  {
211  if (denom[i] != 0)
212  {
213  result[i] = num[i]/denom[i];
214  }
215  else
216  {
217  result[i] = Zero;
218  }
219  }
220 
221  return tresult;
222 }
223 
224 
225 template<class Type>
226 void Foam::functionObjects::regionSizeDistribution::generateFields
227 (
228  const word& fieldName, // name of field
229  const labelList& indices, // index of bin for each region
230  const Field<Type>& sortedField, // per region field data
231  const scalarField& binCount, // per bin number of regions
234 ) const
235 {
236  if (Pstream::master())
237  {
238  // Calculate per-bin sum
239  Field<Type> binSum(nBins_, Zero);
240  forAll(sortedField, i)
241  {
242  binSum[indices[i]] += sortedField[i];
243  }
244 
245  // Calculate per-bin average
246  Field<Type> binAvg(divide(binSum, binCount));
247 
248  // Append
249  fields.setSize(fieldNames.size());
250  fieldNames.append(fieldName + "_sum");
251  fields.append(binSum);
252  fieldNames.append(fieldName + "_avg");
253  fields.append(binAvg);
254  }
255 }
256 
257 
258 void Foam::functionObjects::regionSizeDistribution::generateFields
259 (
260  const word& fieldName, // name of field
261  const labelList& indices, // index of bin for each region
262  const scalarField& sortedField, // per region field data
263  const scalarField& binCount, // per bin number of regions
265  PtrList<scalarField>& fields
266 ) const
267 {
268  if (Pstream::master())
269  {
270  // Calculate per-bin sum
271  scalarField binSum(nBins_, Zero);
272  forAll(sortedField, i)
273  {
274  binSum[indices[i]] += sortedField[i];
275  }
276 
277  // Calculate per-bin average
278  scalarField binAvg(divide(binSum, binCount));
279 
280  // Calculate per-bin deviation
281  scalarField binSqrSum(nBins_, Zero);
282  forAll(sortedField, i)
283  {
284  binSqrSum[indices[i]] += Foam::sqr(sortedField[i]);
285  }
286  scalarField binDev
287  (
288  sqrt(divide(binSqrSum, binCount) - Foam::sqr(binAvg))
289  );
290 
291  // Append
292  fields.setSize(fieldNames.size());
293  fieldNames.append(fieldName + "_sum");
294  fields.append(binSum);
295  fieldNames.append(fieldName + "_avg");
296  fields.append(binAvg);
297  fieldNames.append(fieldName + "_dev");
298  fields.append(binDev);
299  }
300 }
301 
302 
303 template<class Type>
304 void Foam::functionObjects::regionSizeDistribution::generateFields
305 (
306  const word& fieldName, // name of field
307  const Field<Type>& cellField, // per cell field data
308  const regionSplit& regions, // per cell the region(=droplet)
309  const labelList& sortedRegions, // valid regions in sorted order
310  const scalarField& sortedNormalisation,
311  const labelList& indices, // index of bin for each region
312  const scalarField& binCount, // per bin number of regions
314  PtrList<Field<Type>>& fields
315 ) const
316 {
317  // Sum on a per-region basis. Parallel reduced.
318  Map<Type> regionField(regionSum(regions, cellField));
319 
320  // Extract in region order
321  Field<Type> sortedField
322  (
323  sortedNormalisation*extractData(sortedRegions, regionField)
324  );
325 
326  // Generate fields
327  generateFields
328  (
329  fieldName, // name of field
330  indices, // index of bin for each region
331  sortedField, // per region field data
332  binCount, // per bin number of regions
333  fieldNames,
334  fields
335  );
336 }
337 
338 
339 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
340 
342 (
343  const word& name,
344  const Time& runTime,
345  const dictionary& dict
346 )
347 :
348  fvMeshFunctionObject(name, runTime, dict),
349  file_(obr_, name),
350  alphaName_(dict.lookup("alpha")),
351  patchNames_(dict.lookup("patches"))
352 {
353  read(dict);
354 }
355 
356 
357 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
358 
360 {}
361 
362 
363 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
364 
366 {
367  dict.lookup("alpha") >> alphaName_;
368  dict.lookup("patches") >> patchNames_;
369  dict.lookup("threshold") >> threshold_;
370  dict.lookup("maxDiameter") >> maxDiam_;
371  minDiam_ = 0.0;
372  dict.readIfPresent("minDiameter", minDiam_);
373  dict.lookup("nBins") >> nBins_;
374  dict.lookup("fields") >> fields_;
375 
376  formatterPtr_ = setWriter::New(dict.lookup("setFormat"), dict);
377 
378  return true;
379 }
380 
381 
383 {
384  wordList fields(fields_);
385  fields.append(alphaName_);
386  return fields;
387 }
388 
389 
391 {
392  return true;
393 }
394 
395 
397 {
398  Info<< indent << type() << " " << name() << " write:" << nl;
399 
400  autoPtr<volScalarField> alphaPtr;
401  if (obr_.foundObject<volScalarField>(alphaName_))
402  {
403  Info<< indent << "Looking up field " << alphaName_ << endl;
404  }
405  else
406  {
407  Info<< indent << "Reading field " << alphaName_ << endl;
408  alphaPtr.reset
409  (
410  new volScalarField
411  (
412  IOobject
413  (
414  alphaName_,
415  time_.name(),
416  mesh_,
419  ),
420  mesh_
421  )
422  );
423  }
424 
425 
426  const volScalarField& alpha =
427  (
428  alphaPtr.valid()
429  ? alphaPtr()
430  : obr_.lookupObject<volScalarField>(alphaName_)
431  );
432 
433  Info<< indent << "Volume of alpha = "
434  << fvc::domainIntegrate(alpha).value()
435  << endl;
436 
437  const scalar meshVol = gSum(mesh_.V());
438  const scalar maxDropletVol = 1.0/6.0*pow(maxDiam_, 3);
439  const scalar delta = (maxDiam_-minDiam_)/nBins_;
440 
441  Info<< indent << "Mesh volume = " << meshVol << endl;
442  Info<< indent << "Maximum droplet diameter = " << maxDiam_ << endl;
443  Info<< indent << "Maximum droplet volume = " << maxDropletVol << endl;
444 
445 
446  // Determine blocked faces
447  boolList blockedFace(mesh_.nFaces(), false);
448 
449  {
450  for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
451  {
452  scalar ownVal = alpha[mesh_.faceOwner()[facei]];
453  scalar neiVal = alpha[mesh_.faceNeighbour()[facei]];
454 
455  if
456  (
457  (ownVal < threshold_ && neiVal > threshold_)
458  || (ownVal > threshold_ && neiVal < threshold_)
459  )
460  {
461  blockedFace[facei] = true;
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().poly().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  }
491  }
492  }
493  }
494  }
495 
496 
497  regionSplit regions(mesh_, blockedFace);
498 
499  Info<< indent << "Determined " << regions.nRegions()
500  << " disconnected regions" << endl;
501 
502 
503  if (debug)
504  {
506  (
507  IOobject
508  (
509  "region",
510  time_.name(),
511  mesh_,
514  ),
515  mesh_,
517  );
518  Info<< indent << "Dumping region as volScalarField to " << region.name()
519  << endl;
520 
521  forAll(regions, celli)
522  {
523  region[celli] = regions[celli];
524  }
525  region.correctBoundaryConditions();
526  region.write();
527  }
528 
529 
530  // Determine regions connected to supplied patches
531  Map<label> patchRegions(findPatchRegions(regions));
532 
533 
534  // Sum all regions
535  const scalarField alphaVol(alpha.primitiveField()*mesh_.V());
536  Map<scalar> allRegionVolume(regionSum(regions, mesh_.V()));
537  Map<scalar> allRegionAlphaVolume(regionSum(regions, alphaVol));
538  Map<label> allRegionNumCells
539  (
540  regionSum
541  (
542  regions,
543  labelField(mesh_.nCells(), 1.0)
544  )
545  );
546 
547  if (debug)
548  {
549  Info<< indent << "" << tab << "Region"
550  << tab << "Volume(mesh)"
551  << tab << "Volume(" << alpha.name() << "):"
552  << tab << "nCells"
553  << endl;
554  scalar meshSumVol = 0.0;
555  scalar alphaSumVol = 0.0;
556  label nCells = 0;
557 
558  Map<scalar>::const_iterator vIter = allRegionVolume.begin();
559  Map<scalar>::const_iterator aIter = allRegionAlphaVolume.begin();
560  Map<label>::const_iterator numIter = allRegionNumCells.begin();
561  for
562  (
563  ;
564  vIter != allRegionVolume.end()
565  && aIter != allRegionAlphaVolume.end();
566  ++vIter, ++aIter, ++numIter
567  )
568  {
569  Info<< indent << "" << tab << vIter.key()
570  << tab << vIter()
571  << tab << aIter()
572  << tab << numIter()
573  << endl;
574 
575  meshSumVol += vIter();
576  alphaSumVol += aIter();
577  nCells += numIter();
578  }
579  Info<< indent << "" << tab << "Total:"
580  << tab << meshSumVol
581  << tab << alphaSumVol
582  << tab << nCells
583  << endl;
584  }
585 
586  {
587  Info<< indent << "Patch connected regions (liquid core):" << endl;
588  Info<< tab << " Region"
589  << tab << "Volume(mesh)"
590  << tab << "Volume(" << alpha.name() << "):"
591  << endl;
592  forAllConstIter(Map<label>, patchRegions, iter)
593  {
594  label regionI = iter.key();
595  Info<< indent << "" << tab << iter.key()
596  << tab << allRegionVolume[regionI]
597  << tab << allRegionAlphaVolume[regionI] << endl;
598 
599  }
600  }
601 
602  {
603  Info<< indent << "Background regions:" << endl;
604  Info<< indent << "" << tab << "Region"
605  << tab << "Volume(mesh)"
606  << tab << "Volume(" << alpha.name() << "):"
607  << endl;
608  Map<scalar>::const_iterator vIter = allRegionVolume.begin();
609  Map<scalar>::const_iterator aIter = allRegionAlphaVolume.begin();
610 
611  for
612  (
613  ;
614  vIter != allRegionVolume.end()
615  && aIter != allRegionAlphaVolume.end();
616  ++vIter, ++aIter
617  )
618  {
619  if
620  (
621  !patchRegions.found(vIter.key())
622  && vIter() >= maxDropletVol
623  )
624  {
625  Info<< indent << "" << tab << vIter.key()
626  << tab << vIter()
627  << tab << aIter() << endl;
628  }
629  }
630  }
631 
632 
633 
634  // Split alpha field
635  // ~~~~~~~~~~~~~~~~~
636  // Split into
637  // - liquidCore : region connected to inlet patches
638  // - per region a volume : for all other regions
639  // - backgroundAlpha : remaining alpha
640  writeAlphaFields(regions, patchRegions, allRegionVolume, alpha);
641 
642 
643  // Extract droplet-only allRegionVolume, i.e. delete liquid core
644  // (patchRegions) and background regions from maps.
645  // Note that we have to use mesh volume (allRegionVolume) and not
646  // allRegionAlphaVolume since background might not have alpha in it.
647  forAllIter(Map<scalar>, allRegionVolume, vIter)
648  {
649  label regionI = vIter.key();
650  if
651  (
652  patchRegions.found(regionI)
653  || vIter() >= maxDropletVol
654  )
655  {
656  allRegionVolume.erase(vIter);
657  allRegionAlphaVolume.erase(regionI);
658  allRegionNumCells.erase(regionI);
659  }
660  }
661 
662  if (allRegionVolume.size())
663  {
664  // Construct mids of bins for plotting
665  scalarField xBin(nBins_);
666  scalar x = 0.5*delta;
667  forAll(xBin, i)
668  {
669  xBin[i] = x;
670  x += delta;
671  }
672 
673  // Get in region order the alpha*volume and diameter
674  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
675 
676  const labelList sortedRegions = allRegionAlphaVolume.sortedToc();
677 
678  scalarField sortedVols
679  (
680  extractData
681  (
682  sortedRegions,
683  allRegionAlphaVolume
684  )
685  );
686 
687  // Calculate the diameters
688  scalarField sortedDiameters(sortedVols.size());
689  forAll(sortedDiameters, i)
690  {
691  sortedDiameters[i] = Foam::cbrt
692  (
693  sortedVols[i]
695  );
696  }
697 
698  // Determine the bin index for all the diameters
699  labelList indices(sortedDiameters.size());
700  forAll(sortedDiameters, i)
701  {
702  indices[i] = (sortedDiameters[i]-minDiam_)/delta;
703  }
704 
705  // Calculate the counts per diameter bin
706  scalarField binCount(nBins_, 0.0);
707  forAll(sortedDiameters, i)
708  {
709  binCount[indices[i]] += 1.0;
710  }
711 
712  // Write to log
713  {
714  Info<< indent << "Bins:" << endl;
715  Info<< indent << "" << tab << "Bin"
716  << tab << "Min diameter"
717  << tab << "Count:"
718  << endl;
719 
720  scalar diam = 0.0;
721  forAll(binCount, binI)
722  {
723  Info<< indent << "" << tab << binI
724  << tab << diam
725  << tab << binCount[binI] << endl;
726  diam += delta;
727  }
728  Info<< endl;
729  }
730 
731  // Declare fields and field names
733  #define DeclareTypeFields(Type, nullArg) \
734  PtrList<Field<Type>> Type##Fields;
736  #undef DeclareTypeFields
737 
738  // Add the bin count
739  fieldNames.append("binCount");
740  #define TypeFieldsAppend(Type, nullArg) \
741  appendFields(binCount, Type##Fields);
742  #undef TypeFieldsAppend
743 
744  // Add the volumes
745  generateFields
746  (
747  "volume",
748  indices,
749  sortedVols,
750  binCount,
751  fieldNames,
752  scalarFields
753  );
754 
755  // Add other sampled fields
756  forAll(fields_, fieldi)
757  {
758  bool found = false;
759 
760  #define GenerateTypeFields(Type, nullArg) \
761  \
762  if (obr_.foundObject<VolField<Type>>(fields_[fieldi])) \
763  { \
764  found = true; \
765  \
766  const VolField<Type>& field = \
767  obr_.lookupObject<VolField<Type>>(fields_[fieldi]); \
768  \
769  generateFields \
770  ( \
771  fields_[fieldi], \
772  (alphaVol*field)(), \
773  regions, \
774  sortedRegions, \
775  1.0/sortedVols, \
776  indices, \
777  binCount, \
778  fieldNames, \
779  Type##Fields \
780  ); \
781  }
783  #undef GenerateTypeFields
784 
785  if (!found) cannotFindObject(fields_[fieldi]);
786  }
787 
788  // Expand all field lists
789  #define TypeFieldsExpand(Type, nullArg) \
790  Type##Fields.setSize(fieldNames.size());
792  #undef TypeFieldsAppend
793 
794  // Write
795  formatterPtr_().write
796  (
797  file_.baseTimeDir(),
798  typeName,
799  coordSet(true, "diameter", xBin),
800  fieldNames
801  #define TypeFieldsParameter(Type, nullArg) , Type##Fields
803  #undef TypeFieldsParameter
804  );
805  }
806 
807  return true;
808 }
809 
810 
811 // ************************************************************************* //
scalar y
scalar delta
bool found
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:474
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:492
Macros for easy insertion into run-time selection tables.
Pre-declare SubField and related Field type.
Definition: Field.H:83
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:78
Generic GeometricField class.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
Definition: HashTable.C:242
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
Definition: HashTable.C:445
iterator begin()
Iterator set to the beginning of the HashTable.
Definition: HashTableI.H:395
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
bool found(const Key &) const
Return true if hashedEntry is found in table.
Definition: HashTable.C:138
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
virtual const fileName & name() const
Return the name of the stream.
Definition: IOstream.H:297
Plus op for FixedList<scalar>
void append(const T &)
Append an element at the end of the list.
Definition: ListI.H:178
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
A HashTable to objects of type <T> with a label key.
Definition: Map.H:52
virtual Ostream & write(const token &)
Write token.
Definition: Ostream.C:51
static void mapCombineScatter(const List< commsStruct > &comms, Container &Values, const int tag, const label comm)
Scatter data. Reverse of combineGather.
static void mapCombineGather(const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
static bool master(const label communicator=0)
Am I the master process.
Definition: UPstream.H:423
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:429
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
Definition: autoPtrI.H:83
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
Definition: autoPtrI.H:114
Holds list of sampling positions.
Definition: coordSet.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const word & name() const
Return const reference to name.
Abstract base-class for Time/database functionObjects.
const Time & time_
Reference to time.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const objectRegistry & obr_
Reference to the objectRegistry.
Creates a size distribution via interrogating a continuous phase fraction field.
regionSizeDistribution(const word &name, const Time &runTime, const dictionary &)
Construct for given objectRegistry and dictionary.
virtual wordList fields() const
Return the list of fields required.
virtual bool write()
Calculate the regionSizeDistribution and write.
virtual bool read(const dictionary &)
Read the regionSizeDistribution data.
const word & name() const
Return reference to name.
Definition: fvMesh.H:447
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:90
virtual bool coupled() const
Return true if this patch field is coupled.
Definition: fvPatchField.H:339
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Definition: fvPatchField.C:176
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:447
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:370
static const word & calculatedType()
Return the type of the calculated for of fvPatchField.
const polyPatch & poly() const
Return the polyPatch.
Definition: fvPatch.H:129
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:277
virtual bool write(const bool write=true) const
Write using setting from DB.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
Definition: regionSplit.H:118
label nRegions() const
Return total number of regions.
Definition: regionSplit.H:208
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:286
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:197
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
Volume integrate volField creating a volField.
label patchi
static List< word > fieldNames
Definition: globalFoam.H:46
Info<< "Calculating turbulent flame speed field St\n"<< endl;volScalarField St(IOobject("St", runTime.name(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:234
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, fvModel, dictionary)
dimensioned< Type > domainIntegrate(const VolField< Type > &vf)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
List< word > wordList
A List of words.
Definition: fileName.H:54
const dimensionSet & dimless
Definition: dimensions.C:138
List< label > labelList
A List of labels.
Definition: labelList.H:56
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
static const char tab
Definition: Ostream.H:296
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
messageStream Info
const fvMesh & region(const dictionary &dict)
Cast the give dictionary to the corresponding region fvMesh.
Definition: fvMesh.C:1831
Type gSum(const UList< Type > &f, const label comm)
void divide(pointPatchField< Type > &f, const pointPatchField< Type > &f1, const pointPatchField< scalar > &f2)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:62
Field< label > labelField
Specialisation of Field<T> for label.
Definition: labelField.H:49
void cbrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Definition: HashSet.H:213
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:243
static const char nl
Definition: Ostream.H:297
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
#define GenerateTypeFields(Type, nullArg)
#define TypeFieldsParameter(Type, nullArg)
#define DeclareTypeFields(Type, nullArg)
#define TypeFieldsExpand(Type, nullArg)
dictionary dict
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
Definition: HashTable.H:112