76label sizeCoeffToRefinement
78 const scalar level0Coeff,
79 const scalar sizeCoeff
82 return round(
::log(level0Coeff/sizeCoeff)/
::log(2));
91 const label gapLevelIncrement,
92 const scalar level0Coeff
101 const word& geomName = allGeometry.
names()[geomi];
103 if (surfacesDict.
found(geomName))
119 List<Map<label>> regionMinLevel(surfi);
120 List<Map<label>> regionMaxLevel(surfi);
121 List<Map<label>> regionLevelIncr(surfi);
122 List<Map<scalar>> regionAngle(surfi);
123 List<Map<autoPtr<dictionary>>> regionPatchInfo(surfi);
130 const word& geomName = allGeometry.
names()[geomi];
139 names[surfi] = geomName;
140 surfaces[surfi] = geomi;
147 const word scsFuncName =
148 shapeDict.
get<
word>(
"surfaceCellSizeFunction");
153 const scalar surfaceCellSize =
154 scsDict.
get<scalar>(
"surfaceCellSizeCoeff");
156 const label refLevel = sizeCoeffToRefinement
162 globalMinLevel[surfi] = refLevel;
163 globalMaxLevel[surfi] = refLevel;
164 globalLevelIncr[surfi] = gapLevelIncrement;
180 if (shapeDict.
found(
"patchInfo"))
192 if (shapeDict.
found(
"regions"))
196 allGeometry[surfaces[surfi]].regions();
208 if (regionDict.
found(
"patchInfo"))
210 regionPatchInfo[surfi].insert
221 if (shapeDict.
found(
"regions"))
226 allGeometry[surfaces[surfi]].regions();
233 shapeControlRegionsDict.
subDict
238 const word scsFuncName =
239 shapeControlRegionDict.
get<
word>
241 "surfaceCellSizeFunction"
246 scsFuncName +
"Coeffs"
249 const scalar surfaceCellSize =
250 scsDict.
get<scalar>(
"surfaceCellSizeCoeff");
252 const label refLevel = sizeCoeffToRefinement
258 regionMinLevel[surfi].insert(regioni, refLevel);
259 regionMaxLevel[surfi].insert(regioni, refLevel);
260 regionLevelIncr[surfi].insert(regioni, 0);
274 regionOffset[surfi] = nRegions;
275 nRegions += allGeometry[surfaces[surfi]].regions().
size();
284 forAll(globalMinLevel, surfi)
286 label nRegions = allGeometry[surfaces[surfi]].regions().
size();
289 for (label i = 0; i < nRegions; i++)
291 label globalRegioni = regionOffset[surfi] + i;
292 minLevel[globalRegioni] = globalMinLevel[surfi];
293 maxLevel[globalRegioni] = globalMaxLevel[surfi];
294 gapLevel[globalRegioni] =
295 maxLevel[globalRegioni]
296 + globalLevelIncr[surfi];
298 if (globalPatchInfo.set(surfi))
303 globalPatchInfo[surfi].clone()
311 label globalRegioni = regionOffset[surfi] + iter.key();
313 minLevel[globalRegioni] = iter();
314 maxLevel[globalRegioni] = regionMaxLevel[surfi][iter.key()];
315 gapLevel[globalRegioni] =
316 maxLevel[globalRegioni]
317 + regionLevelIncr[surfi][iter.key()];
323 label globalRegioni = regionOffset[surfi] + iter.key();
324 patchInfo.
set(globalRegioni, iter()().clone());
363 <<
setw(10) <<
"Min Level"
364 <<
setw(10) <<
"Max Level"
365 <<
setw(10) <<
"Gap Level" <<
nl
366 <<
setw(maxLen) <<
"------"
367 <<
setw(10) <<
"---------"
368 <<
setw(10) <<
"---------"
409 for (
const label patchi : includePatches)
412 patchSize.insert(
pp.name(),
pp.size());
424 compactZoneID.insert(iter.key(), compactZoneID.size());
434 label patchi =
bMesh.findPatchID(iter.key());
437 patchToCompactZone[patchi] = iter.val();
444 for (
const label patchi : includePatches)
450 compactZones.append(patchToCompactZone[
pp.index()]);
467 allBoundary.meshPoints(),
468 allBoundary.meshPointMap(),
504 gatheredPoints.clear();
511 gatheredFaces.clear();
518 gatheredZones.clear();
526 Info<<
"surfZone " << iter() <<
" : " << surfZones[iter()].name()
532 std::move(allPoints),
544 ?
runTime.globalPath()/outFileName
547 globalCasePath.clean();
549 Info<<
"Writing merged surface to " << globalCasePath <<
endl;
551 sortedFace.write(globalCasePath);
562 label nUnaligned = 0;
566 const face&
f = faces[facei];
569 label fp1 =
f.fcIndex(fp);
572 const scalar magV(
mag(v));
573 if (magV > ROOTVSMALL)
578 dir < pTraits<vector>::nComponents;
582 const scalar
s(
mag(v[dir]));
583 if (
s > magV*tol &&
s < magV*(1-tol))
597 os <<
"Initial mesh has " << nUnaligned
598 <<
" edges unaligned with any of the coordinate axes" <<
nl <<
endl;
605scalar getMergeDistance
608 const scalar mergeTol,
613 scalar mergeDist = mergeTol *
meshBb.mag();
616 <<
"Overall mesh bounding box : " <<
meshBb <<
nl
617 <<
"Relative tolerance : " << mergeTol <<
nl
618 <<
"Absolute matching distance : " << mergeDist <<
nl
624 const scalar writeTol = std::pow
630 if (mergeTol < writeTol)
633 <<
"Your current settings specify ASCII writing with "
635 <<
"Your merging tolerance (" << mergeTol
636 <<
") is finer than this." <<
nl
637 <<
"Change to binary writeFormat, "
638 <<
"or increase the writePrecision" <<
endl
639 <<
"or adjust the merge tolerance (mergeTol)."
673 oldToNew[patchi] = newPatchi++;
684 oldToNew[patchi] = newPatchi++;
689 const label nKeepPatches = newPatchi;
692 if (nKeepPatches !=
pbm.size())
699 if (oldToNew[patchi] == -1)
702 <<
" type " <<
pbm[patchi].type()
703 <<
" at position " << patchi <<
endl;
704 oldToNew[patchi] = newPatchi++;
746 Info<<
"Wrote mesh in = "
747 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
751int main(
int argc,
char *argv[])
755 "Automatic split hex mesher. Refines and snaps to surface"
764 "Check all surface geometry for quality"
768 "Check case set-up only using a single time step"
774 "Simplify the surface using snappyHexMesh starting from a boundBox"
779 "(patch0 .. patchN)",
780 "Only triangulate selected patches (wildcards supported)"
786 "Name of the file to save the simplified surface to"
795 const bool overwrite =
args.found(
"overwrite");
797 const bool surfaceSimplify =
args.found(
"surfaceSimplify");
798 const bool dryRun =
args.dryRun();
802 Info<<
"Operating in dry-run mode to detect set-up errors"
808 Info<<
"Read mesh in = "
812 mesh.boundaryMesh().checkParallelSync(
true);
861 const scalar mergeDist = getMergeDistance
873 const bool keepPatches(
meshDict.getOrDefault(
"keepPatches",
false));
878 const word writerType
883 coordSetWriters::vtkWriter::typeName
890 meshDict.subOrEmptyDict(
"formatOptions").optionalSubDict(writerType)
901 surfaceWriters::vtkWriter::typeName
907 meshDict.subOrEmptyDict(
"formatOptions").optionalSubDict(
type)
912 const scalar maxSizeRatio
914 meshDict.getOrDefault<scalar>(
"maxSizeRatio", 100)
948 decomposeDict = *dictPtr;
952 decomposeDict.
add(
"method",
"none");
953 decomposeDict.
add(
"numberOfSubdomains", 1);
971 if (
meshDict.readIfPresent(
"debugFlags", flags))
985 meshRefinement::debug = debugLevel;
986 snappyRefineDriver::debug = debugLevel;
987 snappySnapDriver::debug = debugLevel;
988 snappyLayerDriver::debug = debugLevel;
994 if (
meshDict.readIfPresent(
"writeFlags", flags))
1040 mesh.time().constant(),
1048 meshDict.getOrDefault(
"singleRegionName",
true)
1057 Info<<
"Reading refinement surfaces." <<
endl;
1059 if (surfaceSimplify)
1061 addProfiling(surfaceSimplify,
"snappyHexMesh::surfaceSimplify");
1077 "geometryToConformTo"
1081 foamyHexMeshDict.
subDict(
"motionControl");
1084 motionDict.
subDict(
"shapeControlFunctions");
1087 const scalar defaultCellSize =
1088 motionDict.
get<scalar>(
"defaultCellSize");
1090 const scalar initialCellSize =
::pow(
mesh.V()[0], 1.0/3.0);
1098 createRefinementSurfaces
1104 initialCellSize/defaultCellSize
1119 "refinementSurfaces",
1127 Info<<
"Read refinement surfaces in = "
1128 <<
mesh.time().cpuTimeIncrement() <<
" s" <<
nl <<
endl;
1145 forAll(surfaceGeometry, surfi)
1147 label geomi = surfaceGeometry[surfi];
1151 forAll(regNames, regioni)
1153 label globalRegioni = surfaces.
globalRegion(surfi, regioni);
1155 if (patchInfo.
set(globalRegioni))
1160 patchInfo[globalRegioni],
1169 patchTypes[geomi][regioni] = wallPolyPatch::typeName;
1198 Info<<
"Checking for geometry size relative to mesh." <<
endl;
1200 forAll(allGeometry, geomi)
1206 if (ratio > maxSizeRatio || ratio < 1.0/maxSizeRatio)
1209 <<
" " << allGeometry.
names()[geomi]
1210 <<
" bounds differ from mesh"
1211 <<
" by more than a factor " << maxSizeRatio <<
":" <<
nl
1212 <<
" bounding box : " << bb <<
nl
1213 <<
" mesh bounding box : " <<
meshBb
1216 if (!
meshBb.contains(bb))
1219 <<
" " << allGeometry.
names()[geomi]
1220 <<
" bounds not fully contained in mesh" <<
nl
1221 <<
" bounding box : " << bb <<
nl
1222 <<
" mesh bounding box : " <<
meshBb
1235 Info<<
"Reading refinement shells." <<
endl;
1242 Info<<
"Read refinement shells in = "
1243 <<
mesh.time().cpuTimeIncrement() <<
" s" <<
nl <<
endl;
1246 Info<<
"Setting refinement level of surface to be consistent"
1247 <<
" with shells." <<
endl;
1249 Info<<
"Checked shell refinement in = "
1250 <<
mesh.time().cpuTimeIncrement() <<
" s" <<
nl <<
endl;
1258 if (!limitDict.empty())
1260 Info<<
"Reading limit shells." <<
endl;
1265 if (!limitDict.empty())
1267 Info<<
"Read limit shells in = "
1268 <<
mesh.time().cpuTimeIncrement() <<
" s" <<
nl <<
endl;
1277 unusedGeometries.erase(surfaces.
surfaces());
1278 unusedGeometries.erase(shells.shells());
1279 unusedGeometries.erase(limitShells.shells());
1281 if (unusedGeometries.size())
1284 <<
"The following geometry entries are not used:" <<
nl;
1285 for (
const label geomi : unusedGeometries)
1287 Info<<
" " << allGeomNames[geomi] <<
nl;
1299 Info<<
"Reading features." <<
endl;
1309 Info<<
"Read features in = "
1310 <<
mesh.time().cpuTimeIncrement() <<
" s" <<
nl <<
endl;
1316 Info<<
"Checking for line geometry size relative to surface geometry."
1320 bool hasErrors = features.checkSizes
1338 <<
"Determining initial surface intersections" <<
nl
1339 <<
"-----------------------------------------" <<
nl
1360 Info<<
"Calculated surface intersections in = "
1361 <<
mesh.time().cpuTimeIncrement() <<
" s" <<
nl <<
endl;
1365 meshRefiner.
printMeshInfo(debugLevel,
"Initial mesh",
true);
1382 Info<<
"Setting refinement level of surface to be consistent"
1383 <<
" with curvature." <<
endl;
1386 refineParams.curvature(),
1389 Info<<
"Checked curvature refinement in = "
1390 <<
mesh.time().cpuTimeIncrement() <<
" s" <<
nl <<
endl;
1414 refineParams.addCellZonesToMesh(
mesh);
1429 <<
"Adding patches for surface regions" <<
nl
1430 <<
"----------------------------------" <<
nl
1440 <<
setw(6) <<
"Patch"
1441 <<
setw(20) <<
"Type"
1442 <<
setw(30) <<
"Region" <<
nl
1443 <<
setw(6) <<
"-----"
1444 <<
setw(20) <<
"----"
1452 forAll(surfaceGeometry, surfi)
1454 label geomi = surfaceGeometry[surfi];
1464 surfaces.
surfZones()[surfi].faceZoneNames();
1466 if (fzNames.
empty())
1475 if (surfacePatchInfo.
set(globalRegioni))
1480 surfacePatchInfo[globalRegioni]
1486 patchInfo.
set(
"type", wallPolyPatch::typeName);
1498 <<
setw(6) << patchi
1499 <<
setw(20) <<
pbm[patchi].type()
1500 <<
setw(30) << regNames[i] <<
nl;
1503 globalToMasterPatch[globalRegioni] = patchi;
1504 globalToSlavePatch[globalRegioni] = patchi;
1518 if (surfacePatchInfo.
set(globalRegioni))
1523 surfacePatchInfo[globalRegioni]
1529 patchInfo.
set(
"type", wallPolyPatch::typeName);
1541 <<
setw(6) << patchi
1542 <<
setw(20) <<
pbm[patchi].type()
1543 <<
setw(30) << regNames[i] <<
nl;
1546 globalToMasterPatch[globalRegioni] = patchi;
1550 const word slaveName = regNames[i] +
"_slave";
1553 if (surfacePatchInfo.
set(globalRegioni))
1558 surfacePatchInfo[globalRegioni]
1564 patchInfo.
set(
"type", wallPolyPatch::typeName);
1576 <<
setw(6) << patchi
1577 <<
setw(20) <<
pbm[patchi].type()
1578 <<
setw(30) << slaveName <<
nl;
1581 globalToSlavePatch[globalRegioni] = patchi;
1587 if (regNames.
size())
1591 const word& fzName = fzNames[fzi];
1592 label globalRegioni = surfaces.
globalRegion(surfi, fzi);
1597 pbm[globalToMasterPatch[globalRegioni]].
name(),
1598 pbm[globalToSlavePatch[globalRegioni]].
name(),
1610 Info<<
"Added patches in = "
1611 <<
mesh.time().cpuTimeIncrement() <<
" s" <<
nl <<
endl;
1622 const word& fzName =
mesh.faceZones()[zonei].name();
1632 string::size_type i = fzName.find(
"_to_");
1633 if (i != string::npos)
1635 word cz0 = fzName.substr(0, i);
1636 word cz1 = fzName.substr(i+4, fzName.size()-i+4);
1637 word slaveName(cz1 +
"_to_" + cz0);
1638 faceZoneToPatches.
insert(fzName, Pair<word>(fzName, slaveName));
1643 const word slaveName = fzName +
"_slave";
1644 faceZoneToPatches.
insert(fzName, Pair<word>(fzName, slaveName));
1649 if (faceZoneToPatches.
size())
1671 nFaces +=
pbm[adaptPatchIDs[i]].size();
1706 <<
"You have selected decomposition method "
1707 << decomposer.typeName
1708 <<
" which is not parallel aware." <<
endl
1709 <<
"Please select one that is (hierarchical, ptscotch)"
1723 const bool wantRefine
1731 const bool wantLayers
1741 if (errorMsg.size() || IOerrorMsg.size())
1750 <<
"Missing/incorrect required dictionary entries:" <<
nl
1752 << IOerrorMsg.c_str() <<
nl
1753 << errorMsg.c_str() <<
nl <<
nl
1754 <<
"Exiting dry-run" <<
nl <<
endl;
1768 const bool mergePatchFaces
1770 meshDict.getOrDefault(
"mergePatchFaces",
true)
1773 if (!mergePatchFaces)
1775 Info<<
"Not merging patch-faces of cell to preserve"
1776 <<
" (split)hex cell shape."
1782 const bool mergeAcrossPatches
1784 meshDict.getOrDefault(
"mergeAcrossPatches",
false)
1787 if (mergeAcrossPatches)
1789 Info<<
"Merging co-planar patch-faces of cells"
1790 <<
", regardless of patch assignment"
1808 globalToMasterPatch,
1816 if (!overwrite && !debugLevel)
1822 refineDriver.doRefine
1827 refineParams.handleSnapProblems(),
1833 if (!keepPatches && !wantSnap && !wantLayers)
1849 Info<<
"Mesh refined in = "
1850 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
1862 globalToMasterPatch,
1867 if (!overwrite && !debugLevel)
1873 scalar curvature = refineParams.curvature();
1874 scalar planarAngle = refineParams.planarAngle();
1887 if (!keepPatches && !wantLayers)
1903 Info<<
"Mesh snapped in = "
1904 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
1917 mesh.boundaryMesh(),
1924 globalToMasterPatch,
1930 const bool preBalance =
1934 if (!overwrite && !debugLevel)
1939 layerDriver.doLayers
1967 Info<<
"Layers added in = "
1968 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
1978 Info<<
"Checking final mesh ..." <<
endl;
1989 Info<<
"Finished meshing with " << nErrors <<
" illegal faces"
1990 <<
" (concave, zero area or negative cell pyramid volume)"
1996 Info<<
"Finished meshing without any errors" <<
endl;
2003 if (surfaceSimplify)
2005 addProfiling(surfaceSimplify,
"snappyHexMesh::surfaceSimplify");
2011 if (
args.found(
"patches"))
2013 includePatches =
bMesh.patchSet
2026 includePatches.insert(patchi);
2036 "constant/triSurface/simplifiedSurface.stl"
2052 "internalCellCentres",
2061 cellCentres.write();
2066 Info<<
"Finished meshing in = "
2075 if (errorMsg.size() || IOerrorMsg.size())
2083 <<
"Missing/incorrect required dictionary entries:" <<
nl
2085 << IOerrorMsg.c_str() <<
nl
2086 << errorMsg.c_str() <<
nl <<
nl
2087 <<
"Exiting dry-run" <<
nl <<
endl;
Istream and Ostream manipulators taking arguments.
labelList faceLabels(nFaceLabels)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A HashTable similar to std::unordered_map.
bool set(const Key &key, const T &obj)
Copy assign a new entry, overwriting existing entries.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
bool erase(T *item)
Remove the specified element from the list and delete it.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ REGISTER
Request registration (bool: true).
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
@ ASCII
"ascii" (normal default)
static unsigned int defaultPrecision() noexcept
Return the default precision.
void setSize(label n)
Alias for resize().
A HashTable to objects of type <T> with a label key.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static void mapCombineGather(Container &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::mapGather with an in-place cop.
static void gatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate.
static void broadcast(Type &value, const int communicator=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A List with indirect addressing. Like IndirectList but does not store addressing.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
label size() const noexcept
The number of entries in the list.
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
A bounding box defined in terms of min/max extrema points.
scalar mag() const
The magnitude/length of the bounding box diagonal.
static autoPtr< coordSetWriter > New(const word &writeFormat)
Return a reference to the selected writer.
Abstract base class for domain decomposition.
static autoPtr< decompositionMethod > New(const dictionary &decompDict, const word ®ionName="")
Return a reference to the selected decomposition method, optionally region-specific.
virtual bool parallelAware() const =0
Is method parallel aware?
static const word canonicalName
The canonical name ("decomposeParDict") under which the MeshObject is registered.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
Find and return a sub-dictionary as a copy, otherwise return an empty dictionary.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
autoPtr< dictionary > clone() const
Construct and return clone.
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
wordList toc() const
Return the table of contents.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A keyword and a list of tokens is an 'entry'.
const keyType & keyword() const noexcept
Return keyword.
virtual const dictionary & dict() const =0
Return dictionary, if entry is a dictionary, otherwise Fatal.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Mesh data needed to do the Finite Volume discretisation.
scalar level0EdgeLength() const
Typical edge length between unrefined points.
@ REGEX
Regular expression.
Simple container to keep together layer specific information.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
label addFaceZone(const word &fzName, const word &masterPatch, const word &slavePatch, const surfaceZonesInfo::faceZoneType &fzType)
Add/lookup faceZone and update information. Return index of.
bool getFaceZoneInfo(const word &fzName, label &masterPatchID, label &slavePatchID, surfaceZonesInfo::faceZoneType &fzType) const
Lookup faceZone information. Return false if no information.
static ITstream & lookup(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX)
Wrapper around dictionary::lookup which does not exit.
void printMeshInfo(const bool debug, const string &msg, const bool printCellLevel) const
Print some mesh stats.
MeshType
Enumeration for how to operate.
static const Enum< MeshType > MeshTypeNames
void updateIntersections(const labelUList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
static Type get(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX, const Type &deflt=Zero)
Wrapper around dictionary::get which does not exit.
writeType
Enumeration for what to write. Used as a bit-pattern.
const hexRef8 & meshCutter() const
Reference to meshcutting engine.
static const Enum< writeType > writeTypeNames
static int readFlags(const EnumContainer &namedEnum, const wordList &words)
Helper: convert wordList into bit pattern using provided Enum.
static FOAM_NO_DANGLING_REFERENCE const dictionary & subDict(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX)
Wrapper around dictionary::subDict which does not exit.
word timeName() const
Replacement for Time::timeName() that returns oldInstance (if overwrite_).
debugType
Enumeration for what to debug. Used as a bit-pattern.
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
const fvMesh & mesh() const
Reference to mesh.
FaceMergeType
Enumeration for what to do with co-planar patch faces on a single.
bool write() const
Write mesh and all data.
static const Enum< debugType > debugTypeNames
static writeType writeLevel()
Get/set write level.
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces, const bool dryRun=false)
Check mesh with mesh settings in dict. Collects incorrect faces.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
static bool writeNow()
Write profiling information now.
A class for managing references or pointers (no reference counting).
Encapsulates queries for features.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
Simple container to keep together refinement specific information.
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
const labelList & gapLevel() const
From global region number to small gap refinement level.
const PtrList< dictionary > & patchInfo() const
From global region number to patch type.
const wordList & names() const
Names of surfaces.
label globalRegion(const label surfI, const label regionI) const
From surface and region on surface to global region.
const labelList & surfaces() const
void setCurvatureMinLevelFields(const scalar cosAngle, const scalar level0EdgeLength)
Update minLevelFields according to (triSurface-only) curvature.
const labelList & minLevel() const
From global region number to refinement level.
const labelList & maxLevel() const
From global region number to refinement level.
void setMinLevelFields(const shellSurfaces &shells)
Calculate minLevelFields according to both surface- and.
const PtrList< surfaceZonesInfo > & surfZones() const
virtual void rename(const word &newName)
Rename.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
const wordList & names() const
Surface names, not region names.
label checkTopology(const bool report) const
All topological checks. Return number of failed checks.
label checkGeometry(const scalar maxRatio, const scalar tolerance, autoPtr< coordSetWriter > &setWriter, const scalar minQuality, const bool report) const
All geometric checks. Return number of failed checks.
void writeStats(const List< wordList > &, Ostream &) const
Write some stats.
const List< wordList > & regionNames() const
Region names per surface.
Encapsulates queries for volume refinement ('refine all cells within shell').
Simple container to keep together snap specific information.
All to do with adding layers.
static void addFaceZones(meshRefinement &meshRefiner, const refinementParameters &refineParams, const HashTable< Pair< word > > &faceZoneToPatches)
Helper: add faceZones and patches.
All to do with snapping to surface.
Identifies a surface patch/zone by name and index, with optional geometric type.
static autoPtr< surfaceWriter > New(const word &writeType)
Select construct a surfaceWriter.
faceZoneType
What to do with faceZone faces.
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName).
static labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
Implements a timeout mechanism via sigalarm.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const IOdictionary & meshDict
const word dictName("faMeshDefinition")
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
return returnReduce(nRefine-oldNRefine, sumOp< label >())
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc).
const std::string patch
OpenFOAM patch number as a std::string.
List< word > wordList
List of word.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
List< label > labelList
A List of labels.
label checkGeometry(const polyMesh &mesh, const bool allGeometry, autoPtr< surfaceWriter > &surfWriter, autoPtr< coordSetWriter > &setWriter)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
List< surfZoneIdentifier > surfZoneIdentifierList
List of surfZoneIdentifier.
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
Smanip< std::ios_base::fmtflags > setf(std::ios_base::fmtflags flags)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
vectorIOField pointIOField
pointIOField is a vectorIOField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Omanip< int > setw(const int i)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
line< point, const point & > linePointRef
A line using referred points.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
PrimitivePatch< List< face >, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points).
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
cpuTimePosix cpuTime
Selection of preferred clock mechanism for the elapsed cpu time.
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text.
constexpr char nl
The newline '\n' character (0x0a).
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...
wordList patchTypes(nPatches)
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Object access operator or list access operator (default is pass-through).