slidingInterface.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::slidingInterface
26 
27 Description
28  Sliding interface mesh modifier. Given two face zones, couple the
29  master and slave side using a cutting procedure.
30 
31  The coupled faces are collected into the "coupled" zone and can become
32  either internal or placed into a master and slave coupled zone. The
33  remaining faces (uncovered master or slave) are placed into the master
34  and slave patch.
35 
36  The definition of the sliding interface can be either integral or partial.
37  Integral interface implies that the slave side completely covers
38  the master (i.e. no faces are uncovered); partial interface
39  implies that the uncovered part of master/slave face zone should
40  become boundary faces.
41 
42 SourceFiles
43  slidingInterface.C
44  coupleSlidingInterface.C
45  decoupleSlidingInterface.C
46  slidingInterfaceProjectPoints.C
47  slidingInterfaceAttachedAddressing.C
48  slidingInterfaceClearCouple.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef slidingInterface_H
53 #define slidingInterface_H
54 
55 #include "polyMeshModifier.H"
56 #include "primitiveFacePatch.H"
57 #include "polyPatchID.H"
58 #include "ZoneIDs.H"
59 #include "intersection.H"
60 #include "Pair.H"
61 #include "objectHit.H"
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class slidingInterface Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class slidingInterface
73 :
74  public polyMeshModifier
75 {
76 public:
77 
78  // Public enumerations
79 
80  //- Type of match
81  enum typeOfMatch
82  {
84  PARTIAL
85  };
86 
87  //- Direction names
89 
90 private:
91 
92  // Private data
93 
94  //- Master face zone ID
96 
97  //- Slave face zone ID
99 
100  //- Cut point zone ID
102 
103  //- Cut face zone ID
105 
106  //- Master patch ID
108 
109  //- Slave patch ID
111 
112  //- Type of match
113  const typeOfMatch matchType_;
114 
115  //- Couple-decouple operation.
116  // If the interface is coupled, decouple it and vice versa.
117  // Used in conjuction with automatic mesh motion
118  mutable Switch coupleDecouple_;
119 
120  //- State of the modifier
121  mutable Switch attached_;
122 
123  //- Point projection algorithm
125 
126  //- Trigger topological change
127  mutable bool trigger_;
128 
129  // Tolerances. Initialised to static ones below.
130 
131  //- Point merge tolerance
132  scalar pointMergeTol_;
133 
134  //- Edge merge tolerance
135  scalar edgeMergeTol_;
136 
137  //- Estimated number of faces an edge goes through
139 
140  //- Edge-face interaction escape limit
142 
143  //- Integral match point adjustment tolerance
144  scalar integralAdjTol_;
145 
146  //- Edge intersection master catch fraction
148 
149  //- Edge intersection co-planar tolerance
150  scalar edgeCoPlanarTol_;
151 
152  //- Edge end cut-off tolerance
153  scalar edgeEndCutoffTol_;
154 
155 
156  // Private addressing data.
157 
158  //- Cut face master face. Gives the index of face in master patch
159  // the cut face has been created from. For a slave-only face
160  // this will be -1
161  mutable labelList* cutFaceMasterPtr_;
162 
163  //- Cut face slave face. Gives the index of face in slave patch
164  // the cut face has been created from. For a master-only face
165  // this will be -1
166  mutable labelList* cutFaceSlavePtr_;
167 
168  //- Master zone faceCells
170 
171  //- Slave zone faceCells
172  mutable labelList* slaveFaceCellsPtr_;
173 
174  //- Master stick-out faces
176 
177  //- Slave stick-out faces
179 
180  //- Retired point mapping.
181  // For every retired slave side point, gives the label of the
182  // master point that replaces it
184 
185  //- Cut edge pairs
186  // For cut points created by intersection two edges,
187  // store the master-slave edge pair used in creation
189 
190  //- Slave point hit. The index of master point hit by the
191  // slave point in projection. For no point hit, set to -1
193 
194  //- Slave edge hit. The index of master edge hit by the
195  // slave point in projection. For point or no edge hit, set to -1
197 
198  //- Slave face hit. The index of master face hit by the
199  // slave point in projection.
201 
202  //- Master point edge hit. The index of slave edge hit by
203  // a master point. For no hit set to -1
205 
206  //- Projected slave points
208 
209 
210  // Private Member Functions
211 
212  //- Disallow default bitwise copy construct
214 
215  //- Disallow default bitwise assignment
216  void operator=(const slidingInterface&);
217 
218  //- Clear out
219  void clearOut() const;
220 
221 
222  //- Check validity of construction data
223  void checkDefinition();
224 
225  //- Calculate attached addressing
226  void calcAttachedAddressing() const;
227 
228  //- Calculate decoupled zone face-cell addressing
229  void renumberAttachedAddressing(const mapPolyMesh&) const;
230 
231  //- Clear attached addressing
232  void clearAttachedAddressing() const;
233 
234 
235  // Topological changes
236 
237  //- Master faceCells
238  const labelList& masterFaceCells() const;
239 
240  //- Slave faceCells
241  const labelList& slaveFaceCells() const;
242 
243  //- Master stick-out faces
244  const labelList& masterStickOutFaces() const;
245 
246  //- Slave stick-out faces
247  const labelList& slaveStickOutFaces() const;
248 
249  //- Retired point map
250  const Map<label>& retiredPointMap() const;
251 
252  //- Cut point edge pair map
253  const Map<Pair<edge> >& cutPointEdgePairMap() const;
254 
255  //- Clear addressing
256  void clearAddressing() const;
257 
258  //- Project slave points and compare with the current projection.
259  // If the projection has changed, the sliding interface
260  // changes topologically
261  bool projectPoints() const;
262 
263  //- Couple sliding interface
264  void coupleInterface(polyTopoChange& ref) const;
265 
266  //- Clear projection
267  void clearPointProjection() const;
268 
269  //- Clear old couple
270  void clearCouple(polyTopoChange& ref) const;
271 
272  //- Decouple interface (returns it to decoupled state)
273  // Note: this should not be used in normal operation of the
274  // sliding mesh, but only to return the mesh to its
275  // original state
276  void decoupleInterface(polyTopoChange& ref) const;
277 
278 
279  // Static data members
280 
281  //- Point merge tolerance
282  static const scalar pointMergeTolDefault_;
283 
284  //- Edge merge tolerance
285  static const scalar edgeMergeTolDefault_;
286 
287  //- Estimated number of faces an edge goes through
288  static const label nFacesPerSlaveEdgeDefault_;
289 
290  //- Edge-face interaction escape limit
291  static const label edgeFaceEscapeLimitDefault_;
292 
293  //- Integral match point adjustment tolerance
294  static const scalar integralAdjTolDefault_;
295 
296  //- Edge intersection master catch fraction
297  static const scalar edgeMasterCatchFractionDefault_;
298 
299  //- Edge intersection co-planar tolerance
300  static const scalar edgeCoPlanarTolDefault_;
301 
302  //- Edge end cut-off tolerance
303  static const scalar edgeEndCutoffTolDefault_;
304 
305 
306 public:
307 
308  //- Runtime type information
309  TypeName("slidingInterface");
310 
311 
312  // Constructors
313 
314  //- Construct from components
316  (
317  const word& name,
318  const label index,
319  const polyTopoChanger& mme,
320  const word& masterFaceZoneName,
321  const word& slaveFaceZoneName,
322  const word& cutPointZoneName,
323  const word& cutFaceZoneName,
324  const word& masterPatchName,
325  const word& slavePatchName,
326  const typeOfMatch tom,
327  const bool coupleDecouple = false,
329  );
330 
331  //- Construct from dictionary
333  (
334  const word& name,
335  const dictionary& dict,
336  const label index,
337  const polyTopoChanger& mme
338  );
339 
340 
341  //- Destructor
342  virtual ~slidingInterface();
343 
344 
345  // Member Functions
346 
347  //- Return master face zone ID
348  const faceZoneID& masterFaceZoneID() const;
349 
350  //- Return slave face zone ID
351  const faceZoneID& slaveFaceZoneID() const;
352 
353  //- Return true if attached
354  bool attached() const
355  {
356  return attached_;
357  }
358 
359  //- Check for topology change
360  virtual bool changeTopology() const;
361 
362  //- Insert the layer addition/removal instructions
363  // into the topological change
364  virtual void setRefinement(polyTopoChange&) const;
365 
366  //- Modify motion points to comply with the topological change
367  virtual void modifyMotionPoints(pointField& motionPoints) const;
368 
369  //- Force recalculation of locally stored data on topological change
370  virtual void updateMesh(const mapPolyMesh&);
371 
372  //- Return projected points for a slave patch
373  const pointField& pointProjection() const;
374 
375  //- Set the tolerances from the values in a dictionary
376  void setTolerances(const dictionary&, bool report=false);
377 
378  //- Write
379  virtual void write(Ostream&) const;
380 
381  //- Write dictionary
382  virtual void writeDict(Ostream&) const;
383 };
384 
385 
386 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
387 
388 } // End namespace Foam
389 
390 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
391 
392 #endif
393 
394 // ************************************************************************* //
Foam::slidingInterface::edgeEndCutoffTolDefault_
static const scalar edgeEndCutoffTolDefault_
Edge end cut-off tolerance.
Definition: slidingInterface.H:302
Foam::slidingInterface::matchType_
const typeOfMatch matchType_
Type of match.
Definition: slidingInterface.H:112
Foam::slidingInterface::clearAddressing
void clearAddressing() const
Clear addressing.
Definition: slidingInterface.C:318
Foam::slidingInterface::edgeMergeTol_
scalar edgeMergeTol_
Edge merge tolerance.
Definition: slidingInterface.H:134
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::slidingInterface::retiredPointMap
const Map< label > & retiredPointMap() const
Retired point map.
Definition: slidingInterfaceAttachedAddressing.C:529
Foam::slidingInterface::cutFaceMasterPtr_
labelList * cutFaceMasterPtr_
Cut face master face. Gives the index of face in master patch.
Definition: slidingInterface.H:160
Foam::slidingInterface::masterPointEdgeHitsPtr_
labelList * masterPointEdgeHitsPtr_
Master point edge hit. The index of slave edge hit by.
Definition: slidingInterface.H:203
intersection.H
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::slidingInterface::cutFaceZoneID_
faceZoneID cutFaceZoneID_
Cut face zone ID.
Definition: slidingInterface.H:103
Foam::slidingInterface::setRefinement
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
Definition: slidingInterface.C:380
Foam::slidingInterface::attached_
Switch attached_
State of the modifier.
Definition: slidingInterface.H:120
Foam::slidingInterface::nFacesPerSlaveEdge_
label nFacesPerSlaveEdge_
Estimated number of faces an edge goes through.
Definition: slidingInterface.H:137
Foam::slidingInterface::clearOut
void clearOut() const
Clear out.
Definition: slidingInterface.C:109
Foam::slidingInterface::masterFaceCellsPtr_
labelList * masterFaceCellsPtr_
Master zone faceCells.
Definition: slidingInterface.H:168
Foam::slidingInterface::slaveFaceCells
const labelList & slaveFaceCells() const
Slave faceCells.
Definition: slidingInterfaceAttachedAddressing.C:487
Foam::slidingInterface::integralAdjTolDefault_
static const scalar integralAdjTolDefault_
Integral match point adjustment tolerance.
Definition: slidingInterface.H:293
Foam::slidingInterface::slaveFaceZoneID
const faceZoneID & slaveFaceZoneID() const
Return slave face zone ID.
Definition: slidingInterface.C:333
Foam::slidingInterface::clearPointProjection
void clearPointProjection() const
Clear projection.
Definition: slidingInterfaceProjectPoints.C:1250
Foam::intersection::VISIBLE
@ VISIBLE
Definition: intersection.H:73
Foam::slidingInterface::renumberAttachedAddressing
void renumberAttachedAddressing(const mapPolyMesh &) const
Calculate decoupled zone face-cell addressing.
Definition: slidingInterfaceAttachedAddressing.C:249
Foam::slidingInterface::typeOfMatch
typeOfMatch
Type of match.
Definition: slidingInterface.H:80
Foam::slidingInterface::PARTIAL
@ PARTIAL
Definition: slidingInterface.H:83
Foam::polyTopoChanger
List of mesh modifiers defining the mesh dynamics.
Definition: polyTopoChanger.H:56
Foam::slidingInterface::clearCouple
void clearCouple(polyTopoChange &ref) const
Clear old couple.
Definition: slidingInterfaceClearCouple.C:36
Foam::slidingInterface::masterPatchID_
polyPatchID masterPatchID_
Master patch ID.
Definition: slidingInterface.H:106
Foam::slidingInterface::cutFaceSlavePtr_
labelList * cutFaceSlavePtr_
Cut face slave face. Gives the index of face in slave patch.
Definition: slidingInterface.H:165
Foam::slidingInterface::slaveStickOutFaces
const labelList & slaveStickOutFaces() const
Slave stick-out faces.
Definition: slidingInterfaceAttachedAddressing.C:515
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:97
Foam::slidingInterface::cutPointZoneID_
pointZoneID cutPointZoneID_
Cut point zone ID.
Definition: slidingInterface.H:100
Foam::Map< label >
Foam::polyMeshModifier::index
label index() const
Return the index of this modifier.
Definition: polyMeshModifier.H:149
Foam::slidingInterface::typeOfMatchNames_
static const NamedEnum< typeOfMatch, 2 > typeOfMatchNames_
Direction names.
Definition: slidingInterface.H:87
Foam::slidingInterface::slavePointPointHitsPtr_
labelList * slavePointPointHitsPtr_
Slave point hit. The index of master point hit by the.
Definition: slidingInterface.H:191
Pair.H
ZoneIDs.H
Foam::slidingInterface
Sliding interface mesh modifier. Given two face zones, couple the master and slave side using a cutti...
Definition: slidingInterface.H:71
Foam::slidingInterface::nFacesPerSlaveEdgeDefault_
static const label nFacesPerSlaveEdgeDefault_
Estimated number of faces an edge goes through.
Definition: slidingInterface.H:287
Foam::DynamicID< faceZoneMesh >
Foam::slidingInterface::clearAttachedAddressing
void clearAttachedAddressing() const
Clear attached addressing.
Definition: slidingInterfaceAttachedAddressing.C:235
Foam::slidingInterface::setTolerances
void setTolerances(const dictionary &, bool report=false)
Set the tolerances from the values in a dictionary.
Definition: slidingInterface.C:688
polyPatchID.H
Foam::slidingInterface::attached
bool attached() const
Return true if attached.
Definition: slidingInterface.H:353
Foam::slidingInterface::~slidingInterface
virtual ~slidingInterface()
Destructor.
Definition: slidingInterface.C:312
Foam::slidingInterface::integralAdjTol_
scalar integralAdjTol_
Integral match point adjustment tolerance.
Definition: slidingInterface.H:143
Foam::slidingInterface::operator=
void operator=(const slidingInterface &)
Disallow default bitwise assignment.
Foam::slidingInterface::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: slidingInterface.C:646
Foam::slidingInterface::masterStickOutFaces
const labelList & masterStickOutFaces() const
Master stick-out faces.
Definition: slidingInterfaceAttachedAddressing.C:501
Foam::slidingInterface::cutPointEdgePairMapPtr_
Map< Pair< edge > > * cutPointEdgePairMapPtr_
Cut edge pairs.
Definition: slidingInterface.H:187
Foam::slidingInterface::decoupleInterface
void decoupleInterface(polyTopoChange &ref) const
Decouple interface (returns it to decoupled state)
Definition: decoupleSlidingInterface.C:37
objectHit.H
Foam::slidingInterface::pointMergeTol_
scalar pointMergeTol_
Point merge tolerance.
Definition: slidingInterface.H:131
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::slidingInterface::projectedSlavePointsPtr_
pointField * projectedSlavePointsPtr_
Projected slave points.
Definition: slidingInterface.H:206
Foam::slidingInterface::coupleDecouple_
Switch coupleDecouple_
Couple-decouple operation.
Definition: slidingInterface.H:117
Foam::intersection::algorithm
algorithm
Definition: intersection.H:69
Foam::slidingInterface::slaveStickOutFacesPtr_
labelList * slaveStickOutFacesPtr_
Slave stick-out faces.
Definition: slidingInterface.H:177
Foam::slidingInterface::edgeCoPlanarTol_
scalar edgeCoPlanarTol_
Edge intersection co-planar tolerance.
Definition: slidingInterface.H:149
Foam::slidingInterface::projectPoints
bool projectPoints() const
Project slave points and compare with the current projection.
Definition: slidingInterfaceProjectPoints.C:57
Foam::slidingInterface::retiredPointMapPtr_
Map< label > * retiredPointMapPtr_
Retired point mapping.
Definition: slidingInterface.H:182
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::slidingInterface::edgeFaceEscapeLimit_
label edgeFaceEscapeLimit_
Edge-face interaction escape limit.
Definition: slidingInterface.H:140
Foam::slidingInterface::edgeCoPlanarTolDefault_
static const scalar edgeCoPlanarTolDefault_
Edge intersection co-planar tolerance.
Definition: slidingInterface.H:299
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::polyMeshModifier
Virtual base class for mesh modifiers.
Definition: polyMeshModifier.H:61
Foam::slidingInterface::TypeName
TypeName("slidingInterface")
Runtime type information.
Foam::slidingInterface::edgeMasterCatchFractionDefault_
static const scalar edgeMasterCatchFractionDefault_
Edge intersection master catch fraction.
Definition: slidingInterface.H:296
Foam::polyMeshModifier::name
const word & name() const
Return name of this modifier.
Definition: polyMeshModifier.H:143
Foam::slidingInterface::slaveFaceZoneID_
faceZoneID slaveFaceZoneID_
Slave face zone ID.
Definition: slidingInterface.H:97
Foam::slidingInterface::masterFaceZoneID_
faceZoneID masterFaceZoneID_
Master face zone ID.
Definition: slidingInterface.H:94
Foam::slidingInterface::slidingInterface
slidingInterface(const slidingInterface &)
Disallow default bitwise copy construct.
Foam::slidingInterface::coupleInterface
void coupleInterface(polyTopoChange &ref) const
Couple sliding interface.
Definition: coupleSlidingInterface.C:68
Foam::slidingInterface::modifyMotionPoints
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
Definition: slidingInterface.C:413
Foam::slidingInterface::edgeFaceEscapeLimitDefault_
static const label edgeFaceEscapeLimitDefault_
Edge-face interaction escape limit.
Definition: slidingInterface.H:290
Foam::slidingInterface::slavePointFaceHitsPtr_
List< objectHit > * slavePointFaceHitsPtr_
Slave face hit. The index of master face hit by the.
Definition: slidingInterface.H:199
Foam::slidingInterface::trigger_
bool trigger_
Trigger topological change.
Definition: slidingInterface.H:126
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::slidingInterface::pointMergeTolDefault_
static const scalar pointMergeTolDefault_
Point merge tolerance.
Definition: slidingInterface.H:281
Foam::slidingInterface::masterStickOutFacesPtr_
labelList * masterStickOutFacesPtr_
Master stick-out faces.
Definition: slidingInterface.H:174
Foam::slidingInterface::calcAttachedAddressing
void calcAttachedAddressing() const
Calculate attached addressing.
Definition: slidingInterfaceAttachedAddressing.C:33
Foam::slidingInterface::projectionAlgo_
intersection::algorithm projectionAlgo_
Point projection algorithm.
Definition: slidingInterface.H:123
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::slidingInterface::slavePointEdgeHitsPtr_
labelList * slavePointEdgeHitsPtr_
Slave edge hit. The index of master edge hit by the.
Definition: slidingInterface.H:195
Foam::slidingInterface::slaveFaceCellsPtr_
labelList * slaveFaceCellsPtr_
Slave zone faceCells.
Definition: slidingInterface.H:171
Foam::slidingInterface::edgeMergeTolDefault_
static const scalar edgeMergeTolDefault_
Edge merge tolerance.
Definition: slidingInterface.H:284
Foam::slidingInterface::checkDefinition
void checkDefinition()
Check validity of construction data.
Definition: slidingInterface.C:68
Foam::slidingInterface::slavePatchID_
polyPatchID slavePatchID_
Slave patch ID.
Definition: slidingInterface.H:109
Foam::slidingInterface::masterFaceZoneID
const faceZoneID & masterFaceZoneID() const
Return master face zone ID.
Definition: slidingInterface.C:327
Foam::slidingInterface::masterFaceCells
const labelList & masterFaceCells() const
Master faceCells.
Definition: slidingInterfaceAttachedAddressing.C:473
Foam::slidingInterface::edgeEndCutoffTol_
scalar edgeEndCutoffTol_
Edge end cut-off tolerance.
Definition: slidingInterface.H:152
Foam::slidingInterface::writeDict
virtual void writeDict(Ostream &) const
Write dictionary.
Definition: slidingInterface.C:770
Foam::slidingInterface::INTEGRAL
@ INTEGRAL
Definition: slidingInterface.H:82
Foam::slidingInterface::edgeMasterCatchFraction_
scalar edgeMasterCatchFraction_
Edge intersection master catch fraction.
Definition: slidingInterface.H:146
Foam::slidingInterface::cutPointEdgePairMap
const Map< Pair< edge > > & cutPointEdgePairMap() const
Cut point edge pair map.
Definition: slidingInterfaceAttachedAddressing.C:543
Foam::slidingInterface::write
virtual void write(Ostream &) const
Write.
Definition: slidingInterface.C:746
Foam::NamedEnum< typeOfMatch, 2 >
Foam::slidingInterface::pointProjection
const pointField & pointProjection() const
Return projected points for a slave patch.
Definition: slidingInterface.C:678
Foam::slidingInterface::changeTopology
virtual bool changeTopology() const
Check for topology change.
Definition: slidingInterface.C:339
polyMeshModifier.H