68 void Foam::slidingInterface::checkDefinition()
74 !masterFaceZoneID_.active()
75 || !slaveFaceZoneID_.active()
76 || !cutPointZoneID_.active()
77 || !cutFaceZoneID_.active()
78 || !masterPatchID_.active()
79 || !slavePatchID_.active()
83 <<
"Not all zones and patches needed in the definition " 84 <<
"have been found. Please check your mesh definition." 96 <<
"Please check your mesh definition." 102 Pout<<
"Sliding interface object " <<
name() <<
" :" <<
nl 103 <<
" master face zone: " << masterFaceZoneID_.index() <<
nl 104 <<
" slave face zone: " << slaveFaceZoneID_.index() <<
endl;
109 void Foam::slidingInterface::clearOut()
const 111 clearPointProjection();
112 clearAttachedAddressing();
121 Foam::slidingInterface::slidingInterface
126 const word& masterFaceZoneName,
127 const word& slaveFaceZoneName,
128 const word& cutPointZoneName,
129 const word& cutFaceZoneName,
130 const word& masterPatchName,
131 const word& slavePatchName,
133 const bool coupleDecouple,
169 coupleDecouple_(coupleDecouple),
171 projectionAlgo_(algo),
173 pointMergeTol_(pointMergeTolDefault_),
174 edgeMergeTol_(edgeMergeTolDefault_),
175 nFacesPerSlaveEdge_(nFacesPerSlaveEdgeDefault_),
176 edgeFaceEscapeLimit_(edgeFaceEscapeLimitDefault_),
177 integralAdjTol_(integralAdjTolDefault_),
178 edgeMasterCatchFraction_(edgeMasterCatchFractionDefault_),
179 edgeCoPlanarTol_(edgeCoPlanarTolDefault_),
180 edgeEndCutoffTol_(edgeEndCutoffTolDefault_),
181 cutFaceMasterPtr_(NULL),
182 cutFaceSlavePtr_(NULL),
183 masterFaceCellsPtr_(NULL),
184 slaveFaceCellsPtr_(NULL),
185 masterStickOutFacesPtr_(NULL),
186 slaveStickOutFacesPtr_(NULL),
187 retiredPointMapPtr_(NULL),
188 cutPointEdgePairMapPtr_(NULL),
189 slavePointPointHitsPtr_(NULL),
190 slavePointEdgeHitsPtr_(NULL),
191 slavePointFaceHitsPtr_(NULL),
192 masterPointEdgeHitsPtr_(NULL),
193 projectedSlavePointsPtr_(NULL)
200 <<
"Creation of a sliding interface from components " 201 <<
"in attached state not supported." 206 calcAttachedAddressing();
212 Foam::slidingInterface::slidingInterface
223 dict.
lookup(
"masterFaceZoneName"),
228 dict.
lookup(
"slaveFaceZoneName"),
233 dict.
lookup(
"cutPointZoneName"),
238 dict.
lookup(
"cutFaceZoneName"),
243 dict.
lookup(
"masterPatchName"),
248 dict.
lookup(
"slavePatchName"),
251 matchType_(typeOfMatchNames_.read((dict.
lookup(
"typeOfMatch")))),
252 coupleDecouple_(dict.
lookup(
"coupleDecouple")),
253 attached_(dict.
lookup(
"attached")),
259 cutFaceMasterPtr_(NULL),
260 cutFaceSlavePtr_(NULL),
261 masterFaceCellsPtr_(NULL),
262 slaveFaceCellsPtr_(NULL),
263 masterStickOutFacesPtr_(NULL),
264 slaveStickOutFacesPtr_(NULL),
265 retiredPointMapPtr_(NULL),
266 cutPointEdgePairMapPtr_(NULL),
267 slavePointPointHitsPtr_(NULL),
268 slavePointEdgeHitsPtr_(NULL),
269 slavePointFaceHitsPtr_(NULL),
270 masterPointEdgeHitsPtr_(NULL),
271 projectedSlavePointsPtr_(NULL)
284 Pout<<
"slidingInterface::slidingInterface(...) " 285 <<
" for object " << name <<
" : " 286 <<
"Interface attached. Reading master and slave face zones " 287 <<
"and retired point lookup." <<
endl;
294 masterStickOutFacesPtr_ =
296 slaveStickOutFacesPtr_ =
300 cutPointEdgePairMapPtr_ =
305 calcAttachedAddressing();
318 void Foam::slidingInterface::clearAddressing()
const 329 return masterFaceZoneID_;
335 return slaveFaceZoneID_;
346 Pout<<
"bool slidingInterface::changeTopology() const " 347 <<
"for object " <<
name() <<
" : " 348 <<
"Couple-decouple mode." <<
endl;
365 && !topoChanger().
mesh().changing()
375 return projectPoints();
387 decoupleInterface(ref);
392 coupleInterface(ref);
406 coupleInterface(ref);
417 Pout<<
"void slidingInterface::modifyMotionPoints(" 418 <<
"pointField& motionPoints) const for object " <<
name() <<
" : " 419 <<
"Adjusting motion points." <<
endl;
427 if (cutPoints.
size() && !projectedSlavePointsPtr_)
433 const pointField& projectedSlavePoints = *projectedSlavePointsPtr_;
440 mesh.
faceZones()[slaveFaceZoneID_.index()]().meshPointMap();
443 mesh.
faceZones()[masterFaceZoneID_.index()]();
448 mesh.
faceZones()[slaveFaceZoneID_.index()]();
458 if (rpmIter != rpm.
end())
466 motionPoints[cutPoints[pointi]] =
467 projectedSlavePoints[slaveZonePointMap.
find(rpmIter())()];
475 cpepm.
find(cutPoints[pointi]);
477 if (cpepmIter != cpepm.
end())
490 const edge& globalMasterEdge = cpepmIter().first();
492 const label curMasterEdgeIndex =
499 globalMasterEdge.
start()
503 globalMasterEdge.
end()
508 const edge& cme = masterEdges[curMasterEdgeIndex];
514 const edge& globalSlaveEdge = cpepmIter().second();
516 const label curSlaveEdgeIndex =
523 globalSlaveEdge.
start()
527 globalSlaveEdge.
end()
532 const edge& curSlaveEdge = slaveEdges[curSlaveEdgeIndex];
536 const point& a = projectedSlavePoints[curSlaveEdge.
start()];
537 const point&
b = projectedSlavePoints[curSlaveEdge.
end()];
542 slaveLocalPoints[curSlaveEdge.
start()]
543 + slavePointNormals[curSlaveEdge.
start()]
544 + slaveLocalPoints[curSlaveEdge.
end()]
545 + slavePointNormals[curSlaveEdge.
end()]
549 plane cutPlane(a, b, c);
552 curSlaveEdge.
line(slaveLocalPoints);
553 const scalar curSlaveLineMag = curSlaveLine.
mag();
558 cme.
line(masterLocalPoints)
563 cutOnMaster > edgeEndCutoffTol_
564 && cutOnMaster < 1.0 - edgeEndCutoffTol_
568 point masterCutPoint =
569 masterLocalPoints[cme.
start()]
570 + cutOnMaster*cme.
vec(masterLocalPoints);
583 - curSlaveLine.
start()
584 ) & curSlaveLine.
vec()
585 )/
sqr(curSlaveLineMag);
590 edgeCoPlanarTol_*
mag(b - a);
594 cutOnSlave > edgeEndCutoffTol_
595 && cutOnSlave < 1.0 - edgeEndCutoffTol_
600 motionPoints[cutPoints[pointi]] =
606 Pout<<
"Missed slave edge!!! This is an error. " 608 << cme.
line(masterLocalPoints)
609 <<
" slave edge: " << curSlaveLine
610 <<
" point: " << masterCutPoint
615 - curSlaveLine.
start()
616 ) & curSlaveLine.
vec()
617 )/
sqr(curSlaveLineMag)
623 Pout<<
"Missed master edge!!! This is an error" 630 <<
"Cut point " << cutPoints[pointi]
631 <<
" not recognised as either the projected " 632 <<
"or as intersection point. Error in point " 633 <<
"projection or data mapping" 650 Pout<<
"void slidingInterface::updateMesh(const mapPolyMesh& m)" 651 <<
" const for object " <<
name() <<
" : " 652 <<
"Updating topology." <<
endl;
659 slaveFaceZoneID_.update(mesh.
faceZones());
680 if (!projectedSlavePointsPtr_)
685 return *projectedSlavePointsPtr_;
702 "nFacesPerSlaveEdge",
707 "edgeFaceEscapeLimit",
717 "edgeMasterCatchFraction",
718 edgeMasterCatchFraction_
733 Info<<
"Sliding interface parameters:" <<
nl 734 <<
"pointMergeTol : " << pointMergeTol_ <<
nl 735 <<
"edgeMergeTol : " << edgeMergeTol_ <<
nl 736 <<
"nFacesPerSlaveEdge : " << nFacesPerSlaveEdge_ <<
nl 737 <<
"edgeFaceEscapeLimit : " << edgeFaceEscapeLimit_ <<
nl 738 <<
"integralAdjTol : " << integralAdjTol_ <<
nl 739 <<
"edgeMasterCatchFraction : " << edgeMasterCatchFraction_ <<
nl 740 <<
"edgeCoPlanarTol : " << edgeCoPlanarTol_ <<
nl 741 <<
"edgeEndCutoffTol : " << edgeEndCutoffTol_ <<
endl;
750 << masterFaceZoneID_.name() <<
nl 751 << slaveFaceZoneID_.name() <<
nl 752 << cutPointZoneID_.name() <<
nl 753 << cutFaceZoneID_.name() <<
nl 754 << masterPatchID_.name() <<
nl 755 << slavePatchID_.name() <<
nl 756 << typeOfMatchNames_[matchType_] <<
nl 757 << coupleDecouple_ <<
nl 758 << attached_ <<
endl;
763 #define WRITE_NON_DEFAULT(name) \ 764 if ( name ## _ != name ## Default_ )\ 766 os << " " #name " " << name ## _ << token::END_STATEMENT << nl; \ 774 <<
" masterFaceZoneName " << masterFaceZoneID_.name()
776 <<
" slaveFaceZoneName " << slaveFaceZoneID_.name()
778 <<
" cutPointZoneName " << cutPointZoneID_.name()
780 <<
" cutFaceZoneName " << cutFaceZoneID_.name()
782 <<
" masterPatchName " << masterPatchID_.name()
784 <<
" slavePatchName " << slavePatchID_.name()
786 <<
" typeOfMatch " << typeOfMatchNames_[matchType_]
788 <<
" coupleDecouple " << coupleDecouple_
792 <<
" attached " << attached_
794 <<
" active " << active()
799 masterFaceCellsPtr_->writeEntry(
"masterFaceCells", os);
800 slaveFaceCellsPtr_->writeEntry(
"slaveFaceCells", os);
801 masterStickOutFacesPtr_->writeEntry(
"masterStickOutFaces", os);
802 slaveStickOutFacesPtr_->writeEntry(
"slaveStickOutFaces", os);
804 os <<
" retiredPointMap " << retiredPointMap()
806 <<
" cutPointEdgePairMap " << cutPointEdgePairMap()
label end() const
Return end vertex label.
linePointRef line(const pointField &) const
Return edge line.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
const Point & missPoint() const
Return miss point.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static const NamedEnum< algorithm, 3 > algorithmNames_
Projection algorithm names.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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 Field< PointType > & pointNormals() const
Return point normals for patch.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
virtual bool changeTopology() const
Check for topology change.
const faceZoneID & slaveFaceZoneID() const
Return slave face zone ID.
Initialise the NamedEnum HashTable from the static list of names.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
virtual void write(Ostream &) const
Write.
const polyMesh & mesh() const
Return the mesh reference.
A list of faces which address into the list of points.
const faceZoneID & masterFaceZoneID() const
Return master face zone ID.
Point vec() const
Return start-end vector.
scalar distance() const
Return distance to hit.
bool read(const char *, int32_t &)
virtual void writeDict(Ostream &) const
Write dictionary.
label whichPoint(const label gp) const
Given a global point index, return the local point index.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
List of mesh modifiers defining the mesh dynamics.
A class for handling words, derived from string.
#define WRITE_NON_DEFAULT(name)
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
List< label > labelList
A List of labels.
scalar lineIntersect(const line< Point, PointRef > &l) const
Return the cutting point between the plane and.
Virtual base class for mesh modifiers.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
prefixOSstream Pout(cout,"Pout")
label start() const
Return start vertex label.
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
PointRef start() const
Return first vertex.
defineTypeNameAndDebug(combustionModel, 0)
const pointField & pointProjection() const
Return projected points for a slave patch.
static const NamedEnum< typeOfMatch, 2 > typeOfMatchNames_
Direction names.
const pointZoneMesh & pointZones() const
Return point zone mesh.
word name(const complex &)
Return a string representation of a complex.
label whichEdge(const edge &) const
Given an edge in local point labels, return its.
typeOfMatch
Type of match.
scalar mag() const
Return scalar magnitude.
bool empty() const
Return true if the UPtrList is empty (ie, size() is zero)
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
const Point & hitPoint() const
Return hit point.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const dimensionedScalar c
Speed of light in a vacuum.
vector vec(const pointField &) const
Return the vector (end - start)
dimensioned< scalar > mag(const dimensioned< Type > &)
const faceZoneMesh & faceZones() const
Return face zone mesh.
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
bool hit() const
Is there a hit.
Mesh consisting of general polyhedral cells.
void setTolerances(const dictionary &, bool report=false)
Set the tolerances from the values in a dictionary.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
void deleteDemandDrivenData(DataPtr &dataPtr)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
virtual ~slidingInterface()
Destructor.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.