summaryrefslogtreecommitdiff
path: root/src/boundary/rtlbmBoundary.hh
blob: 3b0d6d4e181075c7601cf5727187d4c4adb17f74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/*  This file is part of the OpenLB library
 *
 *  Copyright (C) 2017 Albert Mink
 *  E-mail contact: info@openlb.net
 *  The most recent release of OpenLB can be downloaded at
 *  <http://www.openlb.net/>
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public
 *  License along with this program; if not, write to the Free
 *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA  02110-1301, USA.
*/

#ifndef RTLBM_BOUNDARY_HH
#define RTLBM_BOUNDARY_HH

#include "rtlbmBoundary.h"
#include "rtlbmBoundaryDynamics.h"
#include "momentaOnBoundaries.h"
#include "advectionDiffusionBoundaryInstantiator3D.h" // detects orientation of boundary
#include "advectionDiffusionBoundaries.h"

namespace olb {


template<typename T, typename DESCRIPTOR>
class RtlbmDiffuseBoundaryManager3D {
public:
  template<int direction, int orientation>
  static Momenta<T,DESCRIPTOR>* getTemperatureBoundaryMomenta()
  {
    return new EquilibriumBM<T,DESCRIPTOR>;
  }
  template<int direction, int orientation>
  static Dynamics<T,DESCRIPTOR>* getTemperatureBoundaryDynamics(T omega, Momenta<T,DESCRIPTOR>& momenta)
  {
    return new RtlbmDiffuseBoundaryDynamics<T,DESCRIPTOR,direction,orientation>(omega, momenta);
  }
  template<int direction, int orientation>
  static PostProcessorGenerator3D<T,DESCRIPTOR>* getTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1, int z0, int z1)
  {
    return nullptr;
  }

  template<int plane, int normal1, int normal2>
  static Momenta<T,DESCRIPTOR>* getTemperatureBoundaryEdgeMomenta()
  {
    return new EquilibriumBM<T,DESCRIPTOR>;
  }
  template<int plane, int normal1, int normal2>
  static Dynamics<T,DESCRIPTOR>* getTemperatureBoundaryEdgeDynamics(T omega, Momenta<T,DESCRIPTOR>& momenta)
  {
    return new RtlbmDiffuseEdgeBoundaryDynamics<T,DESCRIPTOR,plane,normal1,normal2>(omega, momenta);
  }
  template<int plane, int normal1, int normal2>
  static PostProcessorGenerator3D<T,DESCRIPTOR>* getTemperatureBoundaryEdgeProcessor(int x0, int x1, int y0, int y1, int z0, int z1)
  {
    return nullptr;
  }

  template<int normalX, int normalY, int normalZ>
  static Momenta<T,DESCRIPTOR>* getTemperatureBoundaryCornerMomenta()
  {
    return new EquilibriumBM<T,DESCRIPTOR>;
  }
  template<int normalX, int normalY, int normalZ>
  static Dynamics<T,DESCRIPTOR>* getTemperatureBoundaryCornerDynamics(T omega, Momenta<T,DESCRIPTOR>& momenta)
  {
    return new RtlbmDiffuseCornerBoundaryDynamics<T,DESCRIPTOR,normalX,normalY,normalZ>(omega, momenta);
  }
  template<int normalX, int normalY, int normalZ>
  static PostProcessorGenerator3D<T,DESCRIPTOR>* getTemperatureBoundaryCornerProcessor(int x, int y, int z)
  {
    return nullptr;
  }
};


//================== creator function ================================
// blockLattice creator
template<typename T, typename DESCRIPTOR>
OnLatticeAdvectionDiffusionBoundaryCondition3D<T,DESCRIPTOR>* createRtlbmDiffuseBoundaryCondition3D( BlockLatticeStructure3D<T,DESCRIPTOR>& block )
{
  return new AdvectionDiffusionBoundaryConditionInstantiator3D<T, DESCRIPTOR, RtlbmDiffuseBoundaryManager3D<T,DESCRIPTOR> > (block);
}

// superLattice creator
template<typename T, typename DESCRIPTOR>
void createRtlbmDiffuseBoundaryCondition3D( sOnLatticeBoundaryCondition3D<T,DESCRIPTOR>& sBC )
{
  sBC.setOverlap(1);
  for (int iC = 0; iC < sBC.getSuperLattice().getLoadBalancer().size(); iC++) {
    OnLatticeAdvectionDiffusionBoundaryCondition3D<T,DESCRIPTOR>* blockBC =
      createRtlbmDiffuseBoundaryCondition3D<T,DESCRIPTOR>( sBC.getSuperLattice().getExtendedBlockLattice(iC) );
    sBC.getADblockBCs().push_back(blockBC);
  }
}


template<typename T, typename DESCRIPTOR>
class RtlbmDiffuseConstBoundaryManager3D {
public:
  template<int direction, int orientation>
  static Momenta<T,DESCRIPTOR>* getTemperatureBoundaryMomenta()
  {
    return new EquilibriumBM<T,DESCRIPTOR>;
  }
  template<int direction, int orientation>
  static Dynamics<T,DESCRIPTOR>* getTemperatureBoundaryDynamics(T omega, Momenta<T,DESCRIPTOR>& momenta)
  {
    return new RtlbmDiffuseConstBoundaryDynamics<T,DESCRIPTOR,direction,orientation>(omega, momenta);
  }
  template<int direction, int orientation>
  static PostProcessorGenerator3D<T,DESCRIPTOR>* getTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1, int z0, int z1)
  {
    return nullptr;
  }

  template<int plane, int normal1, int normal2>
  static Momenta<T,DESCRIPTOR>* getTemperatureBoundaryEdgeMomenta()
  {
    return new EquilibriumBM<T,DESCRIPTOR>;
  }
  template<int plane, int normal1, int normal2>
  static Dynamics<T,DESCRIPTOR>* getTemperatureBoundaryEdgeDynamics(T omega, Momenta<T,DESCRIPTOR>& momenta)
  {
    return new RtlbmDiffuseConstEdgeBoundaryDynamics<T,DESCRIPTOR,plane,normal1,normal2>(omega, momenta);
  }
  template<int plane, int normal1, int normal2>
  static PostProcessorGenerator3D<T,DESCRIPTOR>* getTemperatureBoundaryEdgeProcessor(int x0, int x1, int y0, int y1, int z0, int z1)
  {
    return nullptr;
  }

  template<int normalX, int normalY, int normalZ>
  static Momenta<T,DESCRIPTOR>* getTemperatureBoundaryCornerMomenta()
  {
    return new EquilibriumBM<T,DESCRIPTOR>;
  }
  template<int normalX, int normalY, int normalZ>
  static Dynamics<T,DESCRIPTOR>* getTemperatureBoundaryCornerDynamics(T omega, Momenta<T,DESCRIPTOR>& momenta)
  {
    return new RtlbmDiffuseConstCornerBoundaryDynamics<T,DESCRIPTOR,normalX,normalY,normalZ>(omega, momenta);
  }
  template<int normalX, int normalY, int normalZ>
  static PostProcessorGenerator3D<T,DESCRIPTOR>* getTemperatureBoundaryCornerProcessor(int x, int y, int z)
  {
    return nullptr;
  }
};

//================== creator function ================================
// blockLattice creator
template<typename T, typename DESCRIPTOR>
OnLatticeAdvectionDiffusionBoundaryCondition3D<T,DESCRIPTOR>* createRtlbmDiffuseConstBoundaryCondition3D( BlockLatticeStructure3D<T,DESCRIPTOR>& block )
{
  return new AdvectionDiffusionBoundaryConditionInstantiator3D<T, DESCRIPTOR, RtlbmDiffuseConstBoundaryManager3D<T,DESCRIPTOR> > (block);  // TODO AM mark as placeholder
}

// superLattice creator
template<typename T, typename DESCRIPTOR>
void createRtlbmDiffuseConstBoundaryCondition3D( sOnLatticeBoundaryCondition3D<T,DESCRIPTOR>& sBC )
{
  sBC.setOverlap(1);
  for (int iC = 0; iC < sBC.getSuperLattice().getLoadBalancer().size(); iC++) {
    OnLatticeAdvectionDiffusionBoundaryCondition3D<T,DESCRIPTOR>* blockBC =
      createRtlbmDiffuseConstBoundaryCondition3D<T,DESCRIPTOR>( sBC.getSuperLattice().getExtendedBlockLattice(iC) );
    sBC.getADblockBCs().push_back(blockBC);
  }
}


template<typename T, typename DESCRIPTOR>
class RtlbmDirectedBoundaryManager3D {
public:
  // ====== flats
  template<int direction, int orientation>
  static Momenta<T,DESCRIPTOR>* getTemperatureBoundaryMomenta()
  {
    return new EquilibriumBM<T,DESCRIPTOR>;
  }
  template<int direction, int orientation>
  static Dynamics<T,DESCRIPTOR>* getTemperatureBoundaryDynamics(T omega, Momenta<T,DESCRIPTOR>& momenta)
  {
    return new RtlbmDirectedBoundaryDynamics<T,DESCRIPTOR,direction,orientation>(omega, momenta);
  }
  template<int direction, int orientation>
  static PostProcessorGenerator3D<T,DESCRIPTOR>* getTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1, int z0, int z1)
  {
    return nullptr;
  }

  // ====== edged
  template<int plane, int normal1, int normal2>
  static Momenta<T,DESCRIPTOR>* getTemperatureBoundaryEdgeMomenta()
  {
    return new EquilibriumBM<T,DESCRIPTOR>;
  }
  template<int plane, int normal1, int normal2>
  static Dynamics<T,DESCRIPTOR>* getTemperatureBoundaryEdgeDynamics(