OpenLB 1.7
Loading...
Searching...
No Matches
eul2LagrPostProcessor3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2020 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
28#ifndef EUL2LAGR_POST_PROCESSOR_HH
29#define EUL2LAGR_POST_PROCESSOR_HH
30
31namespace olb {
32
33
35
36template<typename T, typename DESCRIPTOR, template<typename U> class PARTICLETYPE>
38 : _superGeometry(superGeometry),
39 _pSystem(pSystem)
40{}
41
42template<typename T, typename DESCRIPTOR, template<typename U> class PARTICLETYPE>
44{
45#ifdef TEST_L
46 OstreamManager clout( std::cout,"eul2LagrOperator::operator()" );
47#endif
48 // Resetting the external field
49 for (int iX=0; iX<blockLattice.getNx(); ++iX) {
50 for (int iY=0; iY<blockLattice.getNy(); ++iY) {
51 for (int iZ=0; iZ<blockLattice.getNz(); ++iZ) {
52 blockLattice.get(iX,iY,iZ).template setField<descriptors::EUL2LAGR>(0.);
53 }
54 }
55 }
56
57 // Populating each voxel
58 int overlap = _superGeometry.getOverlap();
59 for (auto p : _pSystem.getParticlesPointer()) {
60 if (p->getActive()) {
61 T physPosP[] { p->getPos()[0], p->getPos()[1], p->getPos()[2] };
62 int latticeRoundedPosP[] {0, 0, 0, 0};
63 _superGeometry.getCuboidGeometry().getLatticeR (latticeRoundedPosP, physPosP);
64 latticeRoundedPosP[1] += overlap;
65 latticeRoundedPosP[2] += overlap;
66 latticeRoundedPosP[3] += overlap;
67 //Populating the lattice
68 T eul2LagrRho = blockLattice.get(&latticeRoundedPosP[1]).template getField<descriptors::EUL2LAGR>();
69 eul2LagrRho += 1.;
70 blockLattice.get(&latticeRoundedPosP[1]).template setField<descriptors::EUL2LAGR>(eul2LagrRho);
71 }
72 }
73
74 return true;
75}
76
77
79
80template<typename T, typename DESCRIPTOR>
81Eul2LagrPostProcessor3D <T,DESCRIPTOR>::
82Eul2LagrPostProcessor3D ( int x0, int x1, int y0, int y1, int z0, int z1,
83 std::shared_ptr<Eul2LagrOperatorBase3D<T,DESCRIPTOR>> eul2LagrOperator )
84 : _x0(x0), _x1(x1), _y0(y0), _y1(y1), _z0(z0), _z1(z1), _eul2LagrOperator(eul2LagrOperator)
85{
86 this->getName() = "Eul2LagrPostProcessor3D";
87}
88
89template<typename T, typename DESCRIPTOR>
90Eul2LagrPostProcessor3D <T,DESCRIPTOR>::
91Eul2LagrPostProcessor3D (std::shared_ptr<Eul2LagrOperatorBase3D<T,DESCRIPTOR>> eul2LagrOperator)
92 : _x0(0), _x1(0), _y0(0), _y1(0), _z0(0), _z1(0), _eul2LagrOperator(eul2LagrOperator)
93{
94 this->getName() = "Eul2LagrPostProcessor3D";
95}
96
97template<typename T, typename DESCRIPTOR>
100 int x0, int x1, int y0, int y1, int z0, int z1 )
101{
102 _eul2LagrOperator->operator()(blockLattice);
103}
104
105template<typename T, typename DESCRIPTOR>
108{
109 processSubDomain(blockLattice, _x0, _x1, _y0, _y1, _z0, _z1);
110}
111
112
114
115template<typename T, typename DESCRIPTOR, template<typename U> class PARTICLETYPE>
117 int x0_, int x1_, int y0_, int y1_, int z0_, int z1_,
119 : PostProcessorGenerator3D<T,DESCRIPTOR>(x0_, x1_, y0_, y1_, z0_, z1_)
120{
121 _eul2LagrOperator = std::make_shared<Eul2LagrOperator3D<T,DESCRIPTOR,PARTICLETYPE>>(spSys[singleton::mpi().getRank()], superGeometry);
122}
123
124template<typename T, typename DESCRIPTOR, template<typename U> class PARTICLETYPE>
127 : PostProcessorGenerator3D<T,DESCRIPTOR>(0, 0, 0, 0, 0, 0)
128{
129 _eul2LagrOperator = std::make_shared<Eul2LagrOperator3D<T,DESCRIPTOR,PARTICLETYPE>>(spSys[singleton::mpi().getRank()], superGeometry);
130}
131
132template<typename T, typename DESCRIPTOR, template<typename U> class PARTICLETYPE>
134{
135 return new Eul2LagrPostProcessor3D<T,DESCRIPTOR>(this->x0,this->x1,this->y0,this->y1,this->z0,this->z1,
136 this->_eul2LagrOperator);
137}
138
139template<typename T, typename DESCRIPTOR, template<typename U> class PARTICLETYPE>
144
145
147
148template<typename T, typename DESCRIPTOR>
149Eul2LagrNormDistrPostProcessor3D <T,DESCRIPTOR>::
150Eul2LagrNormDistrPostProcessor3D(int x0, int x1, int y0, int y1, int z0, int z1, T mean, T stdDev, SuperGeometry<T,3>& superGeometry)
151 : _x0(x0), _x1(x1), _y0(y0), _y1(y1), _z0(z0), _z1(z1), _randomNormal(mean, stdDev), _superGeometry(superGeometry)
152{
153 this->getName() = "Eul2LagrNormDistrPostProcessor3D";
154}
155
156template<typename T, typename DESCRIPTOR>
157Eul2LagrNormDistrPostProcessor3D <T,DESCRIPTOR>::
158Eul2LagrNormDistrPostProcessor3D (T mean, T stdDev, SuperGeometry<T,3>& superGeometry)
159 : _x0(0), _x1(0), _y0(0), _y1(0), _z0(0), _z1(0), _randomNormal(mean, stdDev), _superGeometry(superGeometry)
160{
161 this->getName() = "Eul2LagrNormDistrPostProcessor3D";
162}
163
164template<typename T, typename DESCRIPTOR>
167 int x0, int x1, int y0, int y1, int z0, int z1 )
168{
169 std::cout << "ciao" << std::endl;
170 T output[1];
171 T input[3];
172 _randomNormal(output, input);
173
174 T physPos[] {output[0], 0., 0.};
175 int latticeRoundedPos[] {0, 0, 0, 0};
176 _superGeometry.getCuboidGeometry().getLatticeR (latticeRoundedPos, physPos);
177 int overlap = _superGeometry.getOverlap();
178 latticeRoundedPos[1] += overlap;
179 latticeRoundedPos[2] += overlap;
180 latticeRoundedPos[3] += overlap;
181 //Populating the lattice
182 T eul2LagrRho = blockLattice.get(&latticeRoundedPos[1]).template getField<descriptors::EUL2LAGR>();
183 eul2LagrRho += 1.;
184 blockLattice.get(&latticeRoundedPos[1]).template setField<descriptors::EUL2LAGR>(eul2LagrRho);
185}
186
187template<typename T, typename DESCRIPTOR>
190{
191 processSubDomain(blockLattice, _x0, _x1, _y0, _y1, _z0, _z1);
192}
193
194
196
197template<typename T, typename DESCRIPTOR>
199 int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, T mean, T stdDev, SuperGeometry<T,3>& superGeometry )
200 : PostProcessorGenerator3D<T,DESCRIPTOR>(x0_, x1_, y0_, y1_, z0_, z1_), _mean(mean), _stdDev(stdDev), _superGeometry(superGeometry)
201{ }
202
203template<typename T, typename DESCRIPTOR>
205 : PostProcessorGenerator3D<T,DESCRIPTOR>(0, 0, 0, 0, 0, 0), _mean(mean), _stdDev(stdDev), _superGeometry(superGeometry)
206{ }
207
208template<typename T, typename DESCRIPTOR>
210{
211 return new Eul2LagrNormDistrPostProcessor3D<T,DESCRIPTOR>(this->x0,this->x1,this->y0,this->y1,this->z0,this->z1,
212 this->_mean,this->_stdDev,this->_superGeometry);
213}
214
215template<typename T, typename DESCRIPTOR>
220
221
222} // olb
223
224#endif
Platform-abstracted block lattice for external access and inter-block interaction.
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
int getNy() const
Read only access to block height.
int getNx() const
Read only access to block width.
int getNz() const
Read only access to block height.
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
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.
Eul2LagrNormDistrPostProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, T mean, T stdDev, SuperGeometry< T, 3 > &superGeometry)
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
PostProcessor3D< T, DESCRIPTOR > * generate() const override
bool operator()(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Eul2LagrOperator3D(ParticleSystem3D< T, PARTICLETYPE > &pSystem, SuperGeometry< T, 3 > &superGeometry)
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override
Execute post-processing step.
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.
Eul2LagrPostProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, SuperParticleSystem3D< T, PARTICLETYPE > &spSys, SuperGeometry< T, 3 > &superGeometry)
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
PostProcessor3D< T, DESCRIPTOR > * generate() const override
class for marking output with some text
std::string & getName()
read and write access to name
Representation of a statistic for a parallel 2D geometry.
The class superParticleSystem is the basis for particulate flows within OpenLB.
int getRank() const
Returns the process ID.
MpiManager & mpi()
Top level namespace for all of OpenLB.