cellCellStencil.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify i
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "cellCellStencil.H"
30 #include "volFields.H"
31 #include "syncTools.H"
32 #include "globalIndex.H"
33 #include "oversetFvPatchFields.H"
34 
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39  defineTypeNameAndDebug(cellCellStencil, 0);
40  defineRunTimeSelectionTable(cellCellStencil, mesh);
41 }
42 
43 const Foam::Enum
44 <
46 >
48 ({
49  { cellType::CALCULATED, "calculated" },
50  { cellType::INTERPOLATED, "interpolated" },
51  { cellType::HOLE, "hole" },
52  { cellType::SPECIAL, "special" },
53  { cellType::POROUS, "porous" },
54 });
55 
56 
57 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58 
59 Foam::cellCellStencil::cellCellStencil(const fvMesh& mesh)
60 :
61  mesh_(mesh),
62  nonInterpolatedFields_({"zoneID"})
63 {}
64 
65 
67 (
68  const fvMesh& mesh,
69  const dictionary& dict,
70  const bool update
71 )
72 {
73  DebugInFunction << "Constructing cellCellStencil" << endl;
74 
75  const word stencilType(dict.get<word>("method"));
76 
77  auto* ctorPtr = meshConstructorTable(stencilType);
78 
79  if (!ctorPtr)
80  {
82  (
83  dict,
84  "cellCellStencil",
85  stencilType,
86  *meshConstructorTablePtr_
87  ) << exit(FatalIOError);
88  }
89 
90  return autoPtr<cellCellStencil>(ctorPtr(mesh, dict, update));
91 }
92 
93 
94 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
95 
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
103 {
104  if (name.ends_with("_0"))
105  {
106  return baseName(name.substr(0, name.size() - 2));
107  }
108 
109  return name;
110 }
111 
112 
114 {
115  labelIOList* zoneIDPtr = mesh.getObjectPtr<labelIOList>("zoneID");
116 
117  if (!zoneIDPtr)
118  {
119  zoneIDPtr = new labelIOList
120  (
121  IOobject
122  (
123  "zoneID",
126  mesh,
130  ),
131  mesh.nCells()
132  );
133 
134  zoneIDPtr->store();
135 
136  auto& zoneID = *zoneIDPtr;
137 
138  volScalarField volZoneID
139  (
140  IOobject
141  (
142  "zoneID",
143  mesh.time().findInstance(mesh.dbDir(), "zoneID"),
144  mesh,
148  ),
149  mesh
150  );
151  forAll(volZoneID, celli)
152  {
153  zoneID[celli] = label(volZoneID[celli]);
154  }
155  }
156 
157  return *zoneIDPtr;
158 }
159 
160 
162 (
163  const label size,
164  const labelUList& lst
165 )
166 {
167  labelList count(size, Zero);
168  forAll(lst, i)
169  {
170  count[lst[i]]++;
171  }
173  return count;
174 }
175 
178 {
179  return nonInterpolatedFields_;
180 }
181 
184 {
185  return nonInterpolatedFields_;
186 }
187 
188 
189 bool Foam::cellCellStencil::localStencil(const labelUList& slots) const
190 {
191  forAll(slots, i)
192  {
193  if (slots[i] >= mesh_.nCells())
194  {
195  return false;
196  }
197  }
198  return true;
199 }
200 
201 
203 (
204  const globalIndex& gi,
205  const polyMesh& mesh,
206  const boolList& isValidCell,
207  const labelList& selectedCells,
208  labelListList& cellCells,
209  pointListList& cellCellCentres
210 )
211 {
212  // For selected cells determine the face neighbours (in global numbering)
213 
214  const pointField& cellCentres = mesh.cellCentres();
215  const labelList& faceOwner = mesh.faceOwner();
216  const labelList& faceNeighbour = mesh.faceNeighbour();
217  const cellList& cells = mesh.cells();
218 
219 
220  // 1. Determine global cell number on other side of coupled patches
221 
222  labelList globalCellIDs(identity(gi.localSize(), gi.localStart()));
223 
224  labelList nbrGlobalCellIDs;
226  (
227  mesh,
228  globalCellIDs,
229  nbrGlobalCellIDs
230  );
231  pointField nbrCellCentres;
233  (
234  mesh,
235  cellCentres,
236  nbrCellCentres
237  );
238 
239  boolList nbrIsValidCell;
241  (
242  mesh,
243  isValidCell,
244  nbrIsValidCell
245  );
246 
247 
248  // 2. Collect cell and all its neighbours
249 
250  cellCells.setSize(mesh.nCells());
251  cellCellCentres.setSize(cellCells.size());
252 
253  forAll(selectedCells, i)
254  {
255  label celli = selectedCells[i];
256 
257  const cell& cFaces = cells[celli];
258  labelList& stencil = cellCells[celli];
259  pointList& stencilPoints = cellCellCentres[celli];
260  stencil.setSize(cFaces.size()+1);
261  stencilPoints.setSize(stencil.size());
262  label compacti = 0;
263 
264  // First entry is cell itself
265  if (isValidCell[celli])
266  {
267  stencil[compacti] = globalCellIDs[celli];
268  stencilPoints[compacti++] = cellCentres[celli];
269  }
270 
271  // Other entries are cell neighbours
272  forAll(cFaces, i)
273  {
274  label facei = cFaces[i];
275  label bFacei = facei-mesh.nInternalFaces();
276  label own = faceOwner[facei];
277  label nbrCelli;
278  point nbrCc;
279  bool isValid = false;
280  if (bFacei >= 0)
281  {
282  nbrCelli = nbrGlobalCellIDs[bFacei];
283  nbrCc = nbrCellCentres[bFacei];
284  isValid = nbrIsValidCell[bFacei];
285  }
286  else
287  {
288  if (own != celli)
289  {
290  nbrCelli = gi.toGlobal(own);
291  nbrCc = cellCentres[own];
292  isValid = isValidCell[own];
293  }
294  else
295  {
296  label nei = faceNeighbour[facei];
297  nbrCelli = gi.toGlobal(nei);
298  nbrCc = cellCentres[nei];
299  isValid = isValidCell[nei];
300  }
301  }
302 
303  if (isValid)
304  {
305  SubList<label> current(stencil, compacti);
306  if (!current.found(nbrCelli))
307  {
308  stencil[compacti] = nbrCelli;
309  stencilPoints[compacti++] = nbrCc;
310  }
311  }
312  }
313  stencil.setSize(compacti);
314  stencilPoints.setSize(compacti);
315  }
316 }
317 
319 (
320  const label celli,
321  const scalar wantedFraction,
322  bitSet& isFront,
323  scalarField& fraction
324 ) const
325 {
326  const cell& cFaces = mesh_.cells()[celli];
327  forAll(cFaces, i)
328  {
329  const label nbrFacei = cFaces[i];
330  if (fraction[nbrFacei] < wantedFraction)
331  {
332  fraction[nbrFacei] = wantedFraction;
333  isFront.set(nbrFacei);
334  }
335  }
336 }
337 
338 
340 (
341  const labelList& allCellTypes,
342  bitSet& isFront
343 ) const
344 {
345  const labelList& own = mesh_.faceOwner();
346  const labelList& nei = mesh_.faceNeighbour();
347 
348  for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
349  {
350  const label ownType = allCellTypes[own[facei]];
351  const label neiType = allCellTypes[nei[facei]];
352  if
353  (
354  (ownType == HOLE && neiType != HOLE)
355  || (ownType != HOLE && neiType == HOLE)
356  )
357  {
358  isFront.set(facei);
359  }
360  }
361 
362  labelList nbrCellTypes;
363  syncTools::swapBoundaryCellList(mesh_, allCellTypes, nbrCellTypes);
364 
365  for
366  (
367  label facei = mesh_.nInternalFaces();
368  facei < mesh_.nFaces();
369  facei++
370  )
371  {
372  const label ownType = allCellTypes[own[facei]];
373  const label neiType = nbrCellTypes[facei-mesh_.nInternalFaces()];
374 
375  if
376  (
377  (ownType == HOLE && neiType != HOLE)
378  || (ownType != HOLE && neiType == HOLE)
379  )
380  {
381  isFront.set(facei);
382  }
383  }
384 }
385 
386 
388 (
389  const labelList& allCellTypes,
390  bitSet& isFront
391 ) const
392 {
393  const fvBoundaryMesh& fvm = mesh_.boundary();
394  // 'overset' patches
395  forAll(fvm, patchi)
396  {
397  if (isA<oversetFvPatch>(fvm[patchi]))
398  {
399  const labelList& fc = fvm[patchi].faceCells();
400  forAll(fc, i)
401  {
402  const label celli = fc[i];
403  if (allCellTypes[celli] == INTERPOLATED)
404  {
405  // Note that acceptors might have been marked hole if
406  // there are no donors in which case we do not want to
407  // walk this out. This is an extreme situation.
408  isFront.set(fvm[patchi].start()+i);
409  }
410  }
411  }
412  }
413 }
414 
415 
417 (
418  const globalIndex& globalCells,
419  const scalar layerRelax,
420  const labelListList& allStencil,
421  labelList& allCellTypes,
422  scalarField& allWeight,
423  const scalarList& compactCellVol,
424  const labelListList& compactStencil,
425  const labelList& zoneID,
426  const label holeLayers,
427  const label useLayer
428 ) const
429 {
430  if (useLayer > holeLayers)
431  {
432  FatalErrorInFunction<< "useLayer: " << useLayer
433  << " is larger than : " << holeLayers
434  << abort(FatalError);
435  }
436 
437  if (useLayer == 0)
438  {
439  FatalErrorInFunction<< "useLayer: " << useLayer
440  << " can not be zero."
441  << abort(FatalError);
442  }
443 
444  // Current front
445  bitSet isFront(mesh_.nFaces());
446 
447  // List of cellTYpes
448  DynamicList<labelList> dataSet;
449  // List of cellTypes for increasing layers
450  DynamicList<scalarField> dAlllWeight;
451  // List of average volumen ration interpolated/donor
452  DynamicList<scalar> daverageVolRatio;
453 
454  // Counting holes of different layers
455  DynamicList<label> dHoles;
456 
457  const scalarField& V = mesh_.V();
458 
459  // Current layer
460  labelField nLayer(allCellTypes.size(), 0);
461 
462  for (label currLayer = 1; currLayer < holeLayers+1; ++currLayer)
463  {
464  // Set up original front
465  isFront = false;
466 
467  setUpFront(allCellTypes, isFront);
468 
469  labelList allCellTypesWork(allCellTypes);
470 
471  bitSet isFrontWork(isFront);
472  label nCurrLayer = currLayer;
473 
474  while (nCurrLayer > 1 && returnReduce(isFrontWork.any(), orOp<bool>()))
475  {
476  bitSet newIsFront(mesh_.nFaces());
477  forAll(isFrontWork, facei)
478  {
479  if (isFrontWork.test(facei))
480  {
481  const label own = mesh_.faceOwner()[facei];
482 
483  if (allCellTypesWork[own] != HOLE)
484  {
485  allCellTypesWork[own] = HOLE;
486  newIsFront.set(mesh_.cells()[own]);
487  }
488 
489  if (mesh_.isInternalFace(facei))
490  {
491  const label nei = mesh_.faceNeighbour()[facei];
492  if (allCellTypesWork[nei] != HOLE)
493  {
494  allCellTypesWork[nei] = HOLE;
495  newIsFront.set(mesh_.cells()[nei]);
496  }
497  }
498  }
499  }
500  syncTools::syncFaceList(mesh_, newIsFront, orEqOp<unsigned int>());
501 
502  isFrontWork.transfer(newIsFront);
503 
504  nCurrLayer--;
505  }
506 
507 
508  if ((debug&2) && (mesh_.time().outputTime()))
509  {
510  tmp<volScalarField> tfld
511  (
512  createField
513  (
514  mesh_,
515  "allCellTypesWork_Holes" + name(currLayer),
516  allCellTypesWork
517  )
518  );
519  tfld().write();
520  }
521 
522  if (currLayer == 1)
523  {
524  setUpFrontOnOversetPatch(allCellTypes, isFront);
525  }
526 
527  if (currLayer > 1)
528  {
529  isFront = false;
530  setUpFrontOnOversetPatch(allCellTypesWork, isFront);
531  setUpFront(allCellTypesWork, isFront);
532  }
533 
534  // Current interpolation fraction
535  scalarField fraction(mesh_.nFaces(), Zero);
536 
537  // Ratio between Inter/donor
538  scalarField volRatio(allCellTypes.size(), Zero);
539 
540  forAll(isFront, facei)
541  {
542  if (isFront.test(facei))
543  {
544  fraction[facei] = 1.0;
545  }
546  }
547 
548  scalarField allWeightWork(allCellTypes.size(), Zero);
549  bitSet nHoles(allCellTypes.size());
550 
551  while (returnReduce(isFront.any(), orOp<bool>()))
552  {
553  // Interpolate cells on front
554  bitSet newIsFront(mesh_.nFaces());
555  scalarField newFraction(fraction);
556 
557  forAll(isFront, facei)
558  {
559  if (isFront.test(facei))
560  {
561  const label own = mesh_.faceOwner()[facei];
562 
563  if (allCellTypesWork[own] != HOLE)
564  {
565  if (allWeightWork[own] < fraction[facei])
566  {
567  // Cell wants to become interpolated (if sufficient
568  // stencil, otherwise becomes hole)
569  if (allStencil[own].size())
570  {
571  nLayer[own] = currLayer;
572 
573  allWeightWork[own] = fraction[facei];
574  allCellTypesWork[own] = INTERPOLATED;
575 
576  const label donorId = compactStencil[own][0];
577 
578  volRatio[own] = V[own]/compactCellVol[donorId];
579 
580  seedCell
581  (
582  own,
583  fraction[facei]-layerRelax,
584  newIsFront,
585  newFraction
586  );
587 
588  nHoles[own] = true;
589  }
590  else
591  {
592  allWeightWork[own] = 0.0;
593  allCellTypesWork[own] = HOLE;
594  // Add faces of cell as new front
595  seedCell
596  (
597  own,
598  1.0,
599  newIsFront,
600  newFraction
601  );
602  }
603  }
604  }
605  if (mesh_.isInternalFace(facei))
606  {
607  label nei = mesh_.faceNeighbour()[facei];
608  if (allCellTypesWork[nei] != HOLE)
609  {
610  if (allWeightWork[nei] < fraction[facei])
611  {
612  if (allStencil[nei].size())
613  {
614  nLayer[nei] = currLayer;
615 
616  allWeightWork[nei] = fraction[facei];
617  allCellTypesWork[nei] = INTERPOLATED;
618 
619  const label donorId =
620  compactStencil[nei][0];
621 
622  volRatio[nei] =
623  V[nei]/compactCellVol[donorId];
624 
625  seedCell
626  (
627  nei,
628  fraction[facei]-layerRelax,
629  newIsFront,
630  newFraction
631  );
632  }
633  else
634  {
635  allWeightWork[nei] = 0.0;
636  allCellTypesWork[nei] = HOLE;
637  nHoles[nei] = true;
638  seedCell
639  (
640  nei,
641  1.0,
642  newIsFront,
643  newFraction
644  );
645  }
646  }
647  }
648  }
649  }
650  }
651 
652  syncTools::syncFaceList(mesh_, newIsFront, orEqOp<unsigned int>());
653  syncTools::syncFaceList(mesh_, newFraction, maxEqOp<scalar>());
654 
655  isFront.transfer(newIsFront);
656  fraction.transfer(newFraction);
657  }
658 
659  if ((debug&2) && (mesh_.time().outputTime()))
660  {
661  tmp<volScalarField> tfld
662  (
663  createField
664  (
665  mesh_,
666  "allCellTypesWork_Layers" + name(currLayer),
667  allCellTypesWork
668  )
669  );
670  tfld().write();
671  }
672 
673  dAlllWeight.append(allWeightWork);
674  dataSet.append(allCellTypesWork);
675 
676  // Counting interpolated cells
677  label count = 1;
678  forAll (volRatio, i)
679  {
680  if (volRatio[i] > 0)
681  {
682  count++;
683  }
684  }
685  label nCount(count);
686  reduce(nCount, sumOp<label>());
687 
688  const scalar aveVol = mag(gSum(volRatio));
689 
690  daverageVolRatio.append(aveVol/nCount);
691 
692  // Check holes number. A sudden increase occurs when the walk leaks
693  // out from the obstacle
694  label nTotalHoles(nHoles.count());
695  reduce(nTotalHoles, sumOp<label>());
696  dHoles.append(nTotalHoles);
697 
698  // Check the increase between this layer and the last one
699  // if over 50% breaks the layer loop.
700  if
701  (
702  (currLayer > 1)
703  & (nTotalHoles > 2.0*dHoles[currLayer - 1])
704  )
705  {
706  break;
707  }
708  }
709 
710 
711  if ((debug&2) && (mesh_.time().outputTime()))
712  {
713  tmp<volScalarField> tfld
714  (
715  createField(mesh_, "walkFront_layers", nLayer)
716  );
717  tfld().write();
718  }
719 
720  // Try to find the best averageVolRatio the further from the initial set
721  // As this one is next to HOLES
722  scalarList averageVolRatio;
723  averageVolRatio.transfer(daverageVolRatio);
724  label minVolId = findMin(averageVolRatio);
725 
726  if (useLayer > -1)
727  {
728  Info<< nl << " Number of layers : " << averageVolRatio.size() << nl
729  << " Average volumetric ratio : " << averageVolRatio << nl
730  << " Number of holes cells : " << dHoles << nl
731  << " Using layer : " << useLayer << nl << endl;
732  }
733 
734  if (useLayer != -1)
735  {
736  minVolId = useLayer - 1;
737  }
738 
739  allCellTypes.transfer(dataSet[minVolId]);
740  allWeight.transfer(dAlllWeight[minVolId]);
741 }
742 
743 
744 // * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * * //
745 
746 template<>
747 Foam::Ostream& Foam::operator<<
748 (
749  Ostream& os,
750  const InfoProxy<cellCellStencil>& iproxy
751 )
752 {
753  const auto& e = *iproxy;
754 
755  const labelUList& cellTypes = e.cellTypes();
756  const labelUList& interpolationCells = e.interpolationCells();
757  const labelListList& cellStencil = e.cellStencil();
758 
760 
761  label nInvalidInterpolated = 0;
762  label nLocal = 0;
763  label nMixed = 0;
764  label nRemote = 0;
765  forAll(interpolationCells, i)
766  {
767  label celli = interpolationCells[i];
768  const labelList& slots = cellStencil[celli];
769 
770  if (slots.empty())
771  {
772  nInvalidInterpolated++;
773  }
774 
775  bool hasLocal = false;
776  bool hasRemote = false;
777 
778  forAll(slots, sloti)
779  {
780  if (slots[sloti] >= cellTypes.size())
781  {
782  hasRemote = true;
783  }
784  else
785  {
786  hasLocal = true;
787  }
788  }
789 
790  if (hasRemote)
791  {
792  if (!hasLocal)
793  {
794  nRemote++;
795  }
796  else
797  {
798  nMixed++;
799  }
800  }
801  else if (hasLocal)
802  {
803  nLocal++;
804  }
805  }
806  reduce(nLocal, sumOp<label>());
807  reduce(nMixed, sumOp<label>());
808  reduce(nRemote, sumOp<label>());
809  reduce(nInvalidInterpolated, sumOp<label>());
810 
811  Info<< "Overset analysis : nCells : "
812  << returnReduce(cellTypes.size(), sumOp<label>()) << nl
813  << incrIndent
814  << indent << "calculated : " << nCells[cellCellStencil::CALCULATED]
815  << nl
816  << indent << "interpolated : " << nCells[cellCellStencil::INTERPOLATED]
817  << " (interpolated from local:" << nLocal
818  << " mixed local/remote:" << nMixed
819  << " remote:" << nRemote
820  << " special:" << nInvalidInterpolated << ")" << nl
821  << indent << "hole : " << nCells[cellCellStencil::HOLE] << nl
822  << indent << "special : " << nCells[cellCellStencil::SPECIAL] << nl
823  << decrIndent << endl;
824 
825  return os;
826 }
827 
828 
829 // ************************************************************************* //
List< scalar > scalarList
List of scalar.
Definition: scalarList.H:32
virtual const wordHashSet & nonInterpolatedFields() const
Return the names of any (stencil or mesh specific) fields that.
dictionary dict
Field< label > labelField
Specialisation of Field<T> for label.
Definition: labelField.H:48
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:449
List< cell > cellList
List of cell.
Definition: cellListFwd.H:39
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
const fileName & facesInstance() const
Return the current instance directory for faces.
Definition: polyMesh.C:854
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
word findInstance(const fileName &dir, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null) const
Return time instance (location) of dir that contains the file name (eg, used in reading mesh data)...
Definition: Time.C:787
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
Definition: List.C:452
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:578
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1117
void seedCell(const label cellI, const scalar wantedFraction, bitSet &isFront, scalarField &fraction) const
Seed faces of cell with wantedFraction (if higher than current)
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
Definition: List.H:472
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:49
static autoPtr< cellCellStencil > New(const fvMesh &, const dictionary &dict, const bool update=true)
New function which constructs and returns pointer to a.
void setUpFront(const labelList &allCellTypes, bitSet &isFront) const
Set up front using allCellTypes.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Definition: polyMesh.H:402
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:487
bool store()
Register object with its registry and transfer ownership to the registry.
Definition: regIOobjectI.H:36
static void syncFaceList(const polyMesh &mesh, UList< T > &faceValues, const CombineOp &cop)
Synchronize values on all mesh faces.
Definition: syncTools.H:432
const cellList & cells() const
virtual ~cellCellStencil()
Destructor.
virtual const fileName & dbDir() const
Override the objectRegistry dbDir for a single-region case.
Definition: polyMesh.C:825
Ignore writing from objectRegistry::writeObject()
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:362
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
List< labelList > labelListList
List of labelList.
Definition: labelList.H:38
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:414
bool localStencil(const labelUList &) const
Helper: is stencil fully local.
void setUpFrontOnOversetPatch(const labelList &allCellTypes, bitSet &isFront) const
Set up front on overset patches.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:81
label findMin(const ListType &input, label start=0)
Linear search for the index of the min element, similar to std::min_element but for lists and returns...
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
bool ends_with(char c) const
True if string ends with given character (cf. C++20)
Definition: string.H:439
static labelList count(const label size, const labelUList &lst)
Count occurrences (in parallel)
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
IOList< label > labelIOList
IO for a List of label.
Definition: labelIOList.H:32
dynamicFvMesh & mesh
Type gSum(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:52
const cellShapeList & cells
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
Definition: labelList.C:31
A class for handling words, derived from Foam::string.
Definition: word.H:63
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
#define DebugInFunction
Report an information message using Foam::Info.
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1111
label nInternalFaces() const noexcept
Number of internal faces.
const vectorField & cellCentres() const
errorManip< error > abort(error &err)
Definition: errorManip.H:139
const labelList & cellTypes
Definition: setCellMask.H:27
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
static word baseName(const word &name)
Helper: strip off trailing _0.
virtual bool update()=0
Update stencils. Return false if nothing changed.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
mesh update()
defineTypeNameAndDebug(combustionModel, 0)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:467
static void globalCellCells(const globalIndex &gi, const polyMesh &mesh, const boolList &isValidDonor, const labelList &selectedCells, labelListList &cellCells, pointListList &cellCellCentres)
Helper: create cell-cell addressing in global numbering.
static void swapBoundaryCellList(const polyMesh &mesh, const UList< T > &cellData, List< T > &neighbourCellData)
Swap to obtain neighbour cell values for all boundary faces.
const labelIOList & zoneID() const
Helper: get reference to registered zoneID. Loads volScalarField.
vector point
Point is a vector.
Definition: point.H:37
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
label nCells() const noexcept
Number of mesh cells.
static const Enum< cellType > cellTypeNames_
Mode type names.
Nothing to be read.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
List< point > pointList
List of point.
Definition: pointList.H:32
void walkFront(const globalIndex &globalCells, const scalar layerRelax, const labelListList &allStencil, labelList &allCellTypes, scalarField &allWeight, const scalarList &compactCellVol, const labelListList &compactStencil, const labelList &zoneID, const label holeLayers, const label useLayer) const
Surround holes with layer(s) of interpolated cells.
List< label > labelList
A List of labels.
Definition: List.H:62
List< pointList > pointListList
List of pointList.
Definition: pointList.H:35
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:458
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:615
Request registration (bool: true)
List< bool > boolList
A List of bools.
Definition: List.H:60
Do not request registration (bool: false)
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:133