60 { typeOfMatch::INTEGRAL,
"integral" },
61 { typeOfMatch::PARTIAL,
"partial" },
67void 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."
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;
108void Foam::slidingInterface::clearOut()
const
110 clearPointProjection();
111 clearAttachedAddressing();
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,
138 mme.
mesh().faceZones()
143 mme.
mesh().faceZones()
148 mme.
mesh().pointZones()
153 mme.
mesh().faceZones()
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();
220 mme.
mesh().faceZones()
225 mme.
mesh().faceZones()
230 mme.
mesh().pointZones()
235 mme.
mesh().faceZones()
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();
310void 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());
772 os.
writeEntry(
"typeOfMatch", typeOfMatchNames[matchType_]);
782 masterStickOutFacesPtr_->
writeEntry(
"masterStickOutFaces",
os);
783 slaveStickOutFacesPtr_->
writeEntry(
"slaveStickOutFaces",
os);
786 os.
writeEntry(
"cutPointEdgePairMap", cutPointEdgePairMap());
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
label index() const
The index of the first matching items, -1 if no matches.
bool active() const noexcept
Has the zone been found.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
T & first() noexcept
The first element of the list, position [0].
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
A HashTable to objects of type <T> with a label key.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & endBlock()
Write end block group.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
An ordered pair of two objects of type <T> with first() and second() elements.
const T & second() const noexcept
Return second element, which is also the last element.
Describes the interaction of a face and a point. It carries the info of a successful hit and (if succ...
scalar distance() const noexcept
Return distance to hit.
const point_type & missPoint() const
Return the miss point. Fatal if hit.
bool hit() const noexcept
Is there a hit.
const point_type & hitPoint() const
Return the hit point. Fatal if not hit.
A list of faces which address into the list of points.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const Field< point_type > & localPoints() const
Return pointField of points in patch.
const Field< point_type > & pointNormals() const
Return point normals for patch.
label whichPoint(const label gp) const
Given a global point index, return the local point index.
label whichEdge(const edge &e) const
Identical to findEdge.
void size(const label n)
Older name for setAddressableSize.
bool empty() const noexcept
True if the list is empty (ie, size() is zero)
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
label end() const
Return end (last/second) vertex label.
vector vec(const UList< point > &pts) const
Return the vector (end - start)
linePointRef line(const UList< point > &pts) const
Return edge line.
label start() const
Return start (first) vertex label.
virtual bool write()
Write the output fields.
Foam::dictionary writeDict() const
Write to dictionary.
static const Enum< algorithm > algorithmNames_
Projection algorithm names.
A class for handling keywords in dictionaries.
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
scalar mag() const
Return scalar magnitude.
PointRef start() const noexcept
Return first point.
Point vec() const
Return start-to-end vector.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void updateMesh()
Update for new mesh topology.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
scalar lineIntersect(const line< Point, PointRef > &l) const
Return the cutting point between the plane and.
Virtual base class for mesh modifiers.
const word & name() const
Return name of this modifier.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
Mesh consisting of general polyhedral cells.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
Direct mesh changes based on v1.3 polyTopoChange syntax.
List of mesh modifiers defining the mesh dynamics.
const polyMesh & mesh() const
Return the mesh reference.
Sliding interface mesh modifier. Given two face zones, couple the master and slave side using a cutti...
const faceZoneID & masterFaceZoneID() const
Return master face zone ID.
void setTolerances(const dictionary &, bool report=false)
Set the tolerances from the values in a dictionary.
const pointField & pointProjection() const
Return projected points for a slave patch.
static const Enum< typeOfMatch > typeOfMatchNames
Names for the types of matches.
typeOfMatch
Type of match.
virtual bool changeTopology() const
Check for topology change.
const faceZoneID & slaveFaceZoneID() const
Return slave face zone ID.
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.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
constexpr char nl
The newline '\n' character (0x0a)
#define WRITE_NON_DEFAULT(name)