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  // Create and add point and face zones and mesh modifiers
15  List<pointZone*> pz(mergePatchPairs.size());
16  List<faceZone*> fz(3*mergePatchPairs.size());
17  List<cellZone*> cz;
18 
19  forAll(mergePatchPairs, pairi)
20  {
21  const word mergeName
22  (
23  mergePatchPairs[pairi].first()
24  + mergePatchPairs[pairi].second()
25  + name(pairi)
26  );
27 
28  // An empty zone for cut points
29  pz[pairi] = new pointZone
30  (
31  mergeName + "CutPointZone",
32  0,
33  mesh.pointZones()
34  );
35 
36  // Master patch
37  const word masterPatchName(mergePatchPairs[pairi].first());
38  const polyPatch& masterPatch =
39  mesh.boundaryMesh()[masterPatchName];
40 
41  fz[3*pairi] = new faceZone
42  (
43  mergeName + "MasterZone",
44  identity(masterPatch.range()),
45  false, // none are flipped
46  0,
47  mesh.faceZones()
48  );
49 
50  // Slave patch
51  const word slavePatchName(mergePatchPairs[pairi].second());
52  const polyPatch& slavePatch =
53  mesh.boundaryMesh()[slavePatchName];
54 
55  fz[3*pairi + 1] = new faceZone
56  (
57  mergeName + "SlaveZone",
58  identity(slavePatch.range()),
59  false, // none are flipped
60  1,
61  mesh.faceZones()
62  );
63 
64  // An empty zone for cut faces
65  fz[3*pairi + 2] = new faceZone
66  (
67  mergeName + "CutFaceZone",
68  2,
69  mesh.faceZones()
70  );
71  } // end of all merge pairs
72 
73  Info<< "Adding point and face zones" << endl;
74  mesh.addZones(pz, fz, cz);
75 
76 
77  Info<< "Creating attachPolyTopoChanger" << endl;
78  attachPolyTopoChanger polyMeshAttacher(mesh);
79  polyMeshAttacher.setSize(mergePatchPairs.size());
80 
81  forAll(mergePatchPairs, pairi)
82  {
83  const word mergeName
84  (
85  mergePatchPairs[pairi].first()
86  + mergePatchPairs[pairi].second()
87  + name(pairi)
88  );
89 
90  // Add the sliding interface mesh modifier
91  polyMeshAttacher.set
92  (
93  pairi,
94  new slidingInterface
95  (
96  "couple" + name(pairi),
97  pairi,
98  polyMeshAttacher,
99  mergeName + "MasterZone",
100  mergeName + "SlaveZone",
101  mergeName + "CutPointZone",
102  mergeName + "CutFaceZone",
103  mergePatchPairs[pairi].first(),
104  mergePatchPairs[pairi].second(),
105  slidingInterface::INTEGRAL, // always integral
106  false,
107  intersection::VISIBLE
108  )
109  );
110  }
111 
112  polyMeshAttacher.attach(true);
113  }
114  else
115  {
116  Info<< nl << "There are no merge patch pairs" << endl;
117  }
118 }
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
Foam::wordPairList
List< wordPair > wordPairList
List of wordPairs.
Definition: wordPair.H:64
meshDict
const IOdictionary & meshDict
Definition: findBlockMeshDict.H:72