isoAdvection.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) 2016-2017 DHI
9  Modified code Copyright (C) 2016-2022 OpenCFD Ltd.
10  Modified code Copyright (C) 2019-2020 DLR
11  Modified code Copyright (C) 2018, 2021 Johan Roenby
12 -------------------------------------------------------------------------------
13 License
14  This file is part of OpenFOAM.
15 
16  OpenFOAM is free software: you can redistribute it and/or modify it
17  under the terms of the GNU General Public License as published by
18  the Free Software Foundation, either version 3 of the License, or
19  (at your option) any later version.
20 
21  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
22  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 
29 \*---------------------------------------------------------------------------*/
30 
31 #include "isoAdvection.H"
32 #include "volFields.H"
33 #include "interpolationCellPoint.H"
34 #include "volPointInterpolation.H"
35 #include "fvcSurfaceIntegrate.H"
36 #include "fvcGrad.H"
37 #include "upwind.H"
38 #include "cellSet.H"
39 #include "meshTools.H"
40 #include "OBJstream.H"
41 #include "syncTools.H"
42 #include "profiling.H"
43 
45 
46 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50  defineTypeNameAndDebug(isoAdvection, 0);
51 }
52 
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 
55 Foam::isoAdvection::isoAdvection
56 (
58  const surfaceScalarField& phi,
59  const volVectorField& U
60 )
61 :
62  mesh_(alpha1.mesh()),
63  dict_(mesh_.solverDict(alpha1.name())),
64  alpha1_(alpha1),
65  alpha1In_(alpha1.primitiveFieldRef()),
66  phi_(phi),
67  U_(U),
68  dVf_
69  (
70  IOobject
71  (
72  "dVf_",
73  mesh_.time().timeName(),
74  mesh_,
75  IOobject::NO_READ,
76  IOobject::NO_WRITE
77  ),
78  mesh_,
80  ),
81  alphaPhi_
82  (
83  IOobject
84  (
85  "alphaPhi_",
86  mesh_.time().timeName(),
87  mesh_,
88  IOobject::NO_READ,
89  IOobject::NO_WRITE
90  ),
91  mesh_,
93  ),
94  advectionTime_(0),
95  timeIndex_(-1),
96 
97  // Tolerances and solution controls
98  nAlphaBounds_(dict_.getOrDefault<label>("nAlphaBounds", 3)),
99  isoFaceTol_(dict_.getOrDefault<scalar>("isoFaceTol", 1e-8)),
100  surfCellTol_(dict_.getOrDefault<scalar>("surfCellTol", 1e-8)),
101  writeIsoFacesToFile_(dict_.getOrDefault("writeIsoFaces", false)),
102 
103  // Cell cutting data
104  surfCells_(label(0.2*mesh_.nCells())),
105  surf_(reconstructionSchemes::New(alpha1_, phi_, U_, dict_)),
106  advectFace_(alpha1.mesh(), alpha1),
107  bsFaces_(label(0.2*mesh_.nBoundaryFaces())),
108  bsx0_(bsFaces_.size()),
109  bsn0_(bsFaces_.size()),
110  bsUn0_(bsFaces_.size()),
111 
112  // Porosity
113  porosityEnabled_(dict_.getOrDefault<bool>("porosityEnabled", false)),
114  porosityPtr_(nullptr),
115 
116  // Parallel run data
117  procPatchLabels_(mesh_.boundary().size()),
118  surfaceCellFacesOnProcPatches_(0)
119 {
121 
122  // Prepare lists used in parallel runs
123  if (Pstream::parRun())
124  {
125  // Force calculation of required demand driven data (else parallel
126  // communication may crash)
127  mesh_.cellCentres();
128  mesh_.cellVolumes();
129  mesh_.faceCentres();
130  mesh_.faceAreas();
131  mesh_.magSf();
132  mesh_.boundaryMesh().patchID();
133  mesh_.cellPoints();
134  mesh_.cellCells();
135  mesh_.cells();
136 
137  // Get boundary mesh and resize the list for parallel comms
138  setProcessorPatches();
139  }
140 
141  // Reading porosity properties from constant directory
142  IOdictionary porosityProperties
143  (
144  IOobject
145  (
146  "porosityProperties",
147  mesh_.time().constant(),
148  mesh_,
151  )
152  );
153 
154  porosityEnabled_ =
155  porosityProperties.getOrDefault<bool>("porosityEnabled", false);
156 
157  if (porosityEnabled_)
158  {
159  porosityPtr_ = mesh_.getObjectPtr<volScalarField>("porosity");
160 
161  if (porosityPtr_)
162  {
163  if
164  (
165  gMin(porosityPtr_->primitiveField()) <= 0
166  || gMax(porosityPtr_->primitiveField()) > 1 + SMALL
167  )
168  {
170  << "Porosity field has values <= 0 or > 1"
171  << exit(FatalError);
172  }
173  }
174  else
175  {
177  << "Porosity enabled in constant/porosityProperties "
178  << "but no porosity field is found in object registry."
179  << exit(FatalError);
180  }
181  }
182 }
183 
184 
185 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
186 
187 void Foam::isoAdvection::setProcessorPatches()
188 {
189  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
190  surfaceCellFacesOnProcPatches_.clear();
191  surfaceCellFacesOnProcPatches_.resize(patches.size());
192 
193  // Append all processor patch labels to the list
194  procPatchLabels_.clear();
195  forAll(patches, patchi)
196  {
197  if
198  (
199  isA<processorPolyPatch>(patches[patchi])
200  && !patches[patchi].empty()
201  )
202  {
203  procPatchLabels_.append(patchi);
204  }
205  }
206 }
207 
208 
209 void Foam::isoAdvection::extendMarkedCells
210 (
211  bitSet& markedCell
212 ) const
213 {
214  // Mark faces using any marked cell
215  bitSet markedFace(mesh_.nFaces());
216 
217  for (const label celli : markedCell)
218  {
219  markedFace.set(mesh_.cells()[celli]); // set multiple faces
220  }
221 
222  syncTools::syncFaceList(mesh_, markedFace, orEqOp<unsigned int>());
223 
224  // Update cells using any markedFace
225  for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
226  {
227  if (markedFace.test(facei))
228  {
229  markedCell.set(mesh_.faceOwner()[facei]);
230  markedCell.set(mesh_.faceNeighbour()[facei]);
231  }
232  }
233  for (label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); ++facei)
234  {
235  if (markedFace.test(facei))
236  {
237  markedCell.set(mesh_.faceOwner()[facei]);
238  }
239  }
240 }
241 
242 
243 void Foam::isoAdvection::timeIntegratedFlux()
244 {
245  addProfilingInFunction(geometricVoF);
246  // Get time step
247  const scalar dt = mesh_.time().deltaTValue();
248 
249  // Create object for interpolating velocity to isoface centres
250  interpolationCellPoint<vector> UInterp(U_);
251 
252  // For each downwind face of each surface cell we "isoadvect" to find dVf
253  label nSurfaceCells = 0;
254 
255  // Clear out the data for re-use and reset list containing information
256  // whether cells could possibly need bounding
257  clearIsoFaceData();
258 
259  // Get necessary references
260  const scalarField& phiIn = phi_.primitiveField();
261  const scalarField& magSfIn = mesh_.magSf().primitiveField();
262  scalarField& dVfIn = dVf_.primitiveFieldRef();
263 
264  // Get necessary mesh data
265  const cellList& cellFaces = mesh_.cells();
266  const labelList& own = mesh_.faceOwner();
267 
268 
269  // Storage for isoFace points. Only used if writeIsoFacesToFile_
270  DynamicList<List<point>> isoFacePts;
271  const DynamicField<label>& interfaceLabels = surf_->interfaceLabels();
272 
273  // Calculating isoface normal velocity
274  scalarField Un0(interfaceLabels.size());
275  forAll(Un0, i)
276  {
277  const label celli = interfaceLabels[i];
278  const point x0(surf_->centre()[celli]);
279  const vector n0(normalised(-surf_->normal()[celli]));
280  Un0[i] = UInterp.interpolate(x0, celli) & n0;
281  }
282 
283  // Taking acount of porosity if enabled
284  if (porosityEnabled_)
285  {
286  forAll(Un0, i)
287  {
288  const label celli = interfaceLabels[i];
289  Un0[i] /= porosityPtr_->primitiveField()[celli];
290  }
291  }
292 
293  // Loop through cells
294  forAll(interfaceLabels, i)
295  {
296  const label celli = interfaceLabels[i];
297  if (mag(surf_->normal()[celli]) != 0)
298  {
299 
300  // This is a surface cell, increment counter, append and mark cell
301  nSurfaceCells++;
302  surfCells_.append(celli);
303  const point x0(surf_->centre()[celli]);
304  const vector n0(normalised(-surf_->normal()[celli]));
305 
306  DebugInfo
307  << "\n------------ Cell " << celli << " with alpha1 = "
308  << alpha1In_[celli] << " and 1-alpha1 = "
309  << 1.0 - alpha1In_[celli] << " ------------"
310  << endl;
311 
312  // Estimate time integrated flux through each downwind face
313  // Note: looping over all cell faces - in reduced-D, some of
314  // these faces will be on empty patches
315  const cell& celliFaces = cellFaces[celli];
316  for (const label facei : celliFaces)
317  {
318  if (mesh_.isInternalFace(facei))
319  {
320  bool isDownwindFace = false;
321 
322  if (celli == own[facei])
323  {
324  if (phiIn[facei] >= 0)
325  {
326  isDownwindFace = true;
327  }
328  }
329  else
330  {
331  if (phiIn[facei] < 0)
332  {
333  isDownwindFace = true;
334  }
335  }
336 
337  if (isDownwindFace)
338  {
339  dVfIn[facei] = advectFace_.timeIntegratedFaceFlux
340  (
341  facei,
342  x0,
343  n0,
344  Un0[i],
345  dt,
346  phiIn[facei],
347  magSfIn[facei]
348  );
349  }
350 
351  }
352  else
353  {
354  bsFaces_.append(facei);
355  bsx0_.append(x0);
356  bsn0_.append(n0);
357  bsUn0_.append(Un0[i]);
358 
359  // Note: we must not check if the face is on the
360  // processor patch here.
361  }
362  }
363  }
364  }
365 
366  // Get references to boundary fields
367  const polyBoundaryMesh& boundaryMesh = mesh_.boundaryMesh();
368  const surfaceScalarField::Boundary& phib = phi_.boundaryField();
369  const surfaceScalarField::Boundary& magSfb = mesh_.magSf().boundaryField();
370  surfaceScalarField::Boundary& dVfb = dVf_.boundaryFieldRef();
371 
372  // Loop through boundary surface faces
373  forAll(bsFaces_, i)
374  {
375  // Get boundary face index (in the global list)
376  const label facei = bsFaces_[i];
377  const label patchi = boundaryMesh.patchID(facei);
378 
379  if (!phib[patchi].empty())
380  {
381  const label patchFacei = boundaryMesh[patchi].whichFace(facei);
382 
383  const scalar phiP = phib[patchi][patchFacei];
384 
385  if (phiP >= 0)
386  {
387  const scalar magSf = magSfb[patchi][patchFacei];
388 
389  dVfb[patchi][patchFacei] = advectFace_.timeIntegratedFaceFlux
390  (
391  facei,
392  bsx0_[i],
393  bsn0_[i],
394  bsUn0_[i],
395  dt,
396  phiP,
397  magSf
398  );
399 
400  // Handling upwind cyclic boundary patches
401  const polyPatch& pp = boundaryMesh[patchi];
402  const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
403  if (cpp)
404  {
405  const label neiPatchID(cpp->neighbPolyPatchID());
406  dVfb[neiPatchID][patchFacei] = -dVfb[patchi][patchFacei];
407  }
408 
409  // Check if the face is on processor patch and append it to
410  // the list if necessary
411  checkIfOnProcPatch(facei);
412  }
413  }
414  }
415 
416  // Synchronize processor patches
417  syncProcPatches(dVf_, phi_);
418 
419  writeIsoFaces(isoFacePts);
420 
421  DebugInfo << "Number of isoAdvector surface cells = "
422  << returnReduce(nSurfaceCells, sumOp<label>()) << endl;
423 }
424 
425 
426 void Foam::isoAdvection::setDownwindFaces
427 (
428  const label celli,
429  DynamicLabelList& downwindFaces
430 ) const
431 {
433 
434  // Get necessary mesh data and cell information
435  const labelList& own = mesh_.faceOwner();
436  const cellList& cells = mesh_.cells();
437  const cell& c = cells[celli];
438 
439  downwindFaces.clear();
440 
441  // Check all faces of the cell
442  for (const label facei: c)
443  {
444  // Get face and corresponding flux
445  const scalar phi = faceValue(phi_, facei);
446 
447  if (own[facei] == celli)
448  {
449  if (phi >= 0)
450  {
451  downwindFaces.append(facei);
452  }
453  }
454  else if (phi < 0)
455  {
456  downwindFaces.append(facei);
457  }
458  }
459 
460  downwindFaces.shrink();
461 }
462 
463 
464 Foam::scalar Foam::isoAdvection::netFlux
465 (
466  const surfaceScalarField& dVf,
467  const label celli
468 ) const
469 {
470  scalar dV = 0;
471 
472  // Get face indices
473  const cell& c = mesh_.cells()[celli];
474 
475  // Get mesh data
476  const labelList& own = mesh_.faceOwner();
477 
478  for (const label facei : c)
479  {
480  const scalar dVff = faceValue(dVf, facei);
481 
482  if (own[facei] == celli)
483  {
484  dV += dVff;
485  }
486  else
487  {
488  dV -= dVff;
489  }
490  }
491 
492  return dV;
493 }
494 
495 
496 Foam::DynamicList<Foam::label> Foam::isoAdvection::syncProcPatches
497 (
498  surfaceScalarField& dVf,
499  const surfaceScalarField& phi,
500  bool returnSyncedFaces
501 )
502 {
503  DynamicLabelList syncedFaces(0);
504  const polyBoundaryMesh& patches = mesh_.boundaryMesh();
505 
506  if (Pstream::parRun())
507  {
508  DynamicList<label> neighProcs;
509  PstreamBuffers pBufs;
510 
511  // Send
512  for (const label patchi : procPatchLabels_)
513  {
514  const processorPolyPatch& procPatch =
515  refCast<const processorPolyPatch>(patches[patchi]);
516  const label nbrProci = procPatch.neighbProcNo();
517 
518  // Neighbour connectivity
519  neighProcs.push_uniq(nbrProci);
520 
521  const scalarField& pFlux = dVf.boundaryField()[patchi];
522  const List<label>& surfCellFacesOnProcPatch =
523  surfaceCellFacesOnProcPatches_[patchi];
524 
525  const UIndirectList<scalar> dVfPatch
526  (
527  pFlux,
528  surfCellFacesOnProcPatch
529  );
530 
531  UOPstream toNbr(nbrProci, pBufs);
532  toNbr << surfCellFacesOnProcPatch << dVfPatch;
533  }
534 
535  // Limited to involved neighbour procs
536  pBufs.finishedNeighbourSends(neighProcs);
537 
538 
539  // Receive and combine
540  for (const label patchi : procPatchLabels_)
541  {
542  const processorPolyPatch& procPatch =
543  refCast<const processorPolyPatch>(patches[patchi]);
544  const label nbrProci = procPatch.neighbProcNo();
545 
546  List<label> faceIDs;
547  List<scalar> nbrdVfs;
548 
549  {
550  UIPstream fromNbr(nbrProci, pBufs);
551  fromNbr >> faceIDs >> nbrdVfs;
552  }
553 
554  if (returnSyncedFaces)
555  {
556  List<label> syncedFaceI(faceIDs);
557  for (label& faceI : syncedFaceI)
558  {
559  faceI += procPatch.start();
560  }
561  syncedFaces.append(syncedFaceI);
562  }
563 
564  if (debug)
565  {
566  Pout<< "Received at time = " << mesh_.time().value()
567  << ": surfCellFacesOnProcPatch = " << faceIDs << nl
568  << "Received at time = " << mesh_.time().value()
569  << ": dVfPatch = " << nbrdVfs << endl;
570  }
571 
572  // Combine fluxes
573  scalarField& localFlux = dVf.boundaryFieldRef()[patchi];
574 
575  forAll(faceIDs, i)
576  {
577  const label facei = faceIDs[i];
578  localFlux[facei] = - nbrdVfs[i];
579  if (debug && mag(localFlux[facei] + nbrdVfs[i]) > ROOTVSMALL)
580  {
581  Pout<< "localFlux[facei] = " << localFlux[facei]
582  << " and nbrdVfs[i] = " << nbrdVfs[i]
583  << " for facei = " << facei << endl;
584  }
585  }
586  }
587 
588  if (debug)
589  {
590  // Write out results for checking
591  forAll(procPatchLabels_, patchLabeli)
592  {
593  const label patchi = procPatchLabels_[patchLabeli];
594  const scalarField& localFlux = dVf.boundaryField()[patchi];
595  Pout<< "time = " << mesh_.time().value() << ": localFlux = "
596  << localFlux << endl;
597  }
598  }
599 
600  // Reinitialising list used for minimal parallel communication
601  forAll(surfaceCellFacesOnProcPatches_, patchi)
602  {
603  surfaceCellFacesOnProcPatches_[patchi].clear();
604  }
605  }
606 
607  return syncedFaces;
608 }
609 
610 
611 void Foam::isoAdvection::checkIfOnProcPatch(const label facei)
612 {
613  if (!mesh_.isInternalFace(facei))
614  {
615  const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
616  const label patchi = pbm.patchID(facei);
617 
618  if (isA<processorPolyPatch>(pbm[patchi]) && !pbm[patchi].empty())
619  {
620  const label patchFacei = pbm[patchi].whichFace(facei);
621  surfaceCellFacesOnProcPatches_[patchi].append(patchFacei);
622  }
623  }
624 }
625 
626 
627 void Foam::isoAdvection::applyBruteForceBounding()
628 {
629  addProfilingInFunction(geometricVoF);
630  bool alpha1Changed = false;
631 
632  const scalar snapAlphaTol = dict_.getOrDefault<scalar>("snapTol", 0);
633  if (snapAlphaTol > 0)
634  {
635  alpha1_ =
636  alpha1_
637  *pos0(alpha1_ - snapAlphaTol)
638  *neg0(alpha1_ - (1.0 - snapAlphaTol))
639  + pos0(alpha1_ - (1.0 - snapAlphaTol));
640 
641  alpha1Changed = true;
642  }
643 
644  if (dict_.getOrDefault("clip", true))
645  {
646  alpha1_.clamp_range(zero_one{});
647  alpha1Changed = true;
648  }
649 
650  if (alpha1Changed)
651  {
652  alpha1_.correctBoundaryConditions();
653  }
654 }
655 
656 
658 {
659  if (!mesh_.time().writeTime()) return;
660 
661  if (dict_.getOrDefault("writeSurfCells", false))
662  {
663  cellSet cSet
664  (
665  IOobject
666  (
667  "surfCells",
668  mesh_.time().timeName(),
669  mesh_,
671  )
672  );
673 
674  cSet.insert(surfCells_);
676  cSet.write();
677  }
678 }
679 
680 
682 (
683  const DynamicList<List<point>>& faces
684 ) const
685 {
686  if (!writeIsoFacesToFile_ || !mesh_.time().writeTime()) return;
687 
688  // Writing isofaces to obj file for inspection, e.g. in paraview
689  const fileName outputFile
690  (
691  mesh_.time().globalPath()
692  / "isoFaces"
693  / word::printf("isoFaces_%012d.obj", mesh_.time().timeIndex())
694  );
695 
696  if (Pstream::parRun())
697  {
698  // Collect points from all the processors
699  List<DynamicList<List<point>>> allProcFaces(Pstream::nProcs());
700  allProcFaces[Pstream::myProcNo()] = faces;
701  Pstream::gatherList(allProcFaces);
702 
703  if (Pstream::master())
704  {
705  mkDir(outputFile.path());
706  OBJstream os(outputFile);
707  Info<< nl << "isoAdvection: writing iso faces to file: "
708  << os.name() << nl << endl;
709 
710  for
711  (
712  const DynamicList<List<point>>& procFacePts
713  : allProcFaces
714  )
715  {
716  for (const List<point>& facePts : procFacePts)
717  {
718  os.writeFace(facePts, false);
719  }
720  }
721  }
722  }
723  else
724  {
725  mkDir(outputFile.path());
726  OBJstream os(outputFile);
727  Info<< nl << "isoAdvection: writing iso faces to file: "
728  << os.name() << nl << endl;
729 
730  for (const List<point>& facePts : faces)
731  {
732  os.writeFace(facePts, false);
733  }
734  }
735 }
736 
737 
738 // ************************************************************************* //
faceListList boundary
Ostream & writeFace(const UList< point > &points, const bool lines=true)
Write face loop points with lines/filled-polygon.
Definition: OBJstream.C:279
const polyBoundaryMesh & pbm
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField...
static void syncFaceList(const polyMesh &mesh, UList< T > &faceValues, const CombineOp &cop, const bool parRun=UPstream::parRun())
Synchronize values on all mesh faces.
Definition: syncTools.H:465
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
List< cell > cellList
List of cell.
Definition: cellListFwd.H:39
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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:608
Type gMin(const FieldField< Field, Type > &f)
virtual const fileName & name() const override
Read/write access to the name of the stream.
Definition: OSstream.H:134
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
static void gatherList(const UList< commsStruct > &comms, UList< T > &values, const int tag, const label comm)
Gather data, but keep individual values separate. Uses the specified communication schedule...
const labelList & patchID() const
Per boundary face label the patch index.
void writeIsoFaces(const DynamicList< List< point >> &isoFacePts) const
Write isoface points to .obj file.
Definition: isoAdvection.C:675
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:1061
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
Definition: dimensionSets.H:65
const cellList & cells() const
GeometricBoundaryField< scalar, fvsPatchField, surfaceMesh > Boundary
Type of boundary fields.
Ignore writing from objectRegistry::writeObject()
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
Definition: quaternionI.H:674
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
Definition: UPstream.H:1086
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:360
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:76
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.
conserve primitiveFieldRef()+
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
void writeSurfaceCells() const
Return cellSet of surface cells.
Definition: isoAdvection.C:650
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:72
word timeName
Definition: getTimeIndex.H:3
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
Definition: UPstream.H:1077
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
dynamicFvMesh & mesh
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:614
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
const cellShapeList & cells
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:51
Calculate the gradient of the given field.
void clear()
Clear the list, i.e. set size to zero.
Definition: ListI.H:130
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
Definition: polyMesh.H:609
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.
label size() const noexcept
The number of entries in the list.
Definition: UPtrListI.H:106
dimensionedScalar neg0(const dimensionedScalar &ds)
Reading is optional [identical to LAZY_READ].
Vector< scalar > vector
Definition: vector.H:57
const vectorField & cellCentres() const
static int debug
Definition: cutFace.H:143
#define DebugInfo
Report an information message using Foam::Info.
static word printf(const char *fmt, const PrimitiveType &val)
Use a printf-style formatter for a primitive.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
dimensionedScalar pos0(const dimensionedScalar &ds)
void clear()
Clear the patch list and all demand-driven data.
const word & constant() const noexcept
Return constant name.
Definition: TimePathsI.H:112
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
IOdictionary porosityProperties(IOobject("porosityProperties", runTime.constant(), runTime, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE))
const vectorField & faceCentres() const
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
Definition: PtrList.H:344
U
Definition: pEqn.H:72
vector point
Point is a vector.
Definition: point.H:37
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const vectorField & faceAreas() const
const dimensionedScalar c
Speed of light in a vacuum.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Definition: UPstream.H:1094
const polyBoundaryMesh & patches
Nothing to be read.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
#define addProfilingInFunction(Name)
Define profiling trigger with specified name and description corresponding to the compiler-defined fu...
messageStream Info
Information stream (stdout output on master, null elsewhere)
phib
Definition: pEqn.H:190
List< label > labelList
A List of labels.
Definition: List.H:62
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
const labelListList & cellCells() const
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const labelListList & cellPoints() const
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.
const scalarField & cellVolumes() const
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127
const volScalarField & alpha1