OpenLB 1.7
Loading...
Searching...
No Matches
ParticleDistribution.h
Go to the documentation of this file.
1/* Lattice Boltzmann sample, written in C++, using the OpenLB
2 * library
3 *
4 * Copyright (C) 2021 Simon Berg
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 */
24
25#ifndef PARTICLE_DISTRIBUTION_HH
26#define PARTICLE_DISTRIBUTION_HH
27
28namespace olb {
30 template <typename T, typename S>
32 private:
33 T _standardDeviation;
34 T _geometricMean;
35 T _scale;
36
37 public:
38
39 LogNormalDistribution(T standardDeviation, T geometricMean, T scale = 1);
40
41 bool operator()(T output[1], const S x[1]);
42 };
43
45 template <typename T, typename S>
46 class GaussDistribution :public AnalyticalF1D<T, S> {
47 private:
48 T _standardDeviation;
49 T _mean;
50 T _scale;
51
52 public:
53 GaussDistribution(T standardDeviation, T mean, T scale = 1);
54 bool operator()(T output[1], const S x[1]);
55 };
56
58
84 template <typename T, typename S>
86 private:
87 FunctorPtr <AnalyticalF1D<T, S>> _distribution;
88 std::vector<T> _particleArray;
89 std::vector<T> _timeArray;
90 long long _numberOfParticles;
91 long long _numberOfParticleSizeGroups;
92 T _particleOffset = 0;
93 T _particleOffsetTime = 0;
94 long long _currentParticle = 0;
95 T _minRadius;
96 T _maxRadius;
97
98 T** _sizeCalculation; // particle size calculation matrix: Radius group | concentration | fraction | number of particles in group
99 public:
100 template <typename C>
101 ParticleDistribution(FunctorPtr<AnalyticalF1D<T, S>>&& distribution, C numberOfParticles, C numberOfParticleSizeGroups, T minRadius, T maxRadius, T lengthConversion = 1);
102 bool calculateParticleArray(bool getExactParticleNumber = false);
103 template <typename DESCRIPTOR>
104 bool calculateTimeArray(AnalyticalF1D<T, S>& timeDistribution, UnitConverter<T, DESCRIPTOR>& converter, T begin, T end);
105 void printTimeArray();
106 template <typename C>
107 void spawnSphericalParticles(SuperParticleSystem3D<T, Particle3D>& supParticleSystem, IndicatorF3D<S>& indicator, T density, C iT, bool loopAround = false, bool reshuffleAfterLoop = false);
108 template<typename C>
109 void timeActivateParticles(SuperParticleSystem3D<T, Particle3D>& supParticleSystem, C iT, C idOfset = 0);
110 void deactivateParticles(SuperParticleSystem3D<T, Particle3D>& supParticleSystem, int beginID, int endID);
111 void preSpawnSphericalParticles(SuperParticleSystem3D<T, Particle3D>& supParticleSystem, IndicatorF3D<S>& indicator, T density, int beginID = 1, bool shuffle = false);
112 void getParticleArray(std::vector<T>& particleArray);
113 T nextParticleRadius(bool loopAround = false, bool reshuffleAfterLoop = false);
115 void printSizeMatrix();
116 void printParticleArray();
118 };
119};
120#endif
Smart pointer for managing the various ways of passing functors around.
Definition functorPtr.h:60
Functor for a Gaussian (normal) distribution.
GaussDistribution(T standardDeviation, T mean, T scale=1)
bool operator()(T output[1], const S x[1])
IndicatorF3D is an application from .
Functor for a logarithmic normal distribution.
LogNormalDistribution(T standardDeviation, T geometricMean, T scale=1)
bool operator()(T output[1], const S x[1])
Particle distribution for time and size discretization.
void spawnSphericalParticles(SuperParticleSystem3D< T, Particle3D > &supParticleSystem, IndicatorF3D< S > &indicator, T density, C iT, bool loopAround=false, bool reshuffleAfterLoop=false)
T nextParticleRadius(bool loopAround=false, bool reshuffleAfterLoop=false)
void deactivateParticles(SuperParticleSystem3D< T, Particle3D > &supParticleSystem, int beginID, int endID)
Sets the particle state 'active' to 'false' for particles with ids from 'beginID' to 'endID'.
void printParticleArray()
prints the particle Radii to the console
ParticleDistribution(FunctorPtr< AnalyticalF1D< T, S > > &&distribution, C numberOfParticles, C numberOfParticleSizeGroups, T minRadius, T maxRadius, T lengthConversion=1)
void printSizeMatrix()
prints the calculation matrix to the console
void shuffleParticleArray()
shuffles particle array using random_shuffle
bool calculateTimeArray(AnalyticalF1D< T, S > &timeDistribution, UnitConverter< T, DESCRIPTOR > &converter, T begin, T end)
bool calculateParticleArray(bool getExactParticleNumber=false)
void timeActivateParticles(SuperParticleSystem3D< T, Particle3D > &supParticleSystem, C iT, C idOfset=0)
void printTimeArray()
prints out all time-steps a new particle should appear
void preSpawnSphericalParticles(SuperParticleSystem3D< T, Particle3D > &supParticleSystem, IndicatorF3D< S > &indicator, T density, int beginID=1, bool shuffle=false)
void getParticleArray(std::vector< T > &particleArray)
The class superParticleSystem is the basis for particulate flows within OpenLB.
Conversion between physical and lattice units, as well as discretization.
Top level namespace for all of OpenLB.