OpenLB 1.7
Loading...
Searching...
No Matches
particle3D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2016 Thomas Henn, Mathias J. Krause, 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 PARTICLE_3D_H
25#define PARTICLE_3D_H
26
27#include <set>
28#include <vector>
29#include <list>
30#include <deque>
31#include <string>
32#include <iostream>
34
35
36namespace olb {
37
38
40
41 template<typename T>
42 class Particle3D {
43 public:
44 Particle3D();
45 //Particle3D(std::vector<T> pos, T mas = 1., T rad = 1., int id = 0);
46 // mass = effectiveMass only when massAdd=0 !!
47 Particle3D(std::vector<T> pos, T mas = 1., T rad = 1., int id = 0, T masAdd = 0.);
48 //Particle3D(std::vector<T> pos, std::vector<T> vel, T mas = 1., T rad = 1., int id = 0);
49 Particle3D(std::vector<T> pos, std::vector<T> vel, T mas = 1., T rad = 1., int id = 0, T masAdd = 0.);
50 Particle3D(const Particle3D<T>& p);
51 inline void setPos(std::vector<T> pos);
52 inline void setStoredPos(std::vector<T> pos);
53 inline std::vector<T>& getStoredPos();
54 inline std::vector<T>& getPos();
55 inline const std::vector<T>& getPos() const;
56 inline void setVel(std::vector<T> vel);
57 inline void setStoredVel(std::vector<T> vel);
58 inline std::vector<T>& getStoredVel();
59 inline int getID();
60 inline void setID(int id);
61 inline std::vector<T>& getVel();
62 inline const std::vector<T>& getVel() const;
63 inline void addForce(std::vector<T>& frc);
64 inline void setForce(std::vector<T>& frc);
65 inline void resetForce();
66 inline std::vector<T>& getForce();
67 inline const std::vector<T>& getForce() const;
68 inline void setStoreForce(std::vector<T>& storeForce);
69 inline void resetStoreForce();
70 inline std::vector<T>& getStoreForce();
71 inline const std::vector<T>& getStoreForce() const;
72 // RK4
73 // inline void setPos(std::vector<T> pos, int i);
74 // inline std::vector<T>& getPos(int i);
75 // inline const std::vector<T>& getPos(int i) const;
76 // inline void setVel(std::vector<T> vel, int i);
77 // inline std::vector<T>& getVel(int i);
78 // inline const std::vector<T>& getVel(int i) const;
79 // inline void setForce(std::vector<T> force, int i);
80 // inline std::vector<T>& getForce(int i);
81 // inline const std::vector<T>& getForce(int i) const;
82 // write particle properties into serial
83 void serialize(T serial[]);
84 // write data into particle properties
85 void unserialize(T*);
86 void print();
87 void printDeep(std::string message);
88 // returns 'regular' mass
89 inline const T& getMass();
90 // returns mass that gets added to 'regular' mass
91 inline const T& getAddedMass();
92 // returns effective mass (mass + masAdd)
93 inline const T& getEffectiveMass();
94 // returns inverse 'regular' mass
95 inline const T& getInvMass();
96 // returns inverse of effective mass 1./(mass + masAdd)
97 inline const T& getInvEffectiveMass();
98
99 inline const T& getMass() const;
100 inline const T& getAddedMass() const;
101 inline const T& getEffectiveMass() const;
102 inline void setMass(T m);
103 inline void setAddedMass(T m);
104 inline const T& getRad();
105 inline const T& getRad() const;
106 inline void setRad(T r);
107 inline const int& getCuboid();
108 inline void setCuboid(int c);
109 inline const bool& getActive();
110 inline const bool& getActive() const;
111 inline void setActive(bool act);
112
113 static const int serialPartSize = 19; // pos, vel, force, mas, masAdd, effectiveMass, rad, cuboid, id, active, storeForce
114 std::vector<std::pair<size_t, T> > _verletList;
115
116 protected:
117 std::vector<T> _pos;
118 std::vector<T> _vel;
119 std::vector<T> _force;
129 int _id;
131 std::vector<T> _storePos;
132 std::vector<T> _storeVel;
133 std::vector<T> _storeForce;
134 // RK4
135 // std::vector<std::vector<T> > _positions;
136 // std::vector<std::vector<T> > _velocities;
137 // std::vector<std::vector<T> > _forces;
138
139 };
140
141 template<typename T, template<typename U> class PARTICLETYPE> class ParticleSystem3D;
142
143 template<typename T, template<typename U> class PARTICLETYPE>
145 public:
147 inline void simulate(T dT, bool scale = false);
148 inline void simulate(T dT, std::set<int> sActivityOfParticle, bool scale = false);
149 inline void simulateWithTwoWayCoupling_Mathias ( T dT,
152 int material, int subSteps = 1, bool scale = false );
153 inline void simulateWithTwoWayCoupling_Davide ( T dT,
156 int material, int subSteps = 1, bool scale = false );
157
158 private:
160 };
161
162}
163#endif /* PARTICLE_3D_H */
164
Abstact base class for BaseBackCouplingModel.
Abstact base class for all the forward-coupling models Its raison d'etre consists of not being temple...
std::vector< T > _vel
Definition particle3D.h:118
std::vector< T > & getVel()
const T & getInvEffectiveMass()
void unserialize(T *)
void setStoreForce(std::vector< T > &storeForce)
std::vector< T > & getForce()
std::vector< T > _pos
Definition particle3D.h:117
std::vector< T > _storePos
Definition particle3D.h:131
void addForce(std::vector< T > &frc)
std::vector< T > _force
Definition particle3D.h:119
std::vector< T > & getPos()
std::vector< T > & getStoredPos()
std::vector< T > _storeForce
Definition particle3D.h:133
void setMass(T m)
static const int serialPartSize
Definition particle3D.h:113
const int & getCuboid()
std::vector< T > & getStoreForce()
const T & getMass()
void setStoredVel(std::vector< T > vel)
void setVel(std::vector< T > vel)
int _cuboid
globIC
Definition particle3D.h:128
void setCuboid(int c)
std::vector< T > _storeVel
Definition particle3D.h:132
void printDeep(std::string message)
void serialize(T serial[])
void setActive(bool act)
void setID(int id)
void setPos(std::vector< T > pos)
void setRad(T r)
const bool & getActive()
std::vector< T > & getStoredVel()
const T & getAddedMass()
std::vector< std::pair< size_t, T > > _verletList
Definition particle3D.h:114
const T & getInvMass()
const T & getRad()
void setStoredPos(std::vector< T > pos)
void setForce(std::vector< T > &frc)
void setAddedMass(T m)
void resetStoreForce()
const T & getEffectiveMass()
void simulateWithTwoWayCoupling_Mathias(T dT, ForwardCouplingModel< T, PARTICLETYPE > &forwardCoupling, BackCouplingModel< T, PARTICLETYPE > &backCoupling, int material, int subSteps=1, bool scale=false)
SimulateParticles(ParticleSystem3D< T, PARTICLETYPE > *ps)
void simulateWithTwoWayCoupling_Davide(T dT, ForwardCouplingModel< T, PARTICLETYPE > &forwardCoupling, BackCouplingModel< T, PARTICLETYPE > &backCoupling, int material, int subSteps=1, bool scale=false)
void simulate(T dT, bool scale=false)
Top level namespace for all of OpenLB.