OpenLB 1.7
Loading...
Searching...
No Matches
offBoundaryPostProcessors3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2012 Jonas Kratzke, Mathias J. Krause
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef OFF_BOUNDARY_POST_PROCESSORS_3D_HH
25#define OFF_BOUNDARY_POST_PROCESSORS_3D_HH
26
28
29#include "core/util.h"
30#include "core/cell.h"
31#include "dynamics/dynamics.h"
32
33namespace olb {
34
36
37/* Bouzidi Interpolation scheme of first order
38 *
39 * fluid nodes wall solid node
40 * --o-------<-o->-----<-o->--|----x----
41 * xB x xN
42 * directions: --> iPop
43 * <-- opp
44 *
45*/
46
47template<typename T, typename DESCRIPTOR>
49ZeroVelocityBouzidiLinearPostProcessor3D(int x_, int y_, int z_, int iPop_, T dist_)
50 : x(x_), y(y_), z(z_), iPop(iPop_), dist(dist_)
51{
52 this->getName() = "ZeroVelocityBouzidiLinearPostProcessor3D";
53 this->_priority = -1;
54#ifndef QUIET
55 if (dist < 0 || dist > 1)
56 std::cout << "WARNING: Bogus distance at (" << x << "," << y << "," << z << "): "
57 << dist << std::endl;
58#endif
59 typedef DESCRIPTOR L;
60 const Vector<int,3> c = descriptors::c<DESCRIPTOR>(iPop);
61 opp = descriptors::opposite<L>(iPop);
62 xN = x + c[0];
63 yN = y + c[1];
64 zN = z + c[2];
65
66 if (dist >= 0.5) {
67 xB = x - c[0];
68 yB = y - c[1];
69 zB = z - c[2];
70 q = 1/(2*dist);
71 iPop2 = opp;
72 }
73 else {
74 xB = x;
75 yB = y;
76 zB = z;
77 q = 2*dist;
78 iPop2 = iPop;
79 }
80 /*
81 std::cout << "ZeroVelocityLinear (" << x << "," << y << "," << z <<
82 "), iPop: " << iPop << ", nP: (" << xN << "," << yN << "," << zN <<
83 "), opp: " << opp << ", bP: (" << xB << "," << yB << "," << zB <<
84 "), dist: " << dist << ", q: " << q << std::endl;
85 */
86}
87
88template<typename T, typename DESCRIPTOR>
90processSubDomain(BlockLattice<T,DESCRIPTOR>& blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
91{
92 if (util::contained(x, y, z, x0_, x1_, y0_, y1_, z0_, z1_)) {
93 process(blockLattice);
94 }
95}
96
97template<typename T, typename DESCRIPTOR>
100{
101 blockLattice.get(x, y, z)[opp] = q*blockLattice.get(xN, yN, zN)[iPop] +
102 (1-q)*blockLattice.get(xB, yB, zB)[iPop2];
103}
104
105template<typename T, typename DESCRIPTOR>
107VelocityBouzidiLinearPostProcessor3D(int x_, int y_, int z_, int iPop_, T dist_)
108 : x(x_), y(y_), z(z_), iPop(iPop_), dist(dist_)
109{
110 this->getName() = "VelocityBouzidiLinearPostProcessor3D";
111 this->_priority = -1;
112
113#ifndef QUIET
114 if (dist < 0 || dist > 1)
115 std::cout << "WARNING: Bogus distance at (" << x << "," << y << "," << z << "): "
116 << dist << std::endl;
117#endif
118 typedef DESCRIPTOR L;
119 const Vector<int,3> c = descriptors::c<DESCRIPTOR>(iPop);
120 opp = descriptors::opposite<L>(iPop);
121 xN = x + c[0];
122 yN = y + c[1];
123 zN = z + c[2];
124
125 if (dist >= 0.5) {
126 xB = x - c[0];
127 yB = y - c[1];
128 zB = z - c[2];
129 q = 1/(2*dist);
130 ufrac = q;
131 iPop2 = opp;
132 }
133 else {
134 xB = x;
135 yB = y;
136 zB = z;
137 q = 2*dist;
138 iPop2 = iPop;
139 ufrac = 1;
140 }
141 /*
142 std::cout << "VelocityLinear (" << x << "," << y << "," << z <<
143 "), iPop: " << iPop << ", nP: (" << xN << "," << yN << "," << zN <<
144 "), opp: " << opp << ", bP: (" << xB << "," << yB << "," << zB <<
145 "), dist: " << dist << ", q: " << q << std::endl;
146 */
147}
148
149template<typename T, typename DESCRIPTOR>
151processSubDomain(BlockLattice<T,DESCRIPTOR>& blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
152{
153 if (util::contained(x, y, z, x0_, x1_, y0_, y1_, z0_, z1_)) {
154 process(blockLattice);
155 }
156}
157
158template<typename T, typename DESCRIPTOR>
161{
162 auto* dynamics = static_cast<legacy::OffDynamics<T,DESCRIPTOR>*>(blockLattice.getDynamics(xN, yN, zN));
163 T u = ufrac*dynamics->getVelocityCoefficient(iPop);
164 auto cellN = blockLattice.get(xN, yN, zN);
165 auto cell = blockLattice.get(x, y, z);
166 dynamics->defineRho(cellN, cell.computeRho());
167 cell[opp] = q*cellN[iPop] + (1-q)*blockLattice.get(xB, yB, zB)[iPop2] + u;
168}
169
170
172
173template<typename T, typename DESCRIPTOR>
175ZeroVelocityBounceBackPostProcessor3D(int x_, int y_, int z_, int iPop_, T dist_)
176 : x(x_), y(y_), z(z_), iPop(iPop_), dist(dist_)
177{
178 this->getName() = "ZeroVelocityBounceBackPostProcessor3D";
179 this->_priority = -1;
180
181#ifndef QUIET
182 if (dist < 0 || dist > 1)
183 std::cout << "WARNING: Bogus distance at (" << x << "," << y << "," << z << "): "
184 << dist << std::endl;
185#endif
186 typedef DESCRIPTOR L;
187 const Vector<int,3> c = descriptors::c<L>(iPop);
188 opp = descriptors::opposite<L>(iPop);
189 xN = x + c[0];
190 yN = y + c[1];
191 zN = z + c[2];
192 /*
193 std::cout << "Corner (" << x << "," << y << "," << z <<
194 "), iPop: " << iPop << ", nP: (" << xN << "," << yN << "," << zN <<
195 "), dist: " << dist << std::endl;
196 */
197}
198
199template<typename T, typename DESCRIPTOR>
201processSubDomain(BlockLattice<T,DESCRIPTOR>& blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
202{
203 if (util::contained(x, y, z, x0_, x1_, y0_, y1_, z0_, z1_)) {
204 process(blockLattice);
205 }
206}
207
208template<typename T, typename DESCRIPTOR>
211{
212 blockLattice.get(x, y, z)[opp] = blockLattice.get(xN, yN, zN)[iPop];
213}
214
215template<typename T, typename DESCRIPTOR>
217VelocityBounceBackPostProcessor3D(int x_, int y_, int z_, int iPop_, T dist_)
218 : x(x_), y(y_), z(z_), iPop(iPop_), dist(dist_)
219{
220 this->getName() = "VelocityBounceBackPostProcessor3D";
221 this->_priority = -1;
222
223#ifndef QUIET
224 if (dist < 0 || dist > 1)
225 std::cout << "WARNING: Bogus distance at (" << x << "," << y << "," << z << "): "
226 << dist << std::endl;
227#endif
228 typedef DESCRIPTOR L;
229 const Vector<int,3> c = descriptors::c<L>(iPop);
230 opp = descriptors::opposite<L>(iPop);
231 xN = x + c[0];
232 yN = y + c[1];
233 zN = z + c[2];
234
235 /*
236 std::cout << "Corner (" << x << "," << y << "," << z <<
237 "), iPop: " << iPop << ", nP: (" << xN << "," << yN << "," << zN <<
238 "), dist: " << dist << std::endl;
239 */
240}
241
242template<typename T, typename DESCRIPTOR>
244processSubDomain(BlockLattice<T,DESCRIPTOR>& blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
245{
246 if (util::contained(x, y, z, x0_, x1_, y0_, y1_, z0_, z1_)) {
247 process(blockLattice);
248 }
249}
250
251template<typename T, typename DESCRIPTOR>
254{
255 auto* dynamics = static_cast<legacy::OffDynamics<T,DESCRIPTOR>*>(blockLattice.getDynamics(xN, yN, zN));
256 T u = dynamics->getVelocityCoefficient(iPop);
257 auto cellN = blockLattice.get(xN, yN, zN);
258 auto cell = blockLattice.get(x, y, z);
259 dynamics->defineRho(cellN, cell.computeRho());
260 cell[opp] = cellN[iPop] + u;
261}
262
264
265template<typename T, typename DESCRIPTOR>
267ZeroVelocityBouzidiLinearPostProcessorGenerator3D(int x_, int y_, int z_, int iPop_, T dist_)
268 : PostProcessorGenerator3D<T,DESCRIPTOR>(x_, x_, y_, y_, z_, z_),
269 x(x_), y(y_), z(z_), iPop(iPop_), dist(dist_)
270{ }
271
272template<typename T, typename DESCRIPTOR>
275{
277 ( this->x, this->y, this->z, this->iPop, this->dist);
278}
279
280template<typename T, typename DESCRIPTOR>
283{
285 (this->x, this->y, this->z, this->iPop, this->dist);
286}
287
288template<typename T, typename DESCRIPTOR>
290VelocityBouzidiLinearPostProcessorGenerator3D(int x_, int y_, int z_, int iPop_, T dist_)
291 : PostProcessorGenerator3D<T,DESCRIPTOR>(x_, x_, y_, y_, z_, z_),
292 x(x_), y(y_), z(z_), iPop(iPop_), dist(dist_)
293{ }
294
295template<typename T, typename DESCRIPTOR>
298{
300 ( this->x, this->y, this->z, this->iPop, this->dist);
301}
302
303template<typename T, typename DESCRIPTOR>
306{
308 (this->x, this->y, this->z, this->iPop, this->dist);
309}
310
312
313template<typename T, typename DESCRIPTOR>
315ZeroVelocityBounceBackPostProcessorGenerator3D(int x_, int y_, int z_, int iPop_, T dist_)
316 : PostProcessorGenerator3D<T,DESCRIPTOR>(x_, x_, y_, y_, z_, z_),
317 x(x_), y(y_), z(z_), iPop(iPop_), dist(dist_)
318{ }
319
320template<typename T, typename DESCRIPTOR>
323{
325 ( this->x, this->y, this->z, this->iPop, this->dist);
326}
327
328template<typename T, typename DESCRIPTOR>
331{
333 (this->x, this->y, this->z, this->iPop, this->dist);
334}
335
336template<typename T, typename DESCRIPTOR>
338VelocityBounceBackPostProcessorGenerator3D(int x_, int y_, int z_, int iPop_, T dist_)
339 : PostProcessorGenerator3D<T,DESCRIPTOR>(x_, x_, y_, y_, z_, z_),
340 x(x_), y(y_), z(z_), iPop(iPop_), dist(dist_)
341{ }
342
343template<typename T, typename DESCRIPTOR>
346{
348 ( this->x, this->y, this->z, this->iPop, this->dist);
349}
350
351template<typename T, typename DESCRIPTOR>
354{
356 (this->x, this->y, this->z, this->iPop, this->dist);
357}
358
359} // namespace olb
360
361#endif
Definition of a LB cell – header file.
Platform-abstracted block lattice for external access and inter-block interaction.
virtual Dynamics< T, DESCRIPTOR > * getDynamics(DynamicsPromise< T, DESCRIPTOR > &&)=0
Return pointer to dynamics yielded by promise.
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
std::string & getName()
read and write access to name
Plain old scalar vector.
Definition vector.h:47
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
VelocityBounceBackPostProcessor3D(int x_, int y_, int z_, int iPop_, T dist_)
VelocityBounceBackPostProcessorGenerator3D(int x_, int y_, int z_, int iPop_, T dist_)
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
PostProcessor3D< T, DESCRIPTOR > * generate() const override
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
VelocityBouzidiLinearPostProcessor3D(int x_, int y_, int z_, int iPop_, T dist_)
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
PostProcessor3D< T, DESCRIPTOR > * generate() const override
VelocityBouzidiLinearPostProcessorGenerator3D(int x_, int y_, int z_, int iPop_, T dist_)
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.
ZeroVelocityBounceBackPostProcessor3D(int x_, int y_, int z_, int iPop_, T dist_)
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
ZeroVelocityBounceBackPostProcessorGenerator3D(int x_, int y_, int z_, int iPop_, T dist_)
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
PostProcessor3D< T, DESCRIPTOR > * generate() const override
This class computes the Linear Bouzidi BC.
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
ZeroVelocityBouzidiLinearPostProcessor3D(int x_, int y_, int z_, int iPop_, T dist_)
ZeroVelocityBouzidiLinearPostProcessorGenerator3D(int x_, int y_, int z_, int iPop_, T dist_)
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
PostProcessor3D< T, DESCRIPTOR > * generate() const override
Dynamics for offLattice boundary conditions OffDynamics are basically NoLatticeDynamics with the addi...
Definition dynamics.h:145
T getVelocityCoefficient(int iPop)
Get VelocitySummand for Bouzidi-Boundary Condition.
Definition dynamics.h:449
bool contained(int x, int y, int x0, int x1, int y0, int y1)
Definition util.h:119
Top level namespace for all of OpenLB.
Set of functions commonly used in LB computations – header file.