OpenLB 1.7
Loading...
Searching...
No Matches
eul2LagrOperation3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2016 Thomas Henn, Davide Dapelo
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 EUL2LAGR_OPERATION_HH
25#define EUL2LAGR_OPERATION_HH
26
27#include <string>
28#include <iostream>
29#include <set>
30#include <vector>
31#include <list>
32#include <deque>
33
34namespace olb {
35
36template<typename T, template<typename U> class PARTICLETYPE, typename DESCRIPTOR>
38 : _nParticles(nParticles),
39 _sLattice(sLattice)
40{ }
41
42template<typename T, template<typename U> class PARTICLETYPE, typename DESCRIPTOR>
43void Eul2LagrOperation3D<T,PARTICLETYPE,DESCRIPTOR>::applyParticleOperation ( typename std::deque<PARTICLETYPE<T> >::iterator p,
45{
46 int globic = pSys.getIGeometry();
47 int locIC = this->_sLattice.getLoadBalancer().loc(globic);
48
49 // particle's physical position
50 T physPosP[] { p->getPos()[0], p->getPos()[1], p->getPos()[2] };
51
52 // particle's dimensionless position, rounded at neighbouring voxel
53 int latticeRoundedPosP[] {0, 0, 0};
54 this->_sLattice.getCuboidGeometry().get(globic).getLatticeR( latticeRoundedPosP, physPosP );
55
56 auto eul2LagrRho = _sLattice.getBlock(locIC).get (
57 latticeRoundedPosP[0], latticeRoundedPosP[1], latticeRoundedPosP[2] ).template getFieldPointer<descriptors::EUL2LAGR>();
58 eul2LagrRho[0] += 1. / _nParticles;
59}
60
61
62}
63
64
65#endif
Eul2LagrOperation3D(SuperLattice< T, DESCRIPTOR > &sLattice, int nParticles=1)
virtual void applyParticleOperation(typename std::deque< PARTICLETYPE< T > >::iterator p, ParticleSystem3D< T, PARTICLETYPE > &pSys) override
Super class maintaining block lattices for a cuboid decomposition.
Top level namespace for all of OpenLB.