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