56 bool limitRefinementLevel
69 const labelList& cCells = cellCells[celli];
73 if (refLevel[cCells[i]] > (refLevel[celli]+1))
83 if (refCells.
size() > oldNCells)
85 Info<<
"Added an additional " << refCells.
size() - oldNCells
86 <<
" cells to satisfy 1:2 refinement level"
99 int main(
int argc,
char *argv[])
104 "read level from refinementLevel file"
111 Info<<
"Dividing cells into bins depending on cell volume.\nThis will"
112 <<
" correspond to refinement levels for a mesh with only 2x2x2"
114 <<
"The upper range for every bin is always 1.1 times the lower range"
115 <<
" to allow for some truncation error."
133 lowerLimits.
append(sortedVols[0]);
138 if (sortedVols[i] > upperLimits.
last())
147 Info<<
"Collected " << bin.
size() <<
" elements in bin "
148 << lowerLimits.
last() <<
" .. "
153 lowerLimits.
append(sortedVols[i]);
156 Info<<
"Creating new bin " << lowerLimits.
last()
157 <<
" .. " << upperLimits.
last()
164 bin.
append(sortedVols.indices()[i]);
168 bins.
last().shrink();
178 Info<<
"Volume bins:" <<
nl;
187 cells.insert(bin[i]);
190 Info<<
" " << lowerLimits[binI] <<
" .. " << upperLimits[binI]
191 <<
" : writing " << bin.
size() <<
" cells to cellSet "
229 fMesh.addFvPatches(
p);
241 if (!readLevel && refHeader.headerOk())
244 <<
"Detected " << refHeader.name() <<
" file in "
246 <<
" recreate it or use the -readLevel option to use it"
292 refLevel[bin[i]] = bins.
size() - binI - 1;
293 postRefLevel[bin[i]] = refLevel[bin[i]];
298 postRefLevel.boundaryFieldRef();
309 Info<<
"Setting field for patch "<<
endl;
315 bField[facei] = postRefLevel[own];
319 Info<<
"Determined current refinement level and writing to "
320 << postRefLevel.name() <<
" (as volScalarField; for post processing)"
323 <<
" (as labelIOList; for meshing)" <<
nl
327 postRefLevel.write();
333 cellSet refCells(mesh,
"refCells", 100);
348 Info<<
"Collected " << refCells.
size() <<
" cells that need to be"
349 <<
" refined to get closer to overall 2:1 refinement level limit"
351 <<
"Written cells to be refined to cellSet " << refCells.
name()
356 Info<<
"After refinement this tool can be run again to see if the 2:1"
357 <<
" limit is observed all over the mesh" <<
nl <<
endl;
361 Info<<
"All cells in the mesh observe the 2:1 refinement level limit"
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
Generic GeometricBoundaryField class.
Generic GeometricField class.
bool insert(const Key &key)
Insert a new entry.
label size() const
Return number of elements in table.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const word & name() const
Return name.
void size(const label)
Override size to be inconsistent with allocated storage.
A list that is sorted upon construction or when explicitly requested with the sort() method.
T & last()
Return the last element of the list.
label size() const
Return the number of elements in the UPtrList.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
A collection of cell labels.
Mesh data needed to do the Finite Volume discretisation.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
static word defaultRegion
Return the default region name.
A patch is a list of labels that address the faces in the global face list.
label start() const
Return start label of this patch in the polyMesh face list.
Cell-face mesh analysis engine.
virtual const faceList & faces() const =0
Return faces.
const scalarField & cellVolumes() const
virtual const labelList & faceOwner() const =0
Face face-owner addressing.
const labelListList & cellCells() const
virtual const pointField & points() const =0
Return mesh points.
const cellList & cells() const
virtual bool write(const bool write=true) const
Write using setting from DB.
Templated form of IOobject providing type information for file reading and header type checking.
int main(int argc, char *argv[])
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
const dimensionSet dimless
const dimensionSet dimTime
IOList< label > labelIOList
Label container classes.
Foam::argList args(argc, argv)