summaryrefslogtreecommitdiff
path: root/src/boundary/boundaryCondition2D.h
blob: 6ea87879604d5579ed80d16c30615973b7d35e1a (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
/*  This file is part of the OpenLB library
 *
 *  Copyright (C) 2007 Jonas Latt
 *  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.
*/

/** \file
 * A helper for initialising 2D boundaries -- header file.
 */

#ifndef BOUNDARY_CONDITION_2D_H
#define BOUNDARY_CONDITION_2D_H

#include "core/blockLatticeStructure2D.h"
#include "momentaOnBoundaries2D.h"
#include "boundaryPostProcessors2D.h"
#include "dynamics/dynamics.h"
#include "geometry/blockGeometry2D.h"
#include "functors/lattice/indicator/blockIndicatorF2D.h"

namespace olb {

template<typename T, typename DESCRIPTOR>
class OnLatticeBoundaryCondition2D {
public:
  virtual ~OnLatticeBoundaryCondition2D() { }

  virtual void addVelocityBoundary0N(int x0, int x1, int y0, int y1, T omega) =0;
  virtual void addVelocityBoundary0P(int x0, int x1, int y0, int y1, T omega) =0;
  virtual void addVelocityBoundary1N(int x0, int x1, int y0, int y1, T omega) =0;
  virtual void addVelocityBoundary1P(int x0, int x1, int y0, int y1, T omega) =0;

  virtual void addConvectionBoundary0N(int x0, int x1, int y0, int y1, T omega, T* uAv=NULL) =0;
  virtual void addConvectionBoundary0P(int x0, int x1, int y0, int y1, T omega, T* uAv=NULL) =0;
  virtual void addConvectionBoundary1N(int x0, int x1, int y0, int y1, T omega, T* uAv=NULL) =0;
  virtual void addConvectionBoundary1P(int x0, int x1, int y0, int y1, T omega, T* uAv=NULL) =0;

  virtual void addExternalVelocityCornerNN(int x, int y, T omega) =0;
  virtual void addExternalVelocityCornerNP(int x, int y, T omega) =0;
  virtual void addExternalVelocityCornerPN(int x, int y, T omega) =0;
  virtual void addExternalVelocityCornerPP(int x, int y, T omega) =0;

  virtual void addInternalVelocityCornerNN(int x, int y, T omega) =0;
  virtual void addInternalVelocityCornerNP(int x, int y, T omega) =0;
  virtual void addInternalVelocityCornerPN(int x, int y, T omega) =0;
  virtual void addInternalVelocityCornerPP(int x, int y, T omega) =0;

  /**
   * \anchor BCimplI2D
   * \name Indicator-accepting boundary condition interfaces
   *
   * \param indicator Block indicator defining boundary cells
   * \param x0,x1,y0,y1 Range of cells to be traversed
   * \{
   **/

  /// Add velocity boundary for indicated cells
  /**
   * \param omega Omega value of velocity BC
   **/
  virtual void addVelocityBoundary(BlockIndicatorF2D<T>& indicator,
                                   int x0, int x1, int y0, int y1,
                                   T omega) =0;
  /// Add slip boundary for indicated cells
  virtual void addSlipBoundary(BlockIndicatorF2D<T>& indicator,
                               int x0, int x1, int y0, int y1) =0;
  /// Add partial slip boundary for indicated cells
  /**
   * \param tuner Value between 0 (=no slip) and 1(=free slip)
   **/
  virtual void addPartialSlipBoundary(T tuner, BlockIndicatorF2D<T>& indicator, int x0,
                                      int x1, int y0, int y1) =0;
  /// Add pressure boundary for indicated cells
  /**
   * \param omega Omega value of pressure BC
   **/
  virtual void addPressureBoundary(BlockIndicatorF2D<T>& indicator,
                                   int x0, int x1, int y0, int y1,
                                   T omega) =0;
  /// Add convection boundary for indicated cells
  /**
   * \param omega Omega value of convection BC
   * \param uAv   Optional param for post processor
   **/
  virtual void addConvectionBoundary(BlockIndicatorF2D<T>& indicator,
                                     int x0, int x1, int y0, int y1,
                                     T omega, T* uAv=NULL) =0;

  virtual void addFreeEnergyWallBoundary(BlockIndicatorF2D<T>& indicator,
                                   int x0, int x1, int y0, int y1,
                                   T addend, int latticeNumber) =0;

  virtual void addFreeEnergyInletBoundary(BlockIndicatorF2D<T>& indicator,
                                   int x0, int x1, int y0, int y1, T omega,
                                   std::string type, int latticeNumber) =0;

  virtual void addFreeEnergyOutletBoundary(BlockIndicatorF2D<T>& indicator,
                                   int x0, int x1, int y0, int y1, T omega,
                                   std::string type, int latticeNumber) =0;
  ///\}

  /**
   * \name Convenience wrappers for boundary functions
   * In practice it is often preferable to define a boundary on a single material
   * number instead of instantiating an appropriate indicator by hand.
   *
   * These convenience functions are simple wrappers around the actual
   * \ref BCimplI2D "boundary condition interfaces".
   * \{
   **/

  /// Add velocity boundary for a single material number
  void addVelocityBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material,
                           int x0, int x1, int y0, int y1,
                           T omega);
  /// Add velocity boundary for any indicated cells inside the block domain
  void addVelocityBoundary(BlockIndicatorF2D<T>& indicator, T omega, bool includeOuterCells=false);
  /// Add velocity boundary for all cells of a material number inside the block domain
  void addVelocityBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material, T omega, bool includeOuterCells=false);

  /// Add slip boundary for a single material number
  void addSlipBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material,
                       int x0, int x1, int y0, int y1);
  /// Add slip boundary for any indicated cells inside the block domain
  void addSlipBoundary(BlockIndicatorF2D<T>& indicator, bool includeOuterCells=false);
  /// Add slip boundary for all cells of a material number inside the block domain
  void addSlipBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material, bool includeOuterCells=false);

  /// Add partial slip boundary for a single material number
  void addPartialSlipBoundary(T tuner, BlockGeometryStructure2D<T>& blockGeometryStructure, int material,
                              int x0, int x1, int y0, int y1);
  /// Add partial slip boundary for any indicated cells inside the block domain
  void addPartialSlipBoundary(T tuner, BlockIndicatorF2D<T>& indicator, bool includeOuterCells=false);
  /// Add partial slip boundary for all cells of a material number inside the block domain
  void addPartialSlipBoundary(T tuner, BlockGeometryStructure2D<T>& blockGeometryStructure, int material, bool includeOuterCells=false);

  /// Add pressure boundary for a single material number
  void addPressureBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material,
                           int x0, int x1, int y0, int y1,
                           T omega);
  /// Add pressure boundary for any indicated cells inside the block domain
  void addPressureBoundary(BlockIndicatorF2D<T>& indicator, T omega, bool includeOuterCells=false);
  /// Add pressure boundary for all cells of a material number inside the block domain
  void addPressureBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material,
                           T omega, bool includeOuterCells=false);

  /// Add convection boundary for a single material number
  void addConvectionBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material,
                             int x0, int x1, int y0, int y1,
                             T omega, T* uAv=NULL);
  /// Add convection boundary for any indicated cells inside the block domain
  void addConvectionBoundary(BlockIndicatorF2D<T>& indicator,
                             T omega, T* uAv=NULL, bool includeOuterCells=false);
  /// Add convection boundary for all cells of a material number inside the block domain
  void addConvectionBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material,
                             T omega, T* uAv=NULL, bool includeOuterCells=false);

  void addFreeEnergyWallBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material,
                                 int x0, int x1, int y0, int y1, T addend, int latticeNumber);
  void addFreeEnergyWallBoundary(BlockIndicatorF2D<T>& indicator, 
                                 T addend, int latticeNumber, bool includeOuterCells=false);
  void addFreeEnergyWallBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material,
                                 T addend, int latticeNumber, bool includeOuterCells=false);

  void addFreeEnergyInletBoundary(BlockGeometryStructure2D<T>& blockGeometryStructure, int material, int x0,
                                  int x1, int y0, int y1, T omega, std::string type, int latticeNumber);
  void addFreeEnergyInletBoundary(BlockIndicatorF2D<T>& indicator, T omega, std::string type,
                                  int latticeNumber, bool includeOuterCells=false);
  void addFreeEnergyInletBoundary(BlockGeometryStructure2