OpenLB 1.7
Loading...
Searching...
No Matches
HaiderLevenspielParticle3D.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 HAIDER_LEVENSPIEL_PARTICLE_3D_HH
25#define HAIDER_LEVENSPIEL_PARTICLE_3D_HH
26
27#include <string>
28#include <iostream>
29#include <set>
30#include <vector>
31#include <list>
32#include <deque>
33
35
36#ifndef M_PI
37#define M_PI 3.14159265358979323846
38#endif
39
40namespace olb {
41
42
43template<typename T>
47/*
48template<typename T>
49HaiderLevenspielParticle3D<T>::HaiderLevenspielParticle3D(std::vector<T> pos, T mas, T rad)
50 : Particle3D<T>::Particle3D(pos, mas, rad)
51{ }*/
52
53template<typename T>
57
58template<typename T>
59HaiderLevenspielParticle3D<T>::HaiderLevenspielParticle3D(std::vector<T> pos, std::vector<T> vel, T mas,
60 T rad)
61 : Particle3D<T>::Particle3D(pos, vel, mas, rad)
62{ }
63
64template<typename T>
66{
67 return sphericity;
68}
69
70template<typename T>
72{
73 return sphericity;
74}
75/*
76template<typename T>
77inline std::vector<T>& HaiderLevenspielParticle3D<T>::getTorque()
78{
79 return _torque;
80}
81
82template<typename T>
83inline const std::vector<T>& HaiderLevenspielParticle3D<T>::getTorque() const
84{
85 return _torque;
86}*/
87
88template<typename T>
89HaiderLevenspielParticle3D<T>::HaiderLevenspielParticle3D(std::vector<T> pos, T mas, T rad, T _volume , T _surface)
90 : Particle3D<T>::Particle3D( pos, mas, std::pow(3*_volume/(4*M_PI),0.3333333333))/*{pos, mas, rad}*///, sphericity {_volume}, surface {_surface}
91{
92sphericity = (4*M_PI*std::pow(3*_volume/(4*M_PI),0.66666666666))/_surface; //surface of volume equivalent sphere divided by particle surface
93//std::cout << "sphericity " <<sphericity << std::endl;
94surface = _surface;
95volume = _volume;
96//std::cout <<"getmass " << this->getMass() << std::endl;
97//std::cout << "surface " << surface << std::endl;
98 A = util::exp(2.3288-6.4581*sphericity + 2.4486*sphericity*sphericity);
99 B = 0.0964 + 0.5565*sphericity;
100 C = util::exp(4.905-13.8944*sphericity + 18.4222*sphericity*sphericity-10.2599*sphericity*sphericity*sphericity);
101 D = util::exp(1.4681+12.2584*sphericity-20.7322*sphericity*sphericity+15.8855*sphericity*sphericity*sphericity);
102//set the radius to volume equivalent raidus
103//std::cout << "radius " <<this->getRad() << std::endl;
104/*std::cout << "A " <<this->getA() << std::endl;
105std::cout << "B " <<this->getB() << std::endl;
106
107std::cout << "C " <<this->getC() << std::endl;
108std::cout << "D " <<this->getD() << std::endl;*/
109
110
111
112}
113/*
114template<typename T>
115void HaiderLevenspielParticle3D<T>::serialize(T serial[])
116{
117 for (int i = 0; i < 3; i++) {
118 serial[i] = this->_pos[i];
119 serial[i + 3] = this->_vel[i];
120 serial[i + 6] = this->_force[i];
121 }
122 serial[9] = this->_mas;
123 serial[10] = this->_rad;
124 serial[11] = this->_cuboid;
125 serial[12] = (double) this->_active;
126 serial[13] = (double) _aVel[0];
127 serial[14] = (double) _aVel[1];
128 serial[15] = (double) _aVel[2];
129 serial[16] = (double) _torque[0];
130 serial[17] = (double) _torque[1];
131 serial[18] = (double) _torque[2];
132}
133
134template<typename T>
135void HaiderLevenspielParticle3D<T>::unserialize(T* data)
136{
137 for (int i = 0; i < 3; i++) {
138 this->_pos[i] = data[i];
139 this->_vel[i] = data[i + 3];
140 this->_force[i] = data[i + 6];
141 }
142 this->_mas = data[9];
143 this->_rad = data[10];
144 this->_cuboid = int(data[11]);
145 this->_active = (bool) data[12];
146 _aVel[0] = (bool) data[13];
147 _aVel[1] = (bool) data[14];
148 _aVel[2] = (bool) data[15];
149 _torque[0] = (bool) data[16];
150 _torque[1] = (bool) data[17];
151 _torque[2] = (bool) data[18];
152}
153*/
154
156
157template<typename T>
161
162template<typename T>
164{
165 //std::cout << "SimulateParticles<T,HaiderLevenspielParticle3D>::simulate" << std::endl;
166 //_pSys->resetMag();
167 _pSys->computeForce();
168 //std::cout << "SimulateParticles<T,HaiderLevenspielParticle3D>::simulate after compute force" << std::endl;
169 _pSys->explicitEuler(dT, scale);
170 // _pSys->analytical(dT, scale);
171 //_pSys->rungeKutta4(dT);
172 //std::cout << "SimulateParticles<T,HaiderLevenspielParticle3D>::simulate after explicit euler" << std::endl;
173/*
174#ifdef CollisionModels
175 _pSys->partialElasticImpact(0.67);
176#endif*/
177//std::cout << "SimulateParticles<T,HaiderLevenspielParticle3D>::simulate after compute force" << std::endl;
178}
179
180template<typename T>
184 int material, int subSteps, bool scale )
185{
186 for (int iSubStep=1; iSubStep<=subSteps; iSubStep++) {
187 if (! _pSys->executeForwardCoupling(forwardCoupling) ) {
188 std::cout << " on substep " << iSubStep << std::endl;
190 }
191 _pSys->computeForce();
192 _pSys->explicitEuler(dT/(T)(subSteps), scale);
193 //_pSys->rungeKutta4(dT/(T)(subSteps));
194 }
195 _pSys->executeBackwardCoupling(backCoupling, material);
196}
197
198template<typename T>
202 int material, int subSteps, bool scale )
203{
204 for (int iSubStep=1; iSubStep<=subSteps; iSubStep++) {
205 if (! _pSys->executeForwardCoupling(forwardCoupling) ) {
206 std::cout << " on substep " << iSubStep << std::endl;
208 }
209 _pSys->computeForce();
210 _pSys->explicitEuler(dT/(T)(subSteps), scale);
211 //_pSys->rungeKutta4(dT/(T)(subSteps));
212 _pSys->executeBackwardCoupling(backCoupling, material, subSteps);
213 }
214}
215
216template<typename T>
217inline void SimulateParticles<T,HaiderLevenspielParticle3D>::simulate(T dT, std::set<int> sActivityOfParticle, bool scale)
218{
219 _pSys->resetMag(sActivityOfParticle);
220 _pSys->computeForce(sActivityOfParticle);
221 _pSys->explicitEuler(dT, sActivityOfParticle, scale);
222 _pSys->integrateTorqueMag(dT, sActivityOfParticle);
223
224#ifdef CollisionModels
225 _pSys->partialElasticImpact(0.67);
226#endif
227
228#ifdef CollisionModelsCombindedWithMechContactForce
229 _pSys->partialElasticImpactForCombinationWithMechContactForce(0.67);
230#endif
231}
232
233}
234
235#endif
#define M_PI
Abstact base class for BaseBackCouplingModel.
Abstact base class for all the forward-coupling models Its raison d'etre consists of not being temple...
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)
void exit(int exitcode)
Definition singleton.h:165
ADf< T, DIM > exp(const ADf< T, DIM > &a)
Definition aDiff.h:455
Top level namespace for all of OpenLB.