OpenLB 1.7
Loading...
Searching...
No Matches
wireBoundaryForMagP3D.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 WireBoundaryForMagP3D_HH
25#define WireBoundaryForMagP3D_HH
26
27#include <set>
29
30namespace olb {
31
32
33template<typename T, template<typename U> class PARTICLETYPE>
35 SuperGeometry<T,3>& sg, std::set<int> materials)
36 : Boundary3D<T, PARTICLETYPE>(),
37 _sg(sg),
38 _materials(materials.begin(), materials.end())
39{
40}
41
42template<typename T, template<typename U> class PARTICLETYPE>
44 typename std::deque<PARTICLETYPE<T> >::iterator& p,
46{
47
48 int latticeR[3] = { 0 };
49 _sg.getCuboidGeometry().get(p->getCuboid()).getFloorLatticeR(latticeR, &p->getPos()[0]);
50
51 // Read only access to the material numbers of nodes around particle position
52 const BlockGeometry<T,3>& bg = _sg.getBlockGeometry(
53 _sg.getLoadBalancer().loc(p->getCuboid()));
54
55 // + overlap is because of lower boundaries, latticeR has to be shifted up
56 int iX = latticeR[0];
57 int iY = latticeR[1];
58 int iZ = latticeR[2];
59 for (_matIter = _materials.begin(); _matIter != _materials.end(); _matIter++) {
60
61 if (bg.get(iX, iY, iZ) == *_matIter ||
62 bg.get(iX, iY + 1, iZ) == *_matIter ||
63 bg.get(iX, iY, iZ + 1) == *_matIter ||
64 bg.get(iX, iY + 1, iZ + 1) == *_matIter ||
65 bg.get(iX + 1, iY, iZ) == *_matIter ||
66 bg.get(iX + 1, iY + 1, iZ) == *_matIter ||
67 bg.get(iX + 1, iY, iZ + 1) == *_matIter ||
68 bg.get(iX + 1, iY + 1, iZ + 1) == *_matIter) {
69
70 if ((*_matIter == 5) && (p->getSActivity() != 3)) {
71
72 std::vector<T> vel(3, T()) ;
73 p->setVel(vel) ;
74 p->setSActivity(3) ;
75 break;
76 }
77 if ((*_matIter == 4) && (p->getActive() != false)) {
78
79 p->setActive(false) ;
80 break;
81 }
82 }
83 }
84 return;
85}
86}
87
88#endif /* WireBoundaryForMagP3D_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
Representation of a statistic for a parallel 2D geometry.
void applyBoundary(typename std::deque< PARTICLETYPE< T > >::iterator &p, ParticleSystem3D< T, PARTICLETYPE > &psSys) override
Apply the boundary condition.
WireBoundaryForMagP3D(WireBoundaryForMagP3D< T, PARTICLETYPE > &f)
Copy constructor.
Top level namespace for all of OpenLB.