68 void Foam::slidingInterface::checkDefinition()
74 !masterFaceZoneID_.active()
75 || !slaveFaceZoneID_.active()
76 || !cutPointZoneID_.active()
77 || !cutFaceZoneID_.active()
78 || !masterPatchID_.active()
79 || !slavePatchID_.active()
84 "void slidingInterface::checkDefinition()" 85 ) <<
"Not all zones and patches needed in the definition " 86 <<
"have been found. Please check your mesh definition." 98 <<
"Master or slave face zone contain no faces. " 99 <<
"Please check your mesh definition." 105 Pout<<
"Sliding interface object " <<
name() <<
" :" <<
nl 106 <<
" master face zone: " << masterFaceZoneID_.index() <<
nl 107 <<
" slave face zone: " << slaveFaceZoneID_.index() <<
endl;
112 void Foam::slidingInterface::clearOut()
const 114 clearPointProjection();
115 clearAttachedAddressing();
124 Foam::slidingInterface::slidingInterface
129 const word& masterFaceZoneName,
130 const word& slaveFaceZoneName,
131 const word& cutPointZoneName,
132 const word& cutFaceZoneName,
133 const word& masterPatchName,
134 const word& slavePatchName,
136 const bool coupleDecouple,
172 coupleDecouple_(coupleDecouple),
174 projectionAlgo_(algo),
176 pointMergeTol_(pointMergeTolDefault_),
177 edgeMergeTol_(edgeMergeTolDefault_),
178 nFacesPerSlaveEdge_(nFacesPerSlaveEdgeDefault_),
179 edgeFaceEscapeLimit_(edgeFaceEscapeLimitDefault_),
180 integralAdjTol_(integralAdjTolDefault_),
181 edgeMasterCatchFraction_(edgeMasterCatchFractionDefault_),
182 edgeCoPlanarTol_(edgeCoPlanarTolDefault_),
183 edgeEndCutoffTol_(edgeEndCutoffTolDefault_),
184 cutFaceMasterPtr_(NULL),
185 cutFaceSlavePtr_(NULL),
186 masterFaceCellsPtr_(NULL),
187 slaveFaceCellsPtr_(NULL),
188 masterStickOutFacesPtr_(NULL),
189 slaveStickOutFacesPtr_(NULL),
190 retiredPointMapPtr_(NULL),
191 cutPointEdgePairMapPtr_(NULL),
192 slavePointPointHitsPtr_(NULL),
193 slavePointEdgeHitsPtr_(NULL),
194 slavePointFaceHitsPtr_(NULL),
195 masterPointEdgeHitsPtr_(NULL),
196 projectedSlavePointsPtr_(NULL)
204 "Foam::slidingInterface::slidingInterface\n" 206 " const word& name,\n" 207 " const label index,\n" 208 " const polyTopoChanger& mme,\n" 209 " const word& masterFaceZoneName,\n" 210 " const word& slaveFaceZoneName,\n" 211 " const word& cutFaceZoneName,\n" 212 " const word& cutPointZoneName,\n" 213 " const word& masterPatchName,\n" 214 " const word& slavePatchName,\n" 215 " const typeOfMatch tom,\n" 216 " const bool coupleDecouple\n" 218 ) <<
"Creation of a sliding interface from components " 219 <<
"in attached state not supported." 224 calcAttachedAddressing();
230 Foam::slidingInterface::slidingInterface
241 dict.
lookup(
"masterFaceZoneName"),
246 dict.
lookup(
"slaveFaceZoneName"),
251 dict.
lookup(
"cutPointZoneName"),
256 dict.
lookup(
"cutFaceZoneName"),
261 dict.
lookup(
"masterPatchName"),
266 dict.
lookup(
"slavePatchName"),
269 matchType_(typeOfMatchNames_.read((dict.
lookup(
"typeOfMatch")))),
270 coupleDecouple_(dict.
lookup(
"coupleDecouple")),
271 attached_(dict.
lookup(
"attached")),
277 cutFaceMasterPtr_(NULL),
278 cutFaceSlavePtr_(NULL),
279 masterFaceCellsPtr_(NULL),
280 slaveFaceCellsPtr_(NULL),
281 masterStickOutFacesPtr_(NULL),
282 slaveStickOutFacesPtr_(NULL),
283 retiredPointMapPtr_(NULL),
284 cutPointEdgePairMapPtr_(NULL),
285 slavePointPointHitsPtr_(NULL),
286 slavePointEdgeHitsPtr_(NULL),
287 slavePointFaceHitsPtr_(NULL),
288 masterPointEdgeHitsPtr_(NULL),
289 projectedSlavePointsPtr_(NULL)
302 Pout<<
"slidingInterface::slidingInterface(...) " 303 <<
" for object " << name <<
" : " 304 <<
"Interface attached. Reading master and slave face zones " 305 <<
"and retired point lookup." <<
endl;
312 masterStickOutFacesPtr_ =
314 slaveStickOutFacesPtr_ =
318 cutPointEdgePairMapPtr_ =
323 calcAttachedAddressing();
336 void Foam::slidingInterface::clearAddressing()
const 347 return masterFaceZoneID_;
353 return slaveFaceZoneID_;
364 Pout<<
"bool slidingInterface::changeTopology() const " 365 <<
"for object " <<
name() <<
" : " 366 <<
"Couple-decouple mode." <<
endl;
383 && !topoChanger().
mesh().changing()
393 return projectPoints();
405 decoupleInterface(ref);
410 coupleInterface(ref);
424 coupleInterface(ref);
435 Pout<<
"void slidingInterface::modifyMotionPoints(" 436 <<
"pointField& motionPoints) const for object " <<
name() <<
" : " 437 <<
"Adjusting motion points." <<
endl;
445 if (cutPoints.
size() && !projectedSlavePointsPtr_)
451 const pointField& projectedSlavePoints = *projectedSlavePointsPtr_;
458 mesh.
faceZones()[slaveFaceZoneID_.index()]().meshPointMap();
461 mesh.
faceZones()[masterFaceZoneID_.index()]();
466 mesh.
faceZones()[slaveFaceZoneID_.index()]();
476 if (rpmIter != rpm.
end())
484 motionPoints[cutPoints[pointI]] =
485 projectedSlavePoints[slaveZonePointMap.
find(rpmIter())()];
493 cpepm.
find(cutPoints[pointI]);
495 if (cpepmIter != cpepm.
end())
508 const edge& globalMasterEdge = cpepmIter().first();
510 const label curMasterEdgeIndex =
517 globalMasterEdge.
start()
521 globalMasterEdge.
end()
526 const edge& cme = masterEdges[curMasterEdgeIndex];
532 const edge& globalSlaveEdge = cpepmIter().second();
534 const label curSlaveEdgeIndex =
541 globalSlaveEdge.
start()
545 globalSlaveEdge.
end()
550 const edge& curSlaveEdge = slaveEdges[curSlaveEdgeIndex];
554 const point& a = projectedSlavePoints[curSlaveEdge.
start()];
555 const point&
b = projectedSlavePoints[curSlaveEdge.
end()];
560 slaveLocalPoints[curSlaveEdge.
start()]
561 + slavePointNormals[curSlaveEdge.
start()]
562 + slaveLocalPoints[curSlaveEdge.
end()]
563 + slavePointNormals[curSlaveEdge.
end()]
567 plane cutPlane(a, b, c);
570 curSlaveEdge.
line(slaveLocalPoints);
571 const scalar curSlaveLineMag = curSlaveLine.
mag();
576 cme.
line(masterLocalPoints)
581 cutOnMaster > edgeEndCutoffTol_
582 && cutOnMaster < 1.0 - edgeEndCutoffTol_
586 point masterCutPoint =
587 masterLocalPoints[cme.
start()]
588 + cutOnMaster*cme.
vec(masterLocalPoints);
601 - curSlaveLine.
start()
602 ) & curSlaveLine.
vec()
603 )/
sqr(curSlaveLineMag);
608 edgeCoPlanarTol_*
mag(b - a);
612 cutOnSlave > edgeEndCutoffTol_
613 && cutOnSlave < 1.0 - edgeEndCutoffTol_
618 motionPoints[cutPoints[pointI]] =
624 Pout<<
"Missed slave edge!!! This is an error. " 626 << cme.
line(masterLocalPoints)
627 <<
" slave edge: " << curSlaveLine
628 <<
" point: " << masterCutPoint
633 - curSlaveLine.
start()
634 ) & curSlaveLine.
vec()
635 )/
sqr(curSlaveLineMag)
641 Pout<<
"Missed master edge!!! This is an error" 649 "void slidingInterface::modifyMotionPoints" 650 "(pointField&) const" 651 ) <<
"Cut point " << cutPoints[pointI]
652 <<
" not recognised as either the projected " 653 <<
"or as intersection point. Error in point " 654 <<
"projection or data mapping" 671 Pout<<
"void slidingInterface::updateMesh(const mapPolyMesh& m)" 672 <<
" const for object " <<
name() <<
" : " 673 <<
"Updating topology." <<
endl;
680 slaveFaceZoneID_.update(mesh.
faceZones());
701 if (!projectedSlavePointsPtr_)
706 return *projectedSlavePointsPtr_;
723 "nFacesPerSlaveEdge",
728 "edgeFaceEscapeLimit",
738 "edgeMasterCatchFraction",
739 edgeMasterCatchFraction_
754 Info<<
"Sliding interface parameters:" <<
nl 755 <<
"pointMergeTol : " << pointMergeTol_ <<
nl 756 <<
"edgeMergeTol : " << edgeMergeTol_ <<
nl 757 <<
"nFacesPerSlaveEdge : " << nFacesPerSlaveEdge_ <<
nl 758 <<
"edgeFaceEscapeLimit : " << edgeFaceEscapeLimit_ <<
nl 759 <<
"integralAdjTol : " << integralAdjTol_ <<
nl 760 <<
"edgeMasterCatchFraction : " << edgeMasterCatchFraction_ <<
nl 761 <<
"edgeCoPlanarTol : " << edgeCoPlanarTol_ <<
nl 762 <<
"edgeEndCutoffTol : " << edgeEndCutoffTol_ <<
endl;
771 << masterFaceZoneID_.name() <<
nl 772 << slaveFaceZoneID_.name() <<
nl 773 << cutPointZoneID_.name() <<
nl 774 << cutFaceZoneID_.name() <<
nl 775 << masterPatchID_.name() <<
nl 776 << slavePatchID_.name() <<
nl 777 << typeOfMatchNames_[matchType_] <<
nl 778 << coupleDecouple_ <<
nl 779 << attached_ <<
endl;
784 #define WRITE_NON_DEFAULT(name) \ 785 if ( name ## _ != name ## Default_ )\ 787 os << " " #name " " << name ## _ << token::END_STATEMENT << nl; \ 795 <<
" masterFaceZoneName " << masterFaceZoneID_.name()
797 <<
" slaveFaceZoneName " << slaveFaceZoneID_.name()
799 <<
" cutPointZoneName " << cutPointZoneID_.name()
801 <<
" cutFaceZoneName " << cutFaceZoneID_.name()
803 <<
" masterPatchName " << masterPatchID_.name()
805 <<
" slavePatchName " << slavePatchID_.name()
807 <<
" typeOfMatch " << typeOfMatchNames_[matchType_]
809 <<
" coupleDecouple " << coupleDecouple_
813 <<
" attached " << attached_
815 <<
" active " << active()
820 masterFaceCellsPtr_->writeEntry(
"masterFaceCells", os);
821 slaveFaceCellsPtr_->writeEntry(
"slaveFaceCells", os);
822 masterStickOutFacesPtr_->writeEntry(
"masterStickOutFaces", os);
823 slaveStickOutFacesPtr_->writeEntry(
"slaveStickOutFaces", os);
825 os <<
" retiredPointMap " << retiredPointMap()
827 <<
" cutPointEdgePairMap " << cutPointEdgePairMap()
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
const faceZoneMesh & faceZones() const
Return face zone mesh.
PointRef start() const
Return first vertex.
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
const Field< PointType > & pointNormals() const
Return point normals for patch.
bool empty() const
Return true if the PtrList is empty (ie, size() is zero).
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
dimensioned< scalar > mag(const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
virtual void write(Ostream &) const
Write.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const Point & missPoint() const
Return miss point.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Virtual base class for mesh modifiers.
const Point & hitPoint() const
Return hit point.
label whichPoint(const label gp) const
Given a global point index, return the local point index.
typeOfMatch
Type of match.
void deleteDemandDrivenData(DataPtr &dataPtr)
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const faceZoneID & slaveFaceZoneID() const
Return slave face zone ID.
void size(const label)
Override size to be inconsistent with allocated storage.
const pointZoneMesh & pointZones() const
Return point zone mesh.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
const polyMesh & mesh() const
Return the mesh reference.
static const NamedEnum< algorithm, 3 > algorithmNames_
Projection algorithm names.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static const NamedEnum< typeOfMatch, 2 > typeOfMatchNames_
Direction names.
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
Ostream & endl(Ostream &os)
Add newline and flush stream.
linePointRef line(const pointField &) const
Return edge line.
void setTolerances(const dictionary &, bool report=false)
Set the tolerances from the values in a dictionary.
#define WRITE_NON_DEFAULT(name)
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const faceZoneID & masterFaceZoneID() const
Return master face zone ID.
Macros for easy insertion into run-time selection tables.
List of mesh modifiers defining the mesh dynamics.
virtual ~slidingInterface()
Destructor.
vector vec(const pointField &) const
Return the vector (end - start)
errorManip< error > abort(error &err)
const pointField & pointProjection() const
Return projected points for a slave patch.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Initialise the NamedEnum HashTable from the static list of names.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A list of faces which address into the list of points.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
scalar distance() const
Return distance to hit.
Mesh consisting of general polyhedral cells.
label whichEdge(const edge &) const
Given an edge in local point labels, return its.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
label end() const
Return end vertex label.
List< label > labelList
A List of labels.
bool hit() const
Is there a hit.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
scalar mag() const
Return scalar magnitude.
const dimensionedScalar c
Speed of light in a vacuum.
bool read(const char *, int32_t &)
Direct mesh changes based on v1.3 polyTopoChange syntax.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
scalar lineIntersect(const line< Point, PointRef > &l) const
Return the cutting point between the plane and.
label start() const
Return start vertex label.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
virtual bool changeTopology() const
Check for topology change.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual void writeDict(Ostream &) const
Write dictionary.
Point vec() const
Return start-end vector.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")