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();
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_(
nullptr),
182 cutFaceSlavePtr_(
nullptr),
183 masterFaceCellsPtr_(
nullptr),
184 slaveFaceCellsPtr_(
nullptr),
185 masterStickOutFacesPtr_(
nullptr),
186 slaveStickOutFacesPtr_(
nullptr),
187 retiredPointMapPtr_(
nullptr),
188 cutPointEdgePairMapPtr_(
nullptr),
189 slavePointPointHitsPtr_(
nullptr),
190 slavePointEdgeHitsPtr_(
nullptr),
191 slavePointFaceHitsPtr_(
nullptr),
192 masterPointEdgeHitsPtr_(
nullptr),
193 projectedSlavePointsPtr_(
nullptr)
200 <<
"Creation of a sliding interface from components " 201 <<
"in attached state not supported." 206 calcAttachedAddressing();
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_(
nullptr),
260 cutFaceSlavePtr_(
nullptr),
261 masterFaceCellsPtr_(
nullptr),
262 slaveFaceCellsPtr_(
nullptr),
263 masterStickOutFacesPtr_(
nullptr),
264 slaveStickOutFacesPtr_(
nullptr),
265 retiredPointMapPtr_(
nullptr),
266 cutPointEdgePairMapPtr_(
nullptr),
267 slavePointPointHitsPtr_(
nullptr),
268 slavePointEdgeHitsPtr_(
nullptr),
269 slavePointFaceHitsPtr_(
nullptr),
270 masterPointEdgeHitsPtr_(
nullptr),
271 projectedSlavePointsPtr_(
nullptr)
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 writeEntry(os,
"masterFaceCells", *masterFaceCellsPtr_);
800 writeEntry(os,
"slaveFaceCells", *slaveFaceCellsPtr_);
801 writeEntry(os,
"masterStickOutFaces", *masterStickOutFacesPtr_);
802 writeEntry(os,
"slaveStickOutFaces", *slaveStickOutFacesPtr_);
804 os <<
" retiredPointMap " << retiredPointMap()
806 <<
" cutPointEdgePairMap " << cutPointEdgePairMap()
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#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.
const faceZoneID & slaveFaceZoneID() const
Return slave face zone ID.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
scalar mag() const
Return scalar magnitude.
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.
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
bool empty() const
Return true if the UPtrList is empty (ie, size() is zero)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
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/any.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
virtual void write(Ostream &) const
Write.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
Initialise the NamedEnum HashTable from the static list of names.
const dimensionedScalar c
Speed of light in a vacuum.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
const Point & missPoint() const
Return miss point.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
const pointField & pointProjection() const
Return projected points for a slave patch.
const meshPointZones & pointZones() const
Return point zones.
label whichEdge(const edge &) const
Given an edge in local point labels, return its.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
A list of faces which address into the list of points.
bool read(const char *, int32_t &)
linePointRef line(const pointField &) const
Return edge line.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
List of mesh modifiers defining the mesh dynamics.
A class for handling words, derived from string.
#define WRITE_NON_DEFAULT(name)
const Point & hitPoint() const
Return hit point.
PointRef start() const
Return first vertex.
bool hit() const
Is there a hit.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
List< label > labelList
A List of labels.
slidingInterface(const word &name, const label index, const polyTopoChanger &mme, const word &masterFaceZoneName, const word &slaveFaceZoneName, const word &cutPointZoneName, const word &cutFaceZoneName, const word &masterPatchName, const word &slavePatchName, const typeOfMatch tom, const bool coupleDecouple=false, const intersection::algorithm algo=intersection::algorithm::visible)
Construct from components.
Virtual base class for mesh modifiers.
errorManip< error > abort(error &err)
label whichPoint(const label gp) const
Given a global point index, return the local point index.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
vector vec(const pointField &) const
Return the vector (end - start)
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
static const NamedEnum< typeOfMatch, 2 > typeOfMatchNames_
Direction names.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
word name(const complex &)
Return a string representation of a complex.
typeOfMatch
Type of match.
scalar lineIntersect(const line< Point, PointRef > &l) const
Return the cutting point between the plane and.
const Field< PointType > & pointNormals() const
Return point normals for patch.
Point vec() const
Return start-end vector.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
label end() const
Return end vertex label.
prefixOSstream Pout(cout, "Pout")
const meshFaceZones & faceZones() const
Return face zones.
Direct mesh changes based on v1.3 polyTopoChange syntax.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
dimensioned< scalar > mag(const dimensioned< Type > &)
const faceZoneID & masterFaceZoneID() const
Return master face zone ID.
Mesh consisting of general polyhedral cells.
void setTolerances(const dictionary &, bool report=false)
Set the tolerances from the values in a dictionary.
scalar distance() const
Return distance to hit.
const polyMesh & mesh() const
Return the mesh reference.
void deleteDemandDrivenData(DataPtr &dataPtr)
virtual ~slidingInterface()
Destructor.
virtual void writeDict(Ostream &) const
Write dictionary.
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
virtual bool changeTopology() const
Check for topology change.
label start() const
Return start vertex label.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.