Go to the documentation of this file.
59 { typeOfMatch::INTEGRAL,
"integral" },
60 { typeOfMatch::PARTIAL,
"partial" },
66 void Foam::slidingInterface::checkDefinition()
72 !masterFaceZoneID_.
active()
73 || !slaveFaceZoneID_.
active()
74 || !cutPointZoneID_.
active()
75 || !cutFaceZoneID_.
active()
76 || !masterPatchID_.
active()
81 <<
"Not all zones and patches needed in the definition "
82 <<
"have been found. Please check your mesh definition."
89 mesh.faceZones()[masterFaceZoneID_.
index()].empty()
90 ||
mesh.faceZones()[slaveFaceZoneID_.
index()].empty()
94 <<
"Please check your mesh definition."
100 Pout<<
"Sliding interface object " <<
name() <<
" :" <<
nl
101 <<
" master face zone: " << masterFaceZoneID_.
index() <<
nl
102 <<
" slave face zone: " << slaveFaceZoneID_.
index() <<
endl;
107 void Foam::slidingInterface::clearOut()
const
109 clearPointProjection();
110 clearAttachedAddressing();
117 Foam::slidingInterface::slidingInterface
122 const word& masterFaceZoneName,
123 const word& slaveFaceZoneName,
124 const word& cutPointZoneName,
125 const word& cutFaceZoneName,
126 const word& masterPatchName,
127 const word& slavePatchName,
129 const bool coupleDecouple,
165 coupleDecouple_(coupleDecouple),
167 projectionAlgo_(algo),
169 pointMergeTol_(pointMergeTolDefault_),
170 edgeMergeTol_(edgeMergeTolDefault_),
171 nFacesPerSlaveEdge_(nFacesPerSlaveEdgeDefault_),
172 edgeFaceEscapeLimit_(edgeFaceEscapeLimitDefault_),
173 integralAdjTol_(integralAdjTolDefault_),
174 edgeMasterCatchFraction_(edgeMasterCatchFractionDefault_),
175 edgeCoPlanarTol_(edgeCoPlanarTolDefault_),
176 edgeEndCutoffTol_(edgeEndCutoffTolDefault_),
177 cutFaceMasterPtr_(
nullptr),
178 cutFaceSlavePtr_(
nullptr),
179 masterFaceCellsPtr_(
nullptr),
180 slaveFaceCellsPtr_(
nullptr),
181 masterStickOutFacesPtr_(
nullptr),
182 slaveStickOutFacesPtr_(
nullptr),
183 retiredPointMapPtr_(
nullptr),
184 cutPointEdgePairMapPtr_(
nullptr),
185 slavePointPointHitsPtr_(
nullptr),
186 slavePointEdgeHitsPtr_(
nullptr),
187 slavePointFaceHitsPtr_(
nullptr),
188 masterPointEdgeHitsPtr_(
nullptr),
189 projectedSlavePointsPtr_(
nullptr)
196 <<
"Creation of a sliding interface from components "
197 <<
"in attached state not supported."
202 calcAttachedAddressing();
207 Foam::slidingInterface::slidingInterface
246 matchType_(typeOfMatchNames.get(
"typeOfMatch",
dict)),
247 coupleDecouple_(
dict.
lookup(
"coupleDecouple")),
254 cutFaceMasterPtr_(
nullptr),
255 cutFaceSlavePtr_(
nullptr),
256 masterFaceCellsPtr_(
nullptr),
257 slaveFaceCellsPtr_(
nullptr),
258 masterStickOutFacesPtr_(
nullptr),
259 slaveStickOutFacesPtr_(
nullptr),
260 retiredPointMapPtr_(
nullptr),
261 cutPointEdgePairMapPtr_(
nullptr),
262 slavePointPointHitsPtr_(
nullptr),
263 slavePointEdgeHitsPtr_(
nullptr),
264 slavePointFaceHitsPtr_(
nullptr),
265 masterPointEdgeHitsPtr_(
nullptr),
266 projectedSlavePointsPtr_(
nullptr)
279 Pout<<
"slidingInterface::slidingInterface(...) "
280 <<
" for object " <<
name <<
" : "
281 <<
"Interface attached. Reading master and slave face zones "
282 <<
"and retired point lookup." <<
endl;
289 masterStickOutFacesPtr_ =
291 slaveStickOutFacesPtr_ =
295 cutPointEdgePairMapPtr_ =
300 calcAttachedAddressing();
313 void Foam::slidingInterface::clearAddressing()
const
324 return masterFaceZoneID_;
330 return slaveFaceZoneID_;
341 Pout<<
"bool slidingInterface::changeTopology() const "
342 <<
"for object " <<
name() <<
" : "
343 <<
"Couple-decouple mode." <<
endl;
360 && !topoChanger().
mesh().changing()
370 return projectPoints();
382 decoupleInterface(
ref);
387 coupleInterface(
ref);
401 coupleInterface(
ref);
412 Pout<<
"void slidingInterface::modifyMotionPoints("
413 <<
"pointField& motionPoints) const for object " <<
name() <<
" : "
414 <<
"Adjusting motion points." <<
endl;
422 if (cutPoints.size() && !projectedSlavePointsPtr_)
428 const pointField& projectedSlavePoints = *projectedSlavePointsPtr_;
448 for (
const label pointi : cutPoints)
451 const auto rpmIter = rpm.cfind(pointi);
461 motionPoints[cutPoints[pointi]] =
462 projectedSlavePoints[slaveZonePointMap.find(rpmIter())()];
469 const auto cpepmIter = cpepm.cfind(pointi);
471 if (cpepmIter.found())
484 const edge& globalMasterEdge = cpepmIter().first();
486 const label curMasterEdgeIndex =
493 globalMasterEdge.
start()
497 globalMasterEdge.
end()
502 const edge& cme = masterEdges[curMasterEdgeIndex];
508 const edge& globalSlaveEdge = cpepmIter().
second();
510 const label curSlaveEdgeIndex =
517 globalSlaveEdge.
start()
521 globalSlaveEdge.
end()
526 const edge& curSlaveEdge = slaveEdges[curSlaveEdgeIndex];
530 const point& a = projectedSlavePoints[curSlaveEdge.
start()];
531 const point&
b = projectedSlavePoints[curSlaveEdge.
end()];
536 slaveLocalPoints[curSlaveEdge.
start()]
537 + slavePointNormals[curSlaveEdge.
start()]
538 + slaveLocalPoints[curSlaveEdge.
end()]
539 + slavePointNormals[curSlaveEdge.
end()]
546 curSlaveEdge.
line(slaveLocalPoints);
547 const scalar curSlaveLineMag = curSlaveLine.
mag();
552 cme.
line(masterLocalPoints)
557 cutOnMaster > edgeEndCutoffTol_
558 && cutOnMaster < 1.0 - edgeEndCutoffTol_
562 point masterCutPoint =
563 masterLocalPoints[cme.
start()]
564 + cutOnMaster*cme.
vec(masterLocalPoints);
577 - curSlaveLine.
start()
578 ) & curSlaveLine.
vec()
579 )/
sqr(curSlaveLineMag);
584 edgeCoPlanarTol_*
mag(
b - a);
588 cutOnSlave > edgeEndCutoffTol_
589 && cutOnSlave < 1.0 - edgeEndCutoffTol_
594 motionPoints[pointi] = masterCutPoint;
599 Pout<<
"Missed slave edge!!! This is an error. "
601 << cme.
line(masterLocalPoints)
602 <<
" slave edge: " << curSlaveLine
603 <<
" point: " << masterCutPoint
608 - curSlaveLine.
start()
609 ) & curSlaveLine.
vec()
610 )/
sqr(curSlaveLineMag)
616 Pout<<
"Missed master edge!!! This is an error"
623 <<
"Cut point " << cutPoints[pointi]
624 <<
" not recognised as either the projected "
625 <<
"or as intersection point. Error in point "
626 <<
"projection or data mapping"
643 Pout<<
"void slidingInterface::updateMesh(const mapPolyMesh& m)"
644 <<
" const for object " <<
name() <<
" : "
645 <<
"Updating topology." <<
endl;
673 if (!projectedSlavePointsPtr_)
678 return *projectedSlavePointsPtr_;
695 "nFacesPerSlaveEdge",
700 "edgeFaceEscapeLimit",
710 "edgeMasterCatchFraction",
711 edgeMasterCatchFraction_
726 Info<<
"Sliding interface parameters:" <<
nl
727 <<
"pointMergeTol : " << pointMergeTol_ <<
nl
728 <<
"edgeMergeTol : " << edgeMergeTol_ <<
nl
729 <<
"nFacesPerSlaveEdge : " << nFacesPerSlaveEdge_ <<
nl
730 <<
"edgeFaceEscapeLimit : " << edgeFaceEscapeLimit_ <<
nl
731 <<
"integralAdjTol : " << integralAdjTol_ <<
nl
732 <<
"edgeMasterCatchFraction : " << edgeMasterCatchFraction_ <<
nl
733 <<
"edgeCoPlanarTol : " << edgeCoPlanarTol_ <<
nl
734 <<
"edgeEndCutoffTol : " << edgeEndCutoffTol_ <<
endl;
743 << masterFaceZoneID_.name() <<
nl
744 << slaveFaceZoneID_.name() <<
nl
745 << cutPointZoneID_.name() <<
nl
746 << cutFaceZoneID_.name() <<
nl
747 << masterPatchID_.name() <<
nl
748 << slavePatchID_.name() <<
nl
749 << typeOfMatchNames[matchType_] <<
nl
750 << coupleDecouple_ <<
nl
751 << attached_ <<
endl;
756 #define WRITE_NON_DEFAULT(name) \
757 if ( name ## _ != name ## Default_ )\
759 os << " " #name " " << name ## _ << token::END_STATEMENT << nl; \
770 os.
writeEntry(
"masterFaceZoneName", masterFaceZoneID_.name());
771 os.
writeEntry(
"slaveFaceZoneName", slaveFaceZoneID_.name());
772 os.
writeEntry(
"cutPointZoneName", cutPointZoneID_.name());
773 os.
writeEntry(
"cutFaceZoneName", cutFaceZoneID_.name());
774 os.
writeEntry(
"masterPatchName", masterPatchID_.name());
775 os.
writeEntry(
"slavePatchName", slavePatchID_.name());
776 os.
writeEntry(
"typeOfMatch", typeOfMatchNames[matchType_]);
777 os.
writeEntry(
"coupleDecouple", coupleDecouple_);
784 masterFaceCellsPtr_->
writeEntry(
"masterFaceCells", os);
785 slaveFaceCellsPtr_->
writeEntry(
"slaveFaceCells", os);
786 masterStickOutFacesPtr_->
writeEntry(
"masterStickOutFaces", os);
787 slaveStickOutFacesPtr_->
writeEntry(
"slaveStickOutFaces", os);
789 os.
writeEntry(
"retiredPointMap", retiredPointMap());
790 os.
writeEntry(
"cutPointEdgePairMap", cutPointEdgePairMap());
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
List< label > labelList
A List of labels.
label whichPoint(const label gp) const
Given a global point index, return the local point index.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
bool hit() const
Is there a hit.
A class for handling words, derived from Foam::string.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
const faceZoneID & slaveFaceZoneID() const
Return slave face zone ID.
linePointRef line(const UList< point > &pts) const
Return edge line.
typeOfMatch
Type of match.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
List of mesh modifiers defining the mesh dynamics.
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...
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
PointRef start() const
Return first point.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Mesh consisting of general polyhedral cells.
void setTolerances(const dictionary &, bool report=false)
Set the tolerances from the values in a dictionary.
virtual ~slidingInterface()
Destructor.
const faceZoneMesh & faceZones() const
Return face zone mesh.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
void deleteDemandDrivenData(DataPtr &dataPtr)
static const Enum< algorithm > algorithmNames_
Projection algorithm names.
label start() const
Return start (first) vertex label.
scalar distance() const
Return distance to hit.
#define WRITE_NON_DEFAULT(name)
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 dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
messageStream Info
Information stream (uses stdout - output is on the master only)
const pointZoneMesh & pointZones() const
Return point zone mesh.
word name(const complex &c)
Return string representation of complex.
label end() const
Return end (last/second) vertex label.
const T & second() const noexcept
Return second (last) vertex label.
scalar mag() const
Return scalar magnitude.
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
virtual Ostream & endBlock()
Write end block group.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
scalar lineIntersect(const line< Point, PointRef > &l) const
Return the cutting point between the plane and.
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
Virtual base class for mesh modifiers.
const word & name() const
Return name of this modifier.
const Field< PointType > & pointNormals() const
Return point normals for patch.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
const polyMesh & mesh() const
Return the mesh reference.
vector vec(const UList< point > &pts) const
Return the vector (end - start)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
label whichEdge(const edge &) const
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const dimensionedScalar c
Speed of light in a vacuum.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const faceZoneID & masterFaceZoneID() const
Return master face zone ID.
const Point & missPoint() const
Return miss point.
virtual void writeDict(Ostream &) const
Write dictionary.
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
defineTypeNameAndDebug(combustionModel, 0)
Point vec() const
Return start-to-end vector.
bool active() const
Has the zone been found.
const Point & hitPoint() const
Return hit point.
static const Enum< typeOfMatch > typeOfMatchNames
Names for the types of matches.
virtual void write(Ostream &) const
Write.
label index() const
Return index of first matching zone.
const pointField & pointProjection() const
Return projected points for a slave patch.
virtual bool changeTopology() const
Check for topology change.
A list of faces which address into the list of points.