VerticalMixer.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #include "Material.h"
6 #include <Walls/InfiniteWall.h>
9 
12 struct VerticalMixer : public Material {
13 
14  VerticalMixer (int argc, char *argv[]) : Material (argc, argv) {}
15 
21  //two options for plotting walls
22  bool prettyWalls_ = false;
23  bool haveOuterWalls = true;
24 
25  void setupInitialConditions() override {
26  //set general properties
28  setMin(-getMax());
29  setGravity(Vec3D(0, 0, -9.8));
30 
31  //set timestep
32  //setTimeStep(species.getCollisionTime(mass)/15);
33  //14*collisiontime for nice flow for
34  setSaveCount(200);
35 
36  //enforce writing wall output
38  //if (!prettyWalls_)
39  //setParticlesWriteVTK(true);
40 
41  Mdouble cornerLength = 8.0 * particleRadius_;
42  if (!prettyWalls_) {
43  //define Walls
46  outer.setAxis(Vec3D(1, 0, 0));
47  outer.addObject(Vec3D(1, 0, 0), Vec3D(drumRadius_, 0, 0));
49 
52  leftCorner.setAxis(Vec3D(1, 0, 0));
53  leftCorner.addObject(Vec3D(1, 0, -1), Vec3D(drumRadius_, 0, -0.5 * drumLength_ + cornerLength));
54  wallHandler.copyAndAddObject(leftCorner);
55 
57  rightCorner.setSpecies(frictionalWallSpecies);
58  rightCorner.setAxis(Vec3D(1, 0, 0));
59  rightCorner.addObject(Vec3D(1, 0, 1), Vec3D(drumRadius_, 0, 0.5 * drumLength_ - cornerLength));
60  wallHandler.copyAndAddObject(rightCorner);
61 
62  InfiniteWall leftEnd;
64  leftEnd.set(Vec3D(-1, 0, 0), Vec3D(-0.5 * drumLength_, 0, 0));
66 
67  InfiniteWall rightEnd;
69  rightEnd.set(Vec3D(1, 0, 0), Vec3D(0.5 * drumLength_, 0, 0));
70  wallHandler.copyAndAddObject(rightEnd);
71 
72  addBlades();
73 
74  } else {
75  Mdouble thickness = particleRadius_;
76  setMax(getMax()+Vec3D(1,1,1)*2*thickness);
77  setMin(getMin()-Vec3D(1,1,1)*2*thickness);
78 
79  if (haveOuterWalls) {
80  //define Walls
83  outer.setAxis(Vec3D(1, 0, 0));
84  outer.addObject(Vec3D(1, 0, 0), Vec3D(drumRadius_, 0, 0));
85  outer.addObject(Vec3D(-1, 0, 0), Vec3D(drumRadius_ + thickness, 0, 0));
86  outer.addObject(Vec3D(0, 0, 1), Vec3D(0, 0, -0.5 * drumLength_ + cornerLength));
87  outer.addObject(Vec3D(0, 0, -1), Vec3D(0, 0, 0.5 * drumLength_ - cornerLength));
89 
92  leftCorner.setAxis(Vec3D(1, 0, 0));
93  leftCorner.addObject(Vec3D(1, 0, -1), Vec3D(drumRadius_, 0, -0.5 * drumLength_ + cornerLength));
94  leftCorner.addObject(Vec3D(-1, 0, 1),
95  Vec3D(drumRadius_ + thickness, 0, -0.5 * drumLength_ + cornerLength));
96  leftCorner.addObject(Vec3D(0, 0, -1), Vec3D(0, 0, -0.5 * drumLength_ + cornerLength));
97  leftCorner.addObject(Vec3D(1, 0, 0), Vec3D(drumRadius_ - cornerLength, 0, 0));
98  wallHandler.copyAndAddObject(leftCorner);
99 
101  rightCorner.setSpecies(frictionalWallSpecies);
102  rightCorner.setAxis(Vec3D(1, 0, 0));
103  rightCorner.addObject(Vec3D(1, 0, 1), Vec3D(drumRadius_, 0, 0.5 * drumLength_ - cornerLength));
104  rightCorner.addObject(Vec3D(-1, 0, -1),
105  Vec3D(drumRadius_ + thickness, 0, 0.5 * drumLength_ - cornerLength));
106  rightCorner.addObject(Vec3D(0, 0, 1), Vec3D(0, 0, 0.5 * drumLength_ - cornerLength));
107  rightCorner.addObject(Vec3D(1, 0, 0), Vec3D(drumRadius_ - cornerLength, 0, 0));
108  wallHandler.copyAndAddObject(rightCorner);
109 
112  leftEnd.setAxis(Vec3D(1, 0, 0));
113  leftEnd.addObject(Vec3D(0, 0, 1), Vec3D(0, 0, -0.5 * drumLength_ - thickness));
114  leftEnd.addObject(Vec3D(0, 0, -1), Vec3D(0, 0, -0.5 * drumLength_));
115  leftEnd.addObject(Vec3D(-1, 0, 0), Vec3D(drumRadius_ - cornerLength, 0, 0));
116  wallHandler.copyAndAddObject(leftEnd);
117 
120  rightEnd.setAxis(Vec3D(1, 0, 0));
121  rightEnd.addObject(Vec3D(0, 0, -1), Vec3D(0, 0, 0.5 * drumLength_ + thickness));
122  rightEnd.addObject(Vec3D(0, 0, 1), Vec3D(0, 0, 0.5 * drumLength_));
123  rightEnd.addObject(Vec3D(-1, 0, 0), Vec3D(drumRadius_ - cornerLength, 0, 0));
124  wallHandler.copyAndAddObject(rightEnd);
125  }
126 
127  addPrettyBlades();
128  }
129 
130  for (BaseWall* w : wallHandler) {
131  w->setAngularVelocity(angularVelocity);
132  }
133 
135  p.setSpecies(particleSpecies);
136  p.setRadius(particleRadius_);
137  CubeInsertionBoundary c; //delete is done in boundaryHandler
138  c.set(&p, 0, getMin(), getMax(), Vec3D(0, 0, 0), Vec3D(0, 0, 0));
139  //c.setPSD(PSD::getDistributionNormal(particleRadius_,0.025*particleRadius_,50));
140  c.setPSD(psd);
141  c.setInitialVolume(particleNumber_*p.getVolume());
143  }
144 
145  void printTime() const override
146  {
147  logger(INFO,"t %\tN %\tE %\tC %",getTime(),particleHandler.getNumberOfObjects(),
149  }
150 
151  virtual void addBlades() {}
152 
153  virtual void addPrettyBlades() {}
154 };
155 
157 
158  VerticalMixerStraightBlades (int argc, char *argv[]) : VerticalMixer (argc, argv) {}
159 
162 
163  void addBlades() override {
164  IntersectionOfWalls blade;
169  Vec3D(0,-0.5*bladeWidth_,drumRadius_)});
171 
172  const Vec3D quarterTurn = {2,0,0};
173  blade.rotate(quarterTurn);
175  blade.rotate(quarterTurn);
177  blade.rotate(quarterTurn);
179  }
180 };
181 
183 
184  VerticalMixerAngledBlades (int argc, char *argv[]) : VerticalMixerStraightBlades (argc, argv) {}
185 
187 
188  void addBlades() override {
191 
192  IntersectionOfWalls blade;
198  blade.setPosition(Vec3D(0.2*drumLength_,0,0));
200 
201  const Vec3D quarterTurn = {2,0,0};
202  blade.rotate(quarterTurn);
203  blade.setPosition(Vec3D(-0.2*drumLength_,0,0));
205  blade.rotate(quarterTurn);
206  blade.setPosition(Vec3D(0.2*drumLength_,0,0));
208  blade.rotate(quarterTurn);
209  blade.setPosition(Vec3D(-0.2*drumLength_,0,0));
211  }
212 
213  void addPrettyBlades() override {
214  Mdouble sb = sin(bladeAngle_);
215  Mdouble cb = cos(bladeAngle_);
216 
217  IntersectionOfWalls blade;
219  blade.createPrism({Vec3D(0.5*bladeWidth_*sb,0.5*bladeWidth_*cb,drumRadius_),
222  Vec3D(-0.5*bladeWidth_*sb,-0.5*bladeWidth_*cb,drumRadius_)});
223  //restrict to inside
224  Mdouble cornerLength = 8.0 * particleRadius_;
225  for (Mdouble angle = -0.2*constants::pi; angle<=0.2001*constants::pi; angle+=0.05*constants::pi) {
226  Mdouble s = sin(angle);
227  Mdouble c = cos(angle);
228  //outer.addObject(Vec3D(1, 0, 0), Vec3D(drumRadius_, 0, 0));
229  blade.addObject(Vec3D(0, s, -c), Vec3D(0, -s, c)*drumRadius_);
230  }
231  const Vec3D quarterTurn = {2,0,0};
232 
233  IntersectionOfWalls leftBlade = blade;
234  for (Mdouble angle = -0.2*constants::pi; angle<=0.2001*constants::pi; angle+=0.05*constants::pi) {
235  Mdouble s = sin(angle);
236  Mdouble c = cos(angle);
237  //leftCorner.addObject(Vec3D(1, 0, -1), Vec3D(drumRadius_, 0, -0.5 * drumLength_ + cornerLength));
238  leftBlade.addObject(Vec3D(1, s, -c), Vec3D(0.2*drumLength_-0.5 * drumLength_ + cornerLength, -s*drumRadius_, c*drumRadius_));
239  //blade.addObject(Vec3D(-1, s, -c), Vec3D(-0.2*drumLength_+0.5 * drumLength_ - cornerLength, -s*drumRadius_, c*drumRadius_));
240  }
241  leftBlade.setPosition(Vec3D(-0.2*drumLength_,0,0));
242  leftBlade.rotate(quarterTurn);
243  wallHandler.copyAndAddObject(leftBlade);
244  leftBlade.rotate(quarterTurn);
245  leftBlade.rotate(quarterTurn);
246  wallHandler.copyAndAddObject(leftBlade);
247 
248  IntersectionOfWalls rightBlade = blade;
249  for (Mdouble angle = -0.2*constants::pi; angle<=0.2001*constants::pi; angle+=0.05*constants::pi) {
250  Mdouble s = sin(angle);
251  Mdouble c = cos(angle);
252  //rightCorner.addObject(...);
253  rightBlade.addObject(Vec3D(-1, s, -c), Vec3D(-0.2*drumLength_+0.5 * drumLength_ - cornerLength, -s*drumRadius_, c*drumRadius_));
254  }
255  rightBlade.setPosition(Vec3D(0.2*drumLength_,0,0));
256  wallHandler.copyAndAddObject(rightBlade);
257  rightBlade.rotate(quarterTurn);
258  rightBlade.rotate(quarterTurn);
259  wallHandler.copyAndAddObject(rightBlade);
260  }
261 };
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
@ MULTIPLE_FILES
each time-step will be written into/read from separate files numbered consecutively: name_....
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
RowVector3d w
Definition: Matrix_resize_int.cpp:3
float * p
Definition: Tutorial_Map_using.cpp:9
Use AxisymmetricIntersectionOfWalls to Screw Screw::read Screw::read Screw::read define axisymmetric ...
Definition: AxisymmetricIntersectionOfWalls.h:105
void setAxis(Vec3D a)
Definition: AxisymmetricIntersectionOfWalls.cc:149
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:360
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:218
virtual void rotate(const Vec3D &angularVelocityDt)
Rotates this BaseInteractable.
Definition: BaseInteractable.cc:208
Basic class for walls.
Definition: BaseWall.h:28
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:148
It's an insertion boundary which has cuboidal shape (yes, 'CuboidalInsertionBoundary' would have been...
Definition: CubeInsertionBoundary.h:21
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:799
Mdouble getKineticEnergy() const
Returns the global kinetic energy stored in the system.
Definition: DPMBase.cc:1535
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1453
Vec3D getMax() const
Returns the maximum coordinates of the problem domain.
Definition: DPMBase.h:659
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1109
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1458
Vec3D getMin() const
Returns the minimum coordinates of the problem domain.
Definition: DPMBase.h:653
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
Vec3D getCentreOfMass() const
JMFT: Return the centre of mass of the system, excluding fixed particles.
Definition: DPMBase.cc:1603
void setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
Definition: DPMBase.cc:1073
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
Mdouble getElasticEnergy() const
Returns the global elastic energy within the system.
Definition: DPMBase.cc:1521
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:27
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:97
A IntersectionOfWalls is convex polygon defined as an intersection of InfiniteWall's.
Definition: IntersectionOfWalls.h:38
void addObject(Vec3D normal, Vec3D point)
Adds a wall to the set of infinite walls, given a normal vector pointing into the wall (i....
Definition: IntersectionOfWalls.cc:117
void createPrism(std::vector< Vec3D > points, Vec3D prismAxis)
Creates an open prism which is a polygon between the points and extends infinitely in the PrismAxis d...
Definition: IntersectionOfWalls.cc:461
void createOpenPrism(std::vector< Vec3D > points, Vec3D prismAxis)
Creates an open prism which is a polygon between the points, except the first and last point,...
Definition: IntersectionOfWalls.cc:446
void setSpecies(const ParticleSpecies *species)
sets species of subwalls as well
Definition: IntersectionOfWalls.cc:51
Definition: Material.h:12
PSD psd
Definition: Material.h:14
ParticleSpecies * frictionalWallSpecies
Definition: Material.h:16
ParticleSpecies * particleSpecies
Definition: Material.h:15
Mdouble getVolumeDx(Mdouble x) const
Calculate a certain diameter (e.g. D10, D50, D90, etc.) from a percentile x of the volume based PSD.
Definition: PSD.cc:929
unsigned int getNumberOfObjects() const override
Returns the number of objects in the container. In parallel code this practice is forbidden to avoid ...
Definition: ParticleHandler.cc:1323
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:16
Definition: Kernel/Math/Vector.h:30
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:445
#define Z
Definition: icosphere.cpp:21
RealScalar s
Definition: level1_cplx_impl.h:130
double angle(const double &t)
Angular position as a function of time t.
Definition: jeffery_orbit.cc:98
int c
Definition: calibrate.py:100
const Mdouble pi
Definition: ExtendedMath.h:23
Definition: VerticalMixer.h:182
void addBlades() override
Definition: VerticalMixer.h:188
Mdouble bladeAngle_
Definition: VerticalMixer.h:186
void addPrettyBlades() override
Definition: VerticalMixer.h:213
VerticalMixerAngledBlades(int argc, char *argv[])
Definition: VerticalMixer.h:184
Definition: VerticalMixer.h:156
void addBlades() override
Definition: VerticalMixer.h:163
Mdouble bladeWidth_
Definition: VerticalMixer.h:160
VerticalMixerStraightBlades(int argc, char *argv[])
Definition: VerticalMixer.h:158
Mdouble bladeHeight_
Definition: VerticalMixer.h:161
Definition: VerticalMixer.h:12
Mdouble particleRadius_
Definition: VerticalMixer.h:16
bool prettyWalls_
Definition: VerticalMixer.h:22
Mdouble drumRadius_
Definition: VerticalMixer.h:17
void setupInitialConditions() override
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: VerticalMixer.h:25
VerticalMixer(int argc, char *argv[])
Definition: VerticalMixer.h:14
Vec3D angularVelocity
Definition: VerticalMixer.h:19
virtual void addPrettyBlades()
Definition: VerticalMixer.h:153
Mdouble drumLength_
Definition: VerticalMixer.h:18
Mdouble particleNumber_
Definition: VerticalMixer.h:20
void printTime() const override
Displays the current simulation time and the maximum simulation duration.
Definition: VerticalMixer.h:145
virtual void addBlades()
Definition: VerticalMixer.h:151
bool haveOuterWalls
Definition: VerticalMixer.h:23