Loading...
Searching...
No Matches
foamyHexMeshBackgroundMesh.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) 2012-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Application
28 foamyHexMeshBackGroundMesh
29
30Description
31 Writes out background mesh as constructed by foamyHexMesh and constructs
32 distanceSurface.
33
34\*---------------------------------------------------------------------------*/
35
36#include "PatchTools.H"
37#include "argList.H"
38#include "Time.H"
39#include "triSurface.H"
40#include "searchableSurfaces.H"
42#include "cellShapeControl.H"
44#include "cellShape.H"
45#include "DynamicField.H"
46#include "isoSurfaceCell.H"
48#include "syncTools.H"
49#include "decompositionModel.H"
50
51using namespace Foam;
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
56// usually meshes get written with limited precision (6 digits)
57static const scalar defaultMergeTol = 1e-6;
58
59// Get merging distance when matching face centres
60scalar getMergeDistance
61(
62 const argList& args,
63 const Time& runTime,
64 const boundBox& bb
65)
66{
67 const scalar mergeTol =
68 args.getOrDefault<scalar>("mergeTol", defaultMergeTol);
69
70 const scalar writeTol =
71 std::pow(scalar(10), -scalar(IOstream::defaultPrecision()));
72
73 Info<< "Merge tolerance : " << mergeTol << nl
74 << "Write tolerance : " << writeTol << endl;
75
76 if (runTime.writeFormat() == IOstreamOption::ASCII && mergeTol < writeTol)
77 {
79 << "Your current settings specify ASCII writing with "
80 << IOstream::defaultPrecision() << " digits precision." << endl
81 << "Your merging tolerance (" << mergeTol << ") is finer than this."
82 << endl
83 << "Please change your writeFormat to binary"
84 << " or increase the writePrecision" << endl
85 << "or adjust the merge tolerance (-mergeTol)."
86 << exit(FatalError);
87 }
88
89 scalar mergeDist = mergeTol * bb.mag();
90
91 Info<< "Overall meshes bounding box : " << bb << nl
92 << "Relative tolerance : " << mergeTol << nl
93 << "Absolute matching distance : " << mergeDist << nl
94 << endl;
95
96 return mergeDist;
97}
98
99
100void printMeshData(const polyMesh& mesh)
101{
102 // Collect all data on master
103
104 globalIndex globalCells(mesh.nCells());
105 labelListList patchNeiProcNo(Pstream::nProcs());
106 labelListList patchSize(Pstream::nProcs());
107 const labelList& pPatches = mesh.globalData().processorPatches();
108 patchNeiProcNo[Pstream::myProcNo()].setSize(pPatches.size());
109 patchSize[Pstream::myProcNo()].setSize(pPatches.size());
110 forAll(pPatches, i)
111 {
113 (
114 mesh.boundaryMesh()[pPatches[i]]
115 );
116 patchNeiProcNo[Pstream::myProcNo()][i] = ppp.neighbProcNo();
117 patchSize[Pstream::myProcNo()][i] = ppp.size();
118 }
119 Pstream::gatherList(patchNeiProcNo);
120 Pstream::gatherList(patchSize);
121
122
123 // Print stats
124
125 globalIndex globalBoundaryFaces(mesh.nBoundaryFaces());
126
127 label maxProcCells = 0;
128 label totProcFaces = 0;
129 label maxProcPatches = 0;
130 label totProcPatches = 0;
131 label maxProcFaces = 0;
132
133 for (const int proci : Pstream::allProcs())
134 {
135 Info<< endl
136 << "Processor " << proci << nl
137 << " Number of cells = " << globalCells.localSize(proci)
138 << endl;
139
140 label nProcFaces = 0;
141
142 const labelList& nei = patchNeiProcNo[proci];
143
144 forAll(patchNeiProcNo[proci], i)
145 {
146 Info<< " Number of faces shared with processor "
147 << patchNeiProcNo[proci][i] << " = " << patchSize[proci][i]
148 << endl;
149
150 nProcFaces += patchSize[proci][i];
151 }
152
153 Info<< " Number of processor patches = " << nei.size() << nl
154 << " Number of processor faces = " << nProcFaces << nl
155 << " Number of boundary faces = "
156 << globalBoundaryFaces.localSize(proci) << endl;
157
158 maxProcCells = max(maxProcCells, globalCells.localSize(proci));
159 totProcFaces += nProcFaces;
160 totProcPatches += nei.size();
161 maxProcPatches = max(maxProcPatches, nei.size());
162 maxProcFaces = max(maxProcFaces, nProcFaces);
163 }
164
165 // Stats
166
167 scalar avgProcCells = scalar(globalCells.size())/Pstream::nProcs();
168 scalar avgProcPatches = scalar(totProcPatches)/Pstream::nProcs();
169 scalar avgProcFaces = scalar(totProcFaces)/Pstream::nProcs();
170
171 // In case of all faces on one processor. Just to avoid division by 0.
172 if (totProcPatches == 0)
173 {
174 avgProcPatches = 1;
175 }
176 if (totProcFaces == 0)
177 {
178 avgProcFaces = 1;
179 }
180
181 Info<< nl
182 << "Number of processor faces = " << totProcFaces/2 << nl
183 << "Max number of cells = " << maxProcCells
184 << " (" << 100.0*(maxProcCells-avgProcCells)/avgProcCells
185 << "% above average " << avgProcCells << ")" << nl
186 << "Max number of processor patches = " << maxProcPatches
187 << " (" << 100.0*(maxProcPatches-avgProcPatches)/avgProcPatches
188 << "% above average " << avgProcPatches << ")" << nl
189 << "Max number of faces between processors = " << maxProcFaces
190 << " (" << 100.0*(maxProcFaces-avgProcFaces)/avgProcFaces
191 << "% above average " << avgProcFaces << ")" << nl
192 << endl;
193}
194
195
196// Return cellID
197label cellLabel
198(
199 const Vector<label>& nCells,
200 const label i,
201 const label j,
202 const label k
203)
204{
205 return i*nCells[1]*nCells[2]+j*nCells[2]+k;
206}
207
208label vtxLabel
209(
210 const Vector<label>& nCells,
211 const label i,
212 const label j,
213 const label k
214)
215{
217 (
218 nCells[0]+1,
219 nCells[1]+1,
220 nCells[2]+1
221 );
222 return i*nPoints[1]*nPoints[2]+j*nPoints[2]+k;
223}
224
225
226autoPtr<polyMesh> generateHexMesh
227(
228 const IOobject& io,
229 const point& origin,
230 const vector& cellSize,
231 const Vector<label>& nCells
232)
233{
235 if (nCells[0]+nCells[1]+nCells[2] > 0)
236 {
237 points.setSize((nCells[0]+1)*(nCells[1]+1)*(nCells[2]+1));
238
239 // Generate points
240 for (label i = 0; i <= nCells[0]; i++)
241 {
242 for (label j = 0; j <= nCells[1]; j++)
243 {
244 for (label k = 0; k <= nCells[2]; k++)
245 {
246 point pt = origin;
247 pt.x() += i*cellSize[0];
248 pt.y() += j*cellSize[1];
249 pt.z() += k*cellSize[2];
250 points[vtxLabel(nCells, i, j, k)] = pt;
251 }
252 }
253 }
254 }
255
256
258 cellShapeList cellShapes(nCells[0]*nCells[1]*nCells[2]);
259
260 labelList hexPoints(8);
261 label celli = 0;
262 for (label i = 0; i < nCells[0]; i++)
263 {
264 for (label j = 0; j < nCells[1]; j++)
265 {
266 for (label k = 0; k < nCells[2]; k++)
267 {
268 hexPoints[0] = vtxLabel(nCells, i, j, k);
269 hexPoints[1] = vtxLabel(nCells, i+1, j, k);
270 hexPoints[2] = vtxLabel(nCells, i+1, j+1, k);
271 hexPoints[3] = vtxLabel(nCells, i, j+1, k);
272 hexPoints[4] = vtxLabel(nCells, i, j, k+1);
273 hexPoints[5] = vtxLabel(nCells, i+1, j, k+1);
274 hexPoints[6] = vtxLabel(nCells, i+1, j+1, k+1);
275 hexPoints[7] = vtxLabel(nCells, i, j+1, k+1);
276 cellShapes[celli++].reset(hex, hexPoints);
277 }
278 }
279 }
280
284 word defaultFacesName = "defaultFaces";
285 word defaultFacesType = polyPatch::typeName;
286 wordList patchPhysicalTypes(0);
287
289 (
290 io,
291 std::move(points),
293 boundary,
298 patchPhysicalTypes
299 );
300}
301
302
303// Determine for every point a signed distance to the nearest surface
304// (outside is positive)
305tmp<scalarField> signedDistance
306(
307 const scalarField& distSqr,
308 const pointField& points,
309 const searchableSurfaces& geometry,
310 const labelList& surfaces
311)
312{
313 auto tfld = tmp<scalarField>::New(points.size(), Foam::sqr(GREAT));
314 auto& fld = tfld.ref();
315
316 // Find nearest
317 List<pointIndexHit> nearest;
318 labelList nearestSurfaces;
320 (
321 geometry,
322 surfaces,
323 points,
324 scalarField(points.size(), Foam::sqr(GREAT)),//distSqr
325 nearestSurfaces,
326 nearest
327 );
328
329 // Determine sign of nearest. Sort by surface to do this.
330 DynamicField<point> surfPoints(points.size());
331 DynamicList<label> surfIndices(points.size());
332
333 forAll(surfaces, surfI)
334 {
335 // Extract points on this surface
336 surfPoints.clear();
337 surfIndices.clear();
338 forAll(nearestSurfaces, i)
339 {
340 if (nearestSurfaces[i] == surfI)
341 {
342 surfPoints.append(points[i]);
343 surfIndices.append(i);
344 }
345 }
346
347 // Calculate sideness of these surface points
348 label geomI = surfaces[surfI];
349 List<volumeType> volType;
350 geometry[geomI].getVolumeType(surfPoints, volType);
351
352 // Push back to original
353 forAll(volType, i)
354 {
355 label pointi = surfIndices[i];
356 scalar dist = points[pointi].dist(nearest[pointi].hitPoint());
357
358 volumeType vT = volType[i];
359
360 if (vT == volumeType::OUTSIDE)
361 {
362 fld[pointi] = dist;
363 }
364 else if (vT == volumeType::INSIDE)
365 {
366 fld[i] = -dist;
367 }
368 else
369 {
371 << "getVolumeType failure, neither INSIDE or OUTSIDE"
372 << exit(FatalError);
373 }
374 }
375 }
376
377 return tfld;
378}
379
380
381
382// Main program:
383
384int main(int argc, char *argv[])
385{
387 (
388 "Generate foamyHexMesh-consistent representation of surfaces"
389 );
391 (
392 "writeMesh",
393 "Write the resulting mesh and distance fields"
394 );
396 (
397 "mergeTol",
398 "scalar",
399 "The merge distance relative to the bounding box size (default 1e-6)"
400 );
401
402 argList::noFunctionObjects(); // Never use function objects
403
404 #include "setRootCase.H"
405 #include "createTime.H"
406
407 const bool writeMesh = args.found("writeMesh");
408
409 if (writeMesh)
410 {
411 Info<< "Writing resulting mesh and cellDistance, pointDistance fields."
412 << nl << endl;
413 }
414
415
416 IOdictionary foamyHexMeshDict
417 (
419 (
420 "foamyHexMeshDict",
421 runTime.system(),
422 runTime,
425 )
426 );
427
428 // Define/load all geometry
429 searchableSurfaces allGeometry
430 (
432 (
433 "cvSearchableSurfaces",
434 runTime.constant(),
435 "triSurface",
436 runTime,
439 ),
440 foamyHexMeshDict.subDict("geometry"),
441 foamyHexMeshDict.getOrDefault("singleRegionName", true)
442 );
443
445
446 conformationSurfaces geometryToConformTo
447 (
448 runTime,
449 rndGen,
450 allGeometry,
451 foamyHexMeshDict.subDict("surfaceConformation")
452 );
453
454 cellShapeControl cellShapeControls
455 (
456 runTime,
457 foamyHexMeshDict.subDict("motionControl"),
458 allGeometry,
459 geometryToConformTo
460 );
461
462
463 // Generate starting block mesh
464 vector cellSize;
465 {
466 const treeBoundBox& bb = geometryToConformTo.globalBounds();
467
468 // Determine the number of cells in each direction.
469 const vector span = bb.span();
470 vector nScalarCells = span/cellShapeControls.defaultCellSize();
471
472 // Calculate initial cell size to be a little bit smaller than the
473 // defaultCellSize to avoid initial refinement triggering.
475 (
476 label(nScalarCells.x())+2,
477 label(nScalarCells.y())+2,
478 label(nScalarCells.z())+2
479 );
480 cellSize = vector
481 (
482 span[0]/nCells[0],
483 span[1]/nCells[1],
484 span[2]/nCells[2]
485 );
486
487 Info<< "Generating initial hex mesh with" << nl
488 << " bounding box : " << bb << nl
489 << " nCells : " << nCells << nl
490 << " cellSize : " << cellSize << nl
491 << endl;
492
494 (
495 generateHexMesh
496 (
498 (
500 runTime.constant(),
501 runTime
502 ),
503 bb.min(),
504 cellSize,
505 (
507 ? nCells
508 : Vector<label>(0, 0, 0)
509 )
510 )
511 );
512 Info<< "Writing initial hex mesh to " << meshPtr().instance() << nl
513 << endl;
514 meshPtr().write();
515 }
516
517 // Distribute the initial mesh
518 if (Pstream::parRun())
519 {
520 #include "createNamedMesh.H"
521 Info<< "Loaded mesh:" << endl;
522 printMeshData(mesh);
523
524 // Allow override of decomposeParDict location
525 const fileName decompDictFile =
526 args.getOrDefault<fileName>("decomposeParDict", "");
527
529 (
530 mesh,
531 decompDictFile
532 ).decomposer().decompose(mesh, mesh.cellCentres());
533
534 // Global matching tolerance
535 //const scalar tolDim = getMergeDistance
536 //(
537 // args,
538 // runTime,
539 // mesh.bounds()
540 //);
541
542 // Mesh distribution engine
543 fvMeshDistribute distributor(mesh);
544
545 Info<< "Wanted distribution:"
546 << distributor.countCells(decomp) << nl << endl;
547
548 // Do actual sending/receiving of mesh
549 autoPtr<mapDistributePolyMesh> map = distributor.distribute(decomp);
550
551 // Print some statistics
552 //Info<< "After distribution:" << endl;
553 //printMeshData(mesh);
554
555 mesh.setInstance(runTime.constant());
556 Info<< "Writing redistributed mesh" << nl << endl;
557 mesh.write();
558 }
559
560
561 Info<< "Refining background mesh according to cell size specification" << nl
562 << endl;
563
564 const dictionary& backgroundMeshDict =
565 foamyHexMeshDict.subDict("backgroundMeshDecomposition");
566
567 backgroundMeshDecomposition backgroundMesh
568 (
569 runTime,
570 rndGen,
571 geometryToConformTo,
572 backgroundMeshDict
573 );
574
575 if (writeMesh)
576 {
577 ++runTime;
578 Info<< "Writing mesh to " << runTime.timeName() << endl;
579 backgroundMesh.mesh().write();
580 }
581
582 const scalar tolDim = getMergeDistance
583 (
584 args,
585 runTime,
586 backgroundMesh.mesh().bounds()
587 );
588
589
590 faceList isoFaces;
591 pointField isoPoints;
592
593 {
594 // Apply a distanceSurface to it.
595 const fvMesh& fvm = backgroundMesh.mesh();
596
597 volScalarField cellDistance
598 (
600 (
601 "cellDistance",
602 fvm.time().timeName(),
603 fvm.time(),
607 ),
608 fvm,
610 );
611
612 const searchableSurfaces& geometry = geometryToConformTo.geometry();
613 const labelList& surfaces = geometryToConformTo.surfaces();
614
615
616 // Get maximum search size per cell
617 scalarField distSqr(cellDistance.size());
618
619 const labelList& cellLevel = backgroundMesh.cellLevel();
620 forAll(cellLevel, celli)
621 {
622 // The largest edge of the cell will always be less than the
623 // span of the bounding box of the cell.
624 distSqr[celli] = magSqr(cellSize)/pow(2, cellLevel[celli]);
625 }
626
627 {
628 // Internal field
629 cellDistance.primitiveFieldRef() = signedDistance
630 (
631 distSqr,
632 fvm.C(),
633 geometry,
634 surfaces
635 );
636
637 // Patch fields
638 volScalarField::Boundary& cellDistanceBf =
639 cellDistance.boundaryFieldRef();
640 forAll(fvm.C().boundaryField(), patchi)
641 {
642 const pointField& cc = fvm.C().boundaryField()[patchi];
643 fvPatchScalarField& fld = cellDistanceBf[patchi];
644 scalarField patchDistSqr
645 (
646 fld.patch().patchInternalField(distSqr)
647 );
648 fld = signedDistance(patchDistSqr, cc, geometry, surfaces);
649 }
650
651 // On processor patches the fvm.C() will already be the cell centre
652 // on the opposite side so no need to swap cellDistance.
653
654 if (writeMesh)
655 {
656 cellDistance.write();
657 }
658 }
659
660
661 // Distance to points
662 pointScalarField pointDistance
663 (
665 (
666 "pointDistance",
667 fvm.time().timeName(),
668 fvm.time(),
672 ),
675 );
676 {
677 scalarField pointDistSqr(fvm.nPoints(), -sqr(GREAT));
678 for (label facei = 0; facei < fvm.nInternalFaces(); facei++)
679 {
680 label own = fvm.faceOwner()[facei];
681 label ownDistSqr = distSqr[own];
682
683 const face& f = fvm.faces()[facei];
684 forAll(f, fp)
685 {
686 pointDistSqr[f[fp]] = max(pointDistSqr[f[fp]], ownDistSqr);
687 }
688 }
690 (
691 fvm,
692 pointDistSqr,
694 -sqr(GREAT) // null value
695 );
696
697 pointDistance.primitiveFieldRef() = signedDistance
698 (
699 pointDistSqr,
700 fvm.points(),
701 geometry,
702 surfaces
703 );
704
705 if (writeMesh)
706 {
707 pointDistance.write();
708 }
709 }
710
712 (
713 fvm,
714 cellDistance,
715 pointDistance,
716 scalar(0) // distance
717 );
718
719 isoFaces.setSize(iso.size());
720 forAll(isoFaces, i)
721 {
722 isoFaces[i] = iso[i];
723 }
724 isoPoints = iso.points();
725 }
726
727
728 pointField mergedPoints;
729 faceList mergedFaces;
731 (
732 tolDim,
733 primitivePatch(SubList<face>(isoFaces), isoPoints),
734 mergedPoints,
735 mergedFaces
736 );
737
738 if (Pstream::master())
739 {
741 (
742 mergedPoints,
743 mergedFaces,
744 (runTime.path() / "iso"),
745 false // serial only
746 );
747
748 writer.writeGeometry();
749 }
750
751 Info<< "End\n" << endl;
752
753 return 0;
754}
755
756
757// ************************************************************************* //
label k
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edgesCentres")))
Dynamically sized Field. Similar to DynamicList, but inheriting from a Field instead of a List.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
@ ASCII
"ascii" (normal default)
static unsigned int defaultPrecision() noexcept
Return the default precision.
Definition IOstream.H:437
void setSize(label n)
Alias for resize().
Definition List.H:536
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
static void gatherAndMerge(const scalar mergeDist, const PrimitivePatch< FaceList, PointField > &pp, Field< typename PrimitivePatch< FaceList, PointField >::point_type > &mergedPoints, List< typename PrimitivePatch< FaceList, PointField >::face_type > &mergedFaces, globalIndex &pointAddr, globalIndex &faceAddr, labelList &pointMergeMap=const_cast< labelList & >(labelList::null()), const bool useLocal=false)
Gather points and faces onto master and merge into single patch.
static void gatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate.
Random number generator.
Definition Random.H:56
A non-owning sub-view of a List (allocated or unallocated storage).
Definition SubList.H:61
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
Definition UPstream.H:1706
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
Definition UPstream.H:1669
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Definition UPstream.H:1714
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:1697
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
Definition UPstream.H:1857
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition Vector.H:61
const Cmpt & x() const noexcept
Access to the vector x component.
Definition Vector.H:135
const Cmpt & z() const noexcept
Access to the vector z component.
Definition Vector.H:145
const Cmpt & y() const noexcept
Access to the vector y component.
Definition Vector.H:140
Extract command arguments and options from the supplied argc and argv parameters.
Definition argList.H:119
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
Definition argList.C:562
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Definition argList.C:389
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Definition argList.C:400
static void addNote(const string &note)
Add extra notes for the usage information.
Definition argList.C:477
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition autoPtr.H:178
Store a background polyMesh to use for the decomposition of space and queries for parallel conformalV...
A bounding box defined in terms of min/max extrema points.
Definition boundBox.H:71
const point & min() const noexcept
Minimum describing the bounding box.
Definition boundBoxI.H:162
scalar mag() const
The magnitude/length of the bounding box diagonal.
Definition boundBoxI.H:198
vector span() const
The bounding box span (from minimum to maximum).
Definition boundBoxI.H:192
Maps a geometry to a set of cell primitives.
Definition cellModel.H:73
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
Definition cellModels.C:150
static const decompositionModel & New(const polyMesh &mesh, const fileName &decompDictFile="", const dictionary *fallback=nullptr)
Read and register on mesh, optionally with alternative decomposeParDict path/name or with fallback co...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition dictionary.C:441
A face is a list of labels corresponding to mesh vertices.
Definition face.H:71
A class for handling file names.
Definition fileName.H:75
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Definition globalIndex.H:77
A surface formed by the iso value. After "Polygonising A Scalar Field Using Tetrahedrons",...
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
static word defaultRegion
Return the default region name.
Definition polyMesh.H:406
Neighbour processor patch.
int neighbProcNo() const noexcept
Return neighbour processor number.
static void findNearest(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &)
Find nearest. Return -1 (and a miss()) or surface and nearest.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
static void syncPointList(const polyMesh &mesh, List< T > &pointValues, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
Standard boundBox with extra functionality for use in octree.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition volumeType.H:56
@ OUTSIDE
A location outside the volume.
Definition volumeType.H:66
@ INSIDE
A location inside the volume.
Definition volumeType.H:65
Write faces/points (optionally with fields) as a vtp file or a legacy vtk file.
A class for handling words, derived from Foam::string.
Definition word.H:66
cellShapeList cellShapes
faceListList boundary
dynamicFvMesh & mesh
engineTime & runTime
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
Required Classes.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
const auto & io
const pointField & points
label nPoints
Namespace of functions to calculate implicit derivatives returning a matrix.
Namespace for OpenFOAM.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
List< word > wordList
List of word.
Definition fileName.H:60
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
List< label > labelList
A List of labels.
Definition List.H:62
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
List< face > faceList
List of faces.
Definition faceListFwd.H:41
IOstream & hex(IOstream &io)
Definition IOstream.H:579
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
List< faceList > faceListList
List of faceList.
Definition faceListFwd.H:44
vector point
Point is a vector.
Definition point.H:37
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
List< cellShape > cellShapeList
List of cellShape.
fvPatchField< scalar > fvPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
wordList patchTypes(nPatches)
wordList patchNames(nPatches)
labelList f(nPoints)
word defaultFacesName
word defaultFacesType
Foam::argList args(argc, argv)
volScalarField & e
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
Random rndGen