FreeFOAM The Cross-Platform CFD Toolkit
mergePatchPairs.H
Go to the documentation of this file.
1  if (mergePatchPairs.size())
2  {
3  Info<< "Creating merge patch pairs" << nl << endl;
4 
5  // Create and add point and face zones and mesh modifiers
6  List<pointZone*> pz(mergePatchPairs.size());
7  List<faceZone*> fz(3*mergePatchPairs.size());
8  List<cellZone*> cz(0);
9 
10  forAll (mergePatchPairs, pairI)
11  {
12  const word mergeName
13  (
14  mergePatchPairs[pairI].first()
15  + mergePatchPairs[pairI].second()
16  + name(pairI)
17  );
18 
19  pz[pairI] = new pointZone
20  (
21  mergeName + "CutPointZone",
22  labelList(0),
23  0,
24  mesh.pointZones()
25  );
26 
27  // Master patch
28  const word masterPatchName(mergePatchPairs[pairI].first());
29  const polyPatch& masterPatch =
30  mesh.boundaryMesh()
31  [
32  mesh.boundaryMesh().findPatchID(masterPatchName)
33  ];
34 
35  labelList isf(masterPatch.size());
36 
37  forAll (isf, i)
38  {
39  isf[i] = masterPatch.start() + i;
40  }
41 
42  fz[3*pairI] = new faceZone
43  (
44  mergeName + "MasterZone",
45  isf,
46  boolList(masterPatch.size(), false),
47  0,
48  mesh.faceZones()
49  );
50 
51  // Slave patch
52  const word slavePatchName(mergePatchPairs[pairI].second());
53  const polyPatch& slavePatch =
54  mesh.boundaryMesh()
55  [
56  mesh.boundaryMesh().findPatchID(slavePatchName)
57  ];
58 
59  labelList osf(slavePatch.size());
60 
61  forAll (osf, i)
62  {
63  osf[i] = slavePatch.start() + i;
64  }
65 
66  fz[3*pairI + 1] = new faceZone
67  (
68  mergeName + "SlaveZone",
69  osf,
70  boolList(slavePatch.size(), false),
71  1,
72  mesh.faceZones()
73  );
74 
75  // Add empty zone for cut faces
76  fz[3*pairI + 2] = new faceZone
77  (
78  mergeName + "CutFaceZone",
79  labelList(0),
80  boolList(0, false),
81  2,
82  mesh.faceZones()
83  );
84  } // end of all merge pairs
85 
86  Info << "Adding point and face zones" << endl;
87  mesh.addZones(pz, fz, cz);
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  intersection::VISIBLE
120  )
121  );
122  }
123 
124  polyMeshAttacher.attach(true);
125  }
126 
127 // ************************ vim: set sw=4 sts=4 et: ************************ //