OpenLB 1.7
Loading...
Searching...
No Matches
materialBoundary3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2014 Thomas Henn, 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 MATERIALBOUNDARY3D_HH
25#define MATERIALBOUNDARY3D_HH
26
27#include <set>
28#include "materialBoundary3D.h"
29
30namespace olb {
31
32template<typename T, template<typename U> class PARTICLETYPE>
35 : Boundary3D<T, PARTICLETYPE>(),
36 _sg(sg)
37{
38 _matIter = _materials.begin();
39}
40
41template<typename T, template<typename U> class PARTICLETYPE>
44 std::set<int> materials)
45 : Boundary3D<T, PARTICLETYPE>(),
46 _sg(sg),
47 _materials(materials.begin(),materials.end())
48{
49}
50
51template<typename T, template<typename U> class PARTICLETYPE>
53 typename std::deque<PARTICLETYPE<T> >::iterator& p,
55{
56 int latticeR[3] = { 0 };
57 _sg.getCuboidGeometry().get(p->getCuboid()).getFloorLatticeR(latticeR, &p->getPos()[0]);
58 // Read only access to the material numbers of nodes around particle position
59 const BlockGeometry<T,3>& bg = _sg.getBlockGeometry(
60 _sg.getLoadBalancer().loc(p->getCuboid()));
61 // + overlap is because of lower boundaries, latticeR has to be shifted up
62 int iX = latticeR[0];
63 int iY = latticeR[1];
64 int iZ = latticeR[2];
65 for (_matIter = _materials.begin(); _matIter != _materials.end(); _matIter++) {
66 if (bg.get({iX, iY, iZ}) == *_matIter ||
67 bg.get({iX, iY+1, iZ}) == *_matIter ||
68 bg.get({iX, iY, iZ+1}) == *_matIter ||
69 bg.get({iX, iY+1, iZ+1}) == *_matIter ||
70 bg.get({iX+1, iY, iZ}) == *_matIter ||
71 bg.get({iX+1, iY+1, iZ}) == *_matIter ||
72 bg.get({iX+1, iY, iZ+1}) == *_matIter ||
73 bg.get({iX+1, iY+1, iZ+1}) == *_matIter
74 ) {
75 p->setActive(false);
76 return;
77 }
78 }
79}
80
81}
82
83#endif /* MATERIALBOUNDARY3D_HH */
Representation of a block geometry.
std::enable_if_t< sizeof...(L)==D, int > get(L... latticeR) const
Read-only access to a material number.
Prototype for all particle boundaries.
Definition boundary3D.h:43
MaterialBoundary3D(SuperGeometry< T, 3 > &sg)
Constructor.
void applyBoundary(typename std::deque< PARTICLETYPE< T > >::iterator &p, ParticleSystem3D< T, PARTICLETYPE > &psSys) override
Apply the boundary condition.
Representation of a statistic for a parallel 2D geometry.
Top level namespace for all of OpenLB.