Go to the documentation of this file.
33 #include "primitiveMesh.H"
63 <<
" cannot be found."
74 <<
"Incorrect layer thickness definition."
85 <<
"Face extrusion zone contains no faces. "
86 <<
"Please check your mesh definition."
92 Pout<<
"Cell layer addition/removal object " <<
name() <<
" :" <<
nl
109 if (pointsPairingPtr_)
113 Pout<<
"layerAdditionRemoval::clearAddressing()" <<
nl
114 <<
" clearing pointsPairingPtr_" <<
endl;
120 if (facesPairingPtr_)
124 Pout<<
"layerAdditionRemoval::clearAddressing()" <<
nl
125 <<
" clearing facesPairingPtr_" <<
endl;
140 const word& zoneName,
141 const scalar minThickness,
142 const scalar maxThickness,
143 const Switch thicknessFromVolume
148 minLayerThickness_(minThickness),
149 maxLayerThickness_(maxThickness),
150 thicknessFromVolume_(thicknessFromVolume),
151 oldLayerThickness_(-1.0),
152 pointsPairingPtr_(NULL),
153 facesPairingPtr_(NULL),
177 oldLayerThickness_(readOldThickness(
dict)),
178 pointsPairingPtr_(NULL),
179 facesPairingPtr_(NULL),
200 if (triggerRemoval_ > -1 || triggerAddition_ > -1)
221 if (
min(V) < -VSMALL)
224 <<
"negative cell volume. Error in mesh motion before "
225 <<
"topological change.\n V: " << V
230 scalar minDelta = GREAT;
234 if (thicknessFromVolume_)
239 scalar curDelta = V[mc[faceI]]/
mag(S[fz[faceI]]);
240 avgDelta += curDelta;
241 minDelta =
min(minDelta, curDelta);
242 maxDelta =
max(maxDelta, curDelta);
250 const Map<label>& zoneMeshPointMap = fz().meshPointMap();
260 const edge&
e = cellEdges[i];
262 if (zoneMeshPointMap.found(
e[0]))
264 if (!zoneMeshPointMap.found(
e[1]))
267 avgDelta += curDelta;
269 minDelta =
min(minDelta, curDelta);
270 maxDelta =
max(maxDelta, curDelta);
275 if (zoneMeshPointMap.found(
e[1]))
278 avgDelta += curDelta;
280 minDelta =
min(minDelta, curDelta);
281 maxDelta =
max(maxDelta, curDelta);
297 Pout<<
"bool layerAdditionRemoval::changeTopology() const "
298 <<
" for object " <<
name() <<
" : " <<
nl
299 <<
"Layer thickness: min: " << minDelta
300 <<
" max: " << maxDelta <<
" avg: " << avgDelta
301 <<
" old thickness: " << oldLayerThickness_ <<
nl
302 <<
"Removal threshold: " << minLayerThickness_
303 <<
" addition threshold: " << maxLayerThickness_ <<
endl;
306 bool topologicalChange =
false;
310 if (oldLayerThickness_ < 0)
314 Pout<<
"First step. No addition/removal" <<
endl;
318 oldLayerThickness_ = avgDelta;
320 topologicalChange =
false;
322 else if (avgDelta < oldLayerThickness_)
325 if (minDelta < minLayerThickness_)
328 if (setLayerPairing())
340 Pout<<
"bool layerAdditionRemoval::changeTopology() "
341 <<
" const for object " <<
name() <<
" : "
342 <<
"Triggering layer removal" <<
endl;
349 oldLayerThickness_ = GREAT;
351 topologicalChange =
true;
362 oldLayerThickness_ = avgDelta;
368 if (maxDelta > maxLayerThickness_)
372 Pout<<
"bool layerAdditionRemoval::changeTopology() const "
373 <<
" for object " <<
name() <<
" : "
374 <<
"Triggering layer addition" <<
endl;
381 oldLayerThickness_ = 0;
383 topologicalChange =
true;
387 oldLayerThickness_ = avgDelta;
391 return topologicalChange;
400 if (triggerRemoval_ == topoChanger().
mesh().time().
timeIndex())
402 removeCellLayer(ref);
407 Pout<<
"layerAdditionRemoval::setRefinement(polyTopoChange&) "
408 <<
"for object " <<
name() <<
" : "
409 <<
"Clearing addressing after layer removal" <<
endl;
412 triggerRemoval_ = -1;
416 if (triggerAddition_ == topoChanger().
mesh().time().
timeIndex())
423 Pout<<
"layerAdditionRemoval::setRefinement(polyTopoChange&) "
424 <<
"for object " <<
name() <<
" : "
425 <<
"Clearing addressing after layer addition" <<
endl;
428 triggerAddition_ = -1;
438 Pout<<
"layerAdditionRemoval::updateMesh(const mapPolyMesh&) "
439 <<
"for object " <<
name() <<
" : "
440 <<
"Clearing addressing on external request";
442 if (pointsPairingPtr_ || facesPairingPtr_)
453 faceZoneID_.update(topoChanger().
mesh().faceZones());
461 if (t < VSMALL || maxLayerThickness_ < t)
464 <<
"Incorrect layer thickness definition."
468 minLayerThickness_ = t;
474 if (t < minLayerThickness_)
477 <<
"Incorrect layer thickness definition."
481 maxLayerThickness_ = t;
490 << minLayerThickness_ <<
nl
491 << oldLayerThickness_ <<
nl
492 << maxLayerThickness_ <<
nl
493 << thicknessFromVolume_ <<
endl;
500 <<
" type " <<
type()
502 <<
" faceZoneName " << faceZoneID_.name()
504 <<
" minLayerThickness " << minLayerThickness_
506 <<
" maxLayerThickness " << maxLayerThickness_
508 <<
" thicknessFromVolume " << thicknessFromVolume_
510 <<
" oldLayerThickness " << oldLayerThickness_
512 <<
" active " << active()
virtual const pointField & points() const
Return raw points.
virtual bool changeTopology() const
Check for topology change.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
layerAdditionRemoval(const layerAdditionRemoval &)
Disallow default bitwise copy construct.
A class for handling words, derived from string.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
void clearAddressing() const
Clear addressing.
scalar maxLayerThickness_
Max thickness of extrusion layer. Triggers layer addition.
#define forAll(list, i)
Loop across all elements in list.
static scalar readOldThickness(const dictionary &)
Optionally read old thickness.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
List of mesh modifiers defining the mesh dynamics.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const cellList & cells() const
Direct mesh changes based on v1.3 polyTopoChange syntax.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
const faceZoneMesh & faceZones() const
Return face zone mesh.
virtual ~layerAdditionRemoval()
Destructor.
void deleteDemandDrivenData(DataPtr &dataPtr)
void setMaxLayerThickness(const scalar t) const
Set max layer thickness which triggers removal.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
A subset of mesh faces organised as a primitive patch.
void setMinLayerThickness(const scalar t) const
Set min layer thickness which triggers removal.
faceZoneID faceZoneID_
Master face zone ID.
edgeList edges(const faceUList &) const
Return cell edges.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
const scalarField & cellVolumes() const
const double e
Elementary charge.
Virtual base class for mesh modifiers.
static const scalar addDelta_
Thickness insertion fraction for the pre-motion.
const word & name() const
Return name of this modifier.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const labelList & masterCells() const
Return labels of master cells (cells next to the master face.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
prefixOSstream Pout(cout, "Pout")
const polyMesh & mesh() const
Return the mesh reference.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual void write(Ostream &) const
Write.
const Time & time() const
Return the top-level database.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
label timeIndex() const
Return current time index.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
const keyType & name() const
Return name.
scalar minLayerThickness_
Min thickness of extrusion layer. Triggers layer removal.
virtual void writeDict(Ostream &) const
Write dictionary.
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
A cell is defined as a list of faces with extra functionality.
bool active() const
Has the zone been found.
word name(const complex &)
Return a string representation of a complex.
label index() const
Return index of first matching zone.
static const scalar removeDelta_
Thickness removal fraction for the cell collapse.
const vectorField & faceAreas() const
void checkDefinition()
Check validity of construction data.