summaryrefslogtreecommitdiff
path: root/src/boundary/rtlbmBoundaryDynamics.h
blob: 576551b057a27289016249b8630fcfa9dc5dc2e9 (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
/*  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_DYNAMICS_H
#define RTLBM_BOUNDARY_DYNAMICS_H


#include "dynamics/dynamics.h"

namespace olb {

/** Defines incoming (axis parallel) directions on flat walls.
 *
 * \param directions   takes values 0, 1, 2; which corresponds to x, y, z plane normal
 * \param orientation  takes values -1, 1; which is the sign of plane normal
 *
 *  Note:
 *  Dynamics computes the arriving density on walls and redistributes it equally to
 *  all inward pointing directions.
 */
template<typename T, typename DESCRIPTOR, int direction, int orientation>
class RtlbmDiffuseBoundaryDynamics : public BasicDynamics<T,DESCRIPTOR> {
public:
  /// Constructor
  RtlbmDiffuseBoundaryDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
  /// Compute equilibrium distribution function
  T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
  /// Collision step for flat boundary
  void collide(Cell<T,DESCRIPTOR>& cell, LatticeStatistics<T>& statistics) override;
  /// place holder
  T getOmega() const override;
  /// place holder
  void setOmega(T omega_) override;
};

template<typename T, typename DESCRIPTOR, int plane, int normal1, int normal2>
class RtlbmDiffuseEdgeBoundaryDynamics : public BasicDynamics<T,DESCRIPTOR> {
public:
  /// Constructor
  RtlbmDiffuseEdgeBoundaryDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
  /// Compute equilibrium distribution function
  T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
  /// Collision step for flat boundary
  void collide(Cell<T,DESCRIPTOR>& cell, LatticeStatistics<T>& statistics) override;
  /// place holder
  T getOmega() const override;
  /// place holder
  void setOmega(T omega_) override;
};

template<typename T, typename DESCRIPTOR, int xNormal, int yNormal, int zNormal>
class RtlbmDiffuseCornerBoundaryDynamics : public BasicDynamics<T,DESCRIPTOR> {
public:
  /// Constructor
  RtlbmDiffuseCornerBoundaryDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
  /// Compute equilibrium distribution function
  T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
  /// Collision step for corner
  void collide(Cell<T,DESCRIPTOR>& cell, LatticeStatistics<T>& statistics) override;
  /// place holder
  T getOmega() const override;
  /// place holder
  void setOmega(T omega_) override;
};


/** Defines incoming directions on flat walls.
 *  Emposed dirichlet density is distributed equivalently to all incoming/unkown directions.
 *
 * \param directions   takes values 0, 1, 2; which corresponds to x, y, z plane normal
 * \param orientation  takes values -1, 1; which is the sign of plane normal
 *
 *  Note:
 *  Dynamics ensure that cell has constant 0th moment.
 *  To set the constant 0th moment defineRho() must be called.
 */
template<typename T, typename DESCRIPTOR, int direction, int orientation>
class RtlbmDiffuseConstBoundaryDynamics : public BasicDynamics<T,DESCRIPTOR> {
public:
  /// Constructor
  RtlbmDiffuseConstBoundaryDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
  /// Compute equilibrium distribution function
  T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
  /// Collision step for flat boundary
  void collide(Cell<T,DESCRIPTOR>& cell, LatticeStatistics<T>& statistics) override;
  /// place holder
  T getOmega() const override;
  /// place holder
  void setOmega(T omega_) override;
};



/** Defines incoming directions on edge boundaries.
*   Emposed dirichlet density is distributed equivalently to all incoming/unkown directions.
*
* \param plane    takes values 0, 1, 2; which denotes the alignment of edge either along x, y or z axis
* \param normal1  takes values -1 or 1; normal orientation of a surface side 'right'
* \param normal2  takes values -1 or 1; normal orientation of a surface side 'left'
*/
template<typename T, typename DESCRIPTOR, int plane, int normal1, int normal2>
class RtlbmDiffuseConstEdgeBoundaryDynamics : public BasicDynamics<T,DESCRIPTOR> {
public:
  /// Constructor
  RtlbmDiffuseConstEdgeBoundaryDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
  /// Compute equilibrium distribution function
  T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
  /// Collision step for edges
  void collide(Cell<T,DESCRIPTOR>& cell, LatticeStatistics<T>& statistics) override;
  /// place holder
  T getOmega() const override;
  /// place holder
  void setOmega(T omega_) override;
};


/** Defines incoming directions on corner boundaries.
*   Emposed dirichlet density is distributed equivalently to all incoming/unkown directions.
*
* \param xNormal  takes value -1 or 1
* \param yNormal  takes value -1 or 1
* \param zNormal  takes value -1 or 1
*/
template<typename T, typename DESCRIPTOR, int xNormal, int yNormal, int zNormal>
class RtlbmDiffuseConstCornerBoundaryDynamics : public BasicDynamics<T,DESCRIPTOR> {
public:
  /// Constructor
  RtlbmDiffuseConstCornerBoundaryDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
  /// Compute equilibrium distribution function
  T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
  /// Collision step for corner
  void collide(Cell<T,DESCRIPTOR>& cell, LatticeStatistics<T>& statistics) override;
  /// place holder
  T getOmega() const override;
  /// place holder
  void setOmega(T omega_) override;
};



template<typename T, typename DESCRIPTOR, int direction, int orientation>
class RtlbmDirectedBoundaryDynamics : public BasicDynamics<T,DESCRIPTOR> {
public:
  /// Constructor
  RtlbmDirectedBoundaryDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
  /// Compute equilibrium distribution function
  T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
  /// Collision step for directed boundary walls
  void collide(Cell<T,DESCRIPTOR>& cell, LatticeStatistics<T>& statistics) override;
  /// place holder
  T getOmega() const override;
  /// place holder
  void setOmega(T omega_) override;
};
}  // namespace olb

#endif