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"
autoPtr< IOobject > clone() const
Clone.
#define forAll(list, i)
Loop across all elements in list.
const word & name() const
Return name.
A list that is sorted upon construction or when explicitly requested with the sort() method...
Cell-face mesh analysis engine.
Templated form of IOobject providing type information for file reading and header type checking...
void size(const label)
Override size to be inconsistent with allocated storage.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
virtual const pointField & points() const =0
Return mesh points.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
const cellList & cells() const
const dimensionSet dimless
bool insert(const Key &key)
Insert a new entry.
label size() const
Return number of elements in table.
const dimensionSet dimTime
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.
List< label > labelList
A List of labels.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
word name(const complex &)
Return a string representation of a complex.
label size() const
Return the number of elements in the UPtrList.
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A collection of cell labels.
Mesh data needed to do the Finite Volume discretisation.
virtual const faceList & faces() const =0
Return faces.
label start() const
Return start label of this patch in the polyMesh face list.
virtual const labelList & faceOwner() const =0
Face face-owner addressing.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
virtual bool write(const bool write=true) const
Write using setting from DB.
A patch is a list of labels that address the faces in the global face list.
T & last()
Return the last element of the list.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const labelListList & cellCells() const
IOList< label > labelIOList
Label container classes.
const scalarField & cellVolumes() const