mergePatchPairs.H
Go to the documentation of this file.
1// Handle merging of patch pairs
2{
3 wordPairList mergePatchPairs;
4
5 // Read in a list of dictionaries for the merge patch pairs
6 if
7 (
8 meshDict.readIfPresent("mergePatchPairs", mergePatchPairs)
9 && mergePatchPairs.size()
10 )
11 {
12 Info<< "Creating merge patch pairs" << nl << endl;
13
14 Info<< "Adding point and face zones" << endl;
15 {
16 auto& pzs = mesh.pointZones();
17 pzs.clearAddressing();
18 auto& fzs = mesh.faceZones();
19 fzs.clearAddressing();
20
21 forAll(mergePatchPairs, pairi)
22 {
23 const word mergeName
24 (
25 mergePatchPairs[pairi].first()
26 + mergePatchPairs[pairi].second()
27 + name(pairi)
28 );
29
30 // An empty zone for cut points
31 pzs.append
32 (
33 new pointZone
34 (
35 mergeName + "CutPointZone",
36 pzs.size(),
37 pzs
38 )
39 );
40
41 // Master patch
42 const word masterPatchName(mergePatchPairs[pairi].first());
43 const polyPatch& masterPatch =
44 mesh.boundaryMesh()[masterPatchName];
45
46 fzs.append
47 (
48 new faceZone
49 (
50 mergeName + "MasterZone",
51 identity(masterPatch.range()),
52 false, // none are flipped
53 fzs.size(),
54 fzs
55 )
56 );
57
58 // Slave patch
59 const word slavePatchName(mergePatchPairs[pairi].second());
60 const polyPatch& slavePatch =
61 mesh.boundaryMesh()[slavePatchName];
62
63 fzs.append
64 (
65 new faceZone
66 (
67 mergeName + "SlaveZone",
68 identity(slavePatch.range()),
69 false, // none are flipped
70 fzs.size(),
71 fzs
72 )
73 );
74
75 // An empty zone for cut faces
76 fzs.append
77 (
78 new faceZone
79 (
80 mergeName + "CutFaceZone",
81 fzs.size(),
82 fzs
83 )
84 );
85 } // end of all merge pairs
86 }
87
88
89
90 Info<< "Creating attachPolyTopoChanger" << endl;
91 attachPolyTopoChanger polyMeshAttacher(mesh);
92 polyMeshAttacher.setSize(mergePatchPairs.size());
93
94 forAll(mergePatchPairs, pairi)
95 {
96 const word mergeName
97 (
98 mergePatchPairs[pairi].first()
99 + mergePatchPairs[pairi].second()
100 + name(pairi)
101 );
102
103 // Add the sliding interface mesh modifier
104 polyMeshAttacher.set
105 (
106 pairi,
107 new slidingInterface
108 (
109 "couple" + name(pairi),
110 pairi,
111 polyMeshAttacher,
112 mergeName + "MasterZone",
113 mergeName + "SlaveZone",
114 mergeName + "CutPointZone",
115 mergeName + "CutFaceZone",
116 mergePatchPairs[pairi].first(),
117 mergePatchPairs[pairi].second(),
118 slidingInterface::INTEGRAL, // always integral
119 false,
120 intersection::VISIBLE
121 )
122 );
123 }
124
125 polyMeshAttacher.attach(true);
126 }
127 else
128 {
129 Info<< nl << "There are no merge patch pairs" << endl;
130 }
131}
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
dynamicFvMesh & mesh
const IOdictionary & meshDict
List< wordPair > wordPairList
List of wordPairs.
Definition: wordPair.H:64
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333