Go to the documentation of this file.
60 { typeOfMatch::INTEGRAL,
"integral" },
61 { typeOfMatch::PARTIAL,
"partial" },
67 void Foam::slidingInterface::checkDefinition()
73 !masterFaceZoneID_.
active()
74 || !slaveFaceZoneID_.
active()
75 || !cutPointZoneID_.
active()
76 || !cutFaceZoneID_.
active()
77 || !masterPatchID_.
active()
82 <<
"Not all zones and patches needed in the definition "
83 <<
"have been found. Please check your mesh definition."
90 mesh.faceZones()[masterFaceZoneID_.
index()].empty()
91 ||
mesh.faceZones()[slaveFaceZoneID_.
index()].empty()
95 <<
"Please check your mesh definition."
101 Pout<<
"Sliding interface object " <<
name() <<
" :" <<
nl
102 <<
" master face zone: " << masterFaceZoneID_.
index() <<
nl
103 <<
" slave face zone: " << slaveFaceZoneID_.
index() <<
endl;
108 void Foam::slidingInterface::clearOut()
const
110 clearPointProjection();
111 clearAttachedAddressing();
118 Foam::slidingInterface::slidingInterface
123 const word& masterFaceZoneName,
124 const word& slaveFaceZoneName,
125 const word& cutPointZoneName,
126 const word& cutFaceZoneName,
127 const word& masterPatchName,
128 const word& slavePatchName,
130 const bool coupleDecouple,
166 coupleDecouple_(coupleDecouple),
168 projectionAlgo_(algo),
170 pointMergeTol_(pointMergeTolDefault_),
171 edgeMergeTol_(edgeMergeTolDefault_),
172 nFacesPerSlaveEdge_(nFacesPerSlaveEdgeDefault_),
173 edgeFaceEscapeLimit_(edgeFaceEscapeLimitDefault_),
174 integralAdjTol_(integralAdjTolDefault_),
175 edgeMasterCatchFraction_(edgeMasterCatchFractionDefault_),
176 edgeCoPlanarTol_(edgeCoPlanarTolDefault_),
177 edgeEndCutoffTol_(edgeEndCutoffTolDefault_),
178 cutFaceMasterPtr_(
nullptr),
179 cutFaceSlavePtr_(
nullptr),
180 masterFaceCellsPtr_(
nullptr),
181 slaveFaceCellsPtr_(
nullptr),
182 masterStickOutFacesPtr_(
nullptr),
183 slaveStickOutFacesPtr_(
nullptr),
184 retiredPointMapPtr_(
nullptr),
185 cutPointEdgePairMapPtr_(
nullptr),
186 slavePointPointHitsPtr_(
nullptr),
187 slavePointEdgeHitsPtr_(
nullptr),
188 slavePointFaceHitsPtr_(
nullptr),
189 masterPointEdgeHitsPtr_(
nullptr),
190 projectedSlavePointsPtr_(
nullptr)
197 <<
"Creation of a sliding interface from components "
198 <<
"in attached state not supported."
203 calcAttachedAddressing();
208 Foam::slidingInterface::slidingInterface
247 matchType_(typeOfMatchNames.get(
"typeOfMatch",
dict)),
248 coupleDecouple_(
dict.
get<
bool>(
"coupleDecouple")),
249 attached_(
dict.
get<
bool>(
"attached")),
255 cutFaceMasterPtr_(
nullptr),
256 cutFaceSlavePtr_(
nullptr),
257 masterFaceCellsPtr_(
nullptr),
258 slaveFaceCellsPtr_(
nullptr),
259 masterStickOutFacesPtr_(
nullptr),
260 slaveStickOutFacesPtr_(
nullptr),
261 retiredPointMapPtr_(
nullptr),
262 cutPointEdgePairMapPtr_(
nullptr),
263 slavePointPointHitsPtr_(
nullptr),
264 slavePointEdgeHitsPtr_(
nullptr),
265 slavePointFaceHitsPtr_(
nullptr),
266 masterPointEdgeHitsPtr_(
nullptr),
267 projectedSlavePointsPtr_(
nullptr)
280 Pout<<
"slidingInterface::slidingInterface(...) "
281 <<
" for object " <<
name <<
" : "
282 <<
"Interface attached. Reading master and slave face zones "
283 <<
"and retired point lookup." <<
endl;
287 masterFaceCellsPtr_.reset(
new labelList{});
288 slaveFaceCellsPtr_.reset(
new labelList{});
289 masterStickOutFacesPtr_.reset(
new labelList{});
290 slaveStickOutFacesPtr_.reset(
new labelList{});
296 dict.
readEntry(
"masterStickOutFaces", *masterStickOutFacesPtr_);
297 dict.
readEntry(
"slaveStickOutFaces", *slaveStickOutFacesPtr_);
299 dict.
readEntry(
"cutPointEdgePairMap", *cutPointEdgePairMapPtr_);
303 calcAttachedAddressing();
310 void Foam::slidingInterface::clearAddressing()
const
312 cutFaceMasterPtr_.reset(
nullptr);
313 cutFaceSlavePtr_.reset(
nullptr);
319 return masterFaceZoneID_;
325 return slaveFaceZoneID_;
336 Pout<<
"bool slidingInterface::changeTopology() const "
337 <<
"for object " <<
name() <<
" : "
338 <<
"Couple-decouple mode." <<
endl;
355 && !topoChanger().
mesh().changing()
365 return projectPoints();
377 decoupleInterface(
ref);
382 coupleInterface(
ref);
396 coupleInterface(
ref);
407 Pout<<
"void slidingInterface::modifyMotionPoints("
408 <<
"pointField& motionPoints) const for object " <<
name() <<
" : "
409 <<
"Adjusting motion points." <<
endl;
417 if (cutPoints.size() && !projectedSlavePointsPtr_)
423 const pointField& projectedSlavePoints = *projectedSlavePointsPtr_;
443 for (
const label pointi : cutPoints)
446 const auto rpmIter = rpm.cfind(pointi);
456 motionPoints[cutPoints[pointi]] =
457 projectedSlavePoints[slaveZonePointMap.find(rpmIter())()];
464 const auto cpepmIter = cpepm.cfind(pointi);
466 if (cpepmIter.found())
479 const edge& globalMasterEdge = cpepmIter().first();
481 const label curMasterEdgeIndex =
488 globalMasterEdge.
start()
492 globalMasterEdge.
end()
497 const edge& cme = masterEdges[curMasterEdgeIndex];
503 const edge& globalSlaveEdge = cpepmIter().
second();
505 const label curSlaveEdgeIndex =
512 globalSlaveEdge.
start()
516 globalSlaveEdge.
end()
521 const edge& curSlaveEdge = slaveEdges[curSlaveEdgeIndex];
525 const point& a = projectedSlavePoints[curSlaveEdge.
start()];
526 const point&
b = projectedSlavePoints[curSlaveEdge.
end()];
531 slaveLocalPoints[curSlaveEdge.
start()]
532 + slavePointNormals[curSlaveEdge.
start()]
533 + slaveLocalPoints[curSlaveEdge.
end()]
534 + slavePointNormals[curSlaveEdge.
end()]
541 curSlaveEdge.
line(slaveLocalPoints);
542 const scalar curSlaveLineMag = curSlaveLine.
mag();
547 cme.
line(masterLocalPoints)
552 cutOnMaster > edgeEndCutoffTol_
553 && cutOnMaster < 1.0 - edgeEndCutoffTol_
557 point masterCutPoint =
558 masterLocalPoints[cme.
start()]
559 + cutOnMaster*cme.
vec(masterLocalPoints);
572 - curSlaveLine.
start()
573 ) & curSlaveLine.
vec()
574 )/
sqr(curSlaveLineMag);
579 edgeCoPlanarTol_*
mag(
b - a);
583 cutOnSlave > edgeEndCutoffTol_
584 && cutOnSlave < 1.0 - edgeEndCutoffTol_
589 motionPoints[pointi] = masterCutPoint;
594 Pout<<
"Missed slave edge!!! This is an error. "
596 << cme.
line(masterLocalPoints)
597 <<
" slave edge: " << curSlaveLine
598 <<
" point: " << masterCutPoint
603 - curSlaveLine.
start()
604 ) & curSlaveLine.
vec()
605 )/
sqr(curSlaveLineMag)
611 Pout<<
"Missed master edge!!! This is an error"
618 <<
"Cut point " << cutPoints[pointi]
619 <<
" not recognised as either the projected "
620 <<
"or as intersection point. Error in point "
621 <<
"projection or data mapping"
638 Pout<<
"void slidingInterface::updateMesh(const mapPolyMesh& m)"
639 <<
" const for object " <<
name() <<
" : "
640 <<
"Updating topology." <<
endl;
668 if (!projectedSlavePointsPtr_)
673 return *projectedSlavePointsPtr_;
691 "nFacesPerSlaveEdge",
696 "edgeFaceEscapeLimit",
706 "edgeMasterCatchFraction",
707 edgeMasterCatchFraction_
722 Info<<
"Sliding interface parameters:" <<
nl
723 <<
"pointMergeTol : " << pointMergeTol_ <<
nl
724 <<
"edgeMergeTol : " << edgeMergeTol_ <<
nl
725 <<
"nFacesPerSlaveEdge : " << nFacesPerSlaveEdge_ <<
nl
726 <<
"edgeFaceEscapeLimit : " << edgeFaceEscapeLimit_ <<
nl
727 <<
"integralAdjTol : " << integralAdjTol_ <<
nl
728 <<
"edgeMasterCatchFraction : " << edgeMasterCatchFraction_ <<
nl
729 <<
"edgeCoPlanarTol : " << edgeCoPlanarTol_ <<
nl
730 <<
"edgeEndCutoffTol : " << edgeEndCutoffTol_ <<
endl;
739 << masterFaceZoneID_.name() <<
nl
740 << slaveFaceZoneID_.name() <<
nl
741 << cutPointZoneID_.name() <<
nl
742 << cutFaceZoneID_.name() <<
nl
743 << masterPatchID_.name() <<
nl
744 << slavePatchID_.name() <<
nl
745 << typeOfMatchNames[matchType_] <<
nl
746 << coupleDecouple_ <<
nl
747 << attached_ <<
endl;
752 #define WRITE_NON_DEFAULT(name) \
753 if ( name ## _ != name ## Default_ )\
755 os << " " #name " " << name ## _ << token::END_STATEMENT << nl; \
766 os.
writeEntry(
"masterFaceZoneName", masterFaceZoneID_.name());
767 os.
writeEntry(
"slaveFaceZoneName", slaveFaceZoneID_.name());
768 os.
writeEntry(
"cutPointZoneName", cutPointZoneID_.name());
769 os.
writeEntry(
"cutFaceZoneName", cutFaceZoneID_.name());
770 os.
writeEntry(
"masterPatchName", masterPatchID_.name());
771 os.
writeEntry(
"slavePatchName", slavePatchID_.name());
772 os.
writeEntry(
"typeOfMatch", typeOfMatchNames[matchType_]);
773 os.
writeEntry(
"coupleDecouple", coupleDecouple_);
780 masterFaceCellsPtr_->
writeEntry(
"masterFaceCells", os);
781 slaveFaceCellsPtr_->
writeEntry(
"slaveFaceCells", os);
782 masterStickOutFacesPtr_->
writeEntry(
"masterStickOutFaces", os);
783 slaveStickOutFacesPtr_->
writeEntry(
"slaveStickOutFaces", os);
785 os.
writeEntry(
"retiredPointMap", retiredPointMap());
786 os.
writeEntry(
"cutPointEdgePairMap", cutPointEdgePairMap());
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
const T & second() const noexcept
Return second element, which is also the last element.
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< point_type > & pointNormals() const
Return point normals for 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
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.
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 ...
static const Enum< algorithm > algorithmNames_
Projection algorithm names.
A class for handling keywords in dictionaries.
label start() const
Return start (first) vertex label.
scalar distance() const
Return distance to hit.
#define WRITE_NON_DEFAULT(name)
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.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
scalar mag() const
Return scalar magnitude.
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)
const Field< point_type > & localPoints() const
Return pointField of points in patch.
Virtual base class for mesh modifiers.
const word & name() const
Return name of this modifier.
#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.
An ordered pair of two objects of type <T> with first() and second() elements.
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.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
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.