MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Chute.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef CHUTE_H
27 #define CHUTE_H
28 #include "Mercury3D.h"
29 
30 class InsertionBoundary;
31 
32 
51 {
53 };
62 class Chute : public Mercury3D
63 {
64 public:
68  Chute();
69 
73  Chute(const DPMBase& other);
74 
78  Chute(const MercuryBase& other);
79 
83  Chute(const Mercury3D& other);
84 
88  Chute(const Chute& other);
89 
94  void constructor();
95 
99  bool readNextArgument(int& i, int argc, char *argv[]);
100 
104  void setupSideWalls();
105 
109  void makeChutePeriodic();
110 
114  bool getIsPeriodic() const;
115 
119  void setupInitialConditions();
120 
124  void read(std::istream& is);
125 
130  void write(std::ostream& os, bool writeAllParticles = true) const;
131 
132 //setters and getters
133 
138  void setFixedParticleRadius(Mdouble fixedParticleRadius);
139 
145 
149  void setRoughBottomType(RoughBottomType roughBottomType);
150 
155  void setRoughBottomType(std::string roughBottomTypeString);
156 
161 
165  void setChuteAngle(Mdouble chuteAngle);
166 
170  void setChuteAngleAndMagnitudeOfGravity(Mdouble chuteAngle, Mdouble gravity);
171 
172  //void setChuteAngle(Mdouble new_, Mdouble gravity){if (new_>=0.0&&new_<=90.0) {ChuteAngle = new_; setGravity(Vec3D(sin(ChuteAngle*pi/180.0), 0.0, -cos(ChuteAngle*pi/180.0))*gravity);} else std::cerr << "WARNING : Chute angle must be within [0,90]" << std::endl;}
173 
177  Mdouble getChuteAngle() const;
178 
183 
187  void setMaxFailed(unsigned int maxFailed);
188 
192  unsigned int getMaxFailed() const;
193 
198  void setInflowParticleRadius(Mdouble inflowParticleRadius);
199 
203  void setInflowParticleRadius(Mdouble minInflowParticleRadius, Mdouble maxInflowParticleRadius);
204 
208  void setMinInflowParticleRadius(Mdouble minInflowParticleRadius);
209 
213  void setMaxInflowParticleRadius(Mdouble maxInflowParticleRadius);
214 
219 
224 
229 
233  void setInflowHeight(Mdouble inflowHeight);
234 
238  Mdouble getInflowHeight() const;
239 
243  void setInflowVelocity(Mdouble inflowVelocity);
244 
248  Mdouble getInflowVelocity() const;
249 
253  void setInflowVelocityVariance(Mdouble inflowVelocityVariance);
254 
259 
263  void setChuteWidth(Mdouble chuteWidth);
264 
268  Mdouble getChuteWidth() const;
269 
273  virtual void setChuteLength(Mdouble chuteLength);
274 
278  Mdouble getChuteLength() const;
279 
284  int getNCreated() const;
285 
290  void increaseNCreated();
291 
295  void setInsertionBoundary(InsertionBoundary* insertionBoundary);
296 
297 protected:
301  void actionsBeforeTimeStep();
302 
306  void cleanChute();
307 
311  virtual void createBottom();
312 
316  void printTime() const;
317 
318 private:
319 
357  unsigned int maxFailed_;
367 
368 };
369 
370 #endif
void setInflowVelocity(Mdouble inflowVelocity)
Sets the average inflow velocity.
Definition: Chute.cc:887
void setInflowHeight(Mdouble inflowHeight)
Sets maximum inflow height (Z-direction)
Definition: Chute.cc:861
RoughBottomType
enum for determining the type of rough bottom (if any) of the chute. Either of the enum options can b...
Definition: Chute.h:50
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:65
void setChuteAngleAndMagnitudeOfGravity(Mdouble chuteAngle, Mdouble gravity)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:693
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:357
void setChuteWidth(Mdouble chuteWidth)
Sets the chute width (Y-direction)
Definition: Chute.cc:943
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:331
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
Definition: Chute.h:366
void setMaxFailed(unsigned int maxFailed)
Sets the number of times a particle will be tried to be added to the insertion boundary.
Definition: Chute.cc:731
Mdouble getInflowVelocityVariance() const
Returns the inflow velocity variance.
Definition: Chute.cc:933
double Mdouble
int getNCreated() const
void setMaxInflowParticleRadius(Mdouble maxInflowParticleRadius)
Sets the maximum radius of inflow particles.
Definition: Chute.cc:816
Mdouble getChuteLength() const
Returns the chute length (X-direction)
Definition: Chute.cc:973
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:672
Definition: Chute.h:52
Boundary structure for boundaries used for insertion of particles.
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:618
Mdouble getChuteAngleDegrees() const
Returns the chute angle (in degrees)
Definition: Chute.cc:720
Mdouble getInflowVelocity() const
Returns the average inflow velocity.
Definition: Chute.cc:904
Mdouble getInflowParticleRadius() const
Returns the average radius of inflow particles.
Definition: Chute.cc:833
void write(std::ostream &os, bool writeAllParticles=true) const
This function writes the Chute properties to an ostream, and adds the properties of ALL chute particl...
Definition: Chute.cc:204
RoughBottomType getRoughBottomType() const
Returns the type of (rough) bottom of the chute.
Definition: Chute.cc:658
Creates chutes with different bottoms. Inherits from Mercury3D (-> MercuryBase -> DPMBase)...
Definition: Chute.h:62
This is the base class for both Mercury2D and Mercury3D. Note the actually abstract grid is defined i...
Definition: MercuryBase.h:127
Mdouble getMaxInflowParticleRadius() const
Returns the maximum radius of inflow particles.
Definition: Chute.cc:851
bool getIsPeriodic() const
Returns whether the chute is periodic in Y.
Definition: Chute.cc:574
Mdouble getChuteWidth() const
Returns the chute width (Y-direction)
Definition: Chute.cc:953
Mdouble getFixedParticleRadius() const
Returns the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:603
void actionsBeforeTimeStep()
Calls Chute::cleanChute().
Definition: Chute.cc:223
void setupSideWalls()
Creates chute side walls (either solid or periodic)
Definition: Chute.cc:281
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:35
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Definition: Chute.h:352
bool readNextArgument(int &i, int argc, char *argv[])
This method can be used for reading object properties from a string.
Definition: Chute.cc:487
void setInsertionBoundary(InsertionBoundary *insertionBoundary)
Sets the chute insertion boundary.
Definition: Chute.cc:982
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow)...
Definition: Chute.cc:752
void setInflowVelocityVariance(Mdouble inflowVelocityVariance)
Sets the inflow velocity variance.
Definition: Chute.cc:914
void setupInitialConditions()
Creates bottom, side walls and a particle insertion boundary.
Definition: Chute.cc:247
void constructor()
This is the actual constructor METHOD; it is called by all constructors above (except the default cop...
Definition: Chute.cc:118
Mdouble getChuteAngle() const
Returns the chute angle (in radians)
Definition: Chute.cc:711
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:585
virtual void createBottom()
Creates the chute bottom, which can be either flat or one of three flavours of rough.
Definition: Chute.cc:316
void cleanChute()
Deletes all outflow particles once every 100 time steps.
Definition: Chute.cc:443
void setMinInflowParticleRadius(Mdouble minInflowParticleRadius)
sets the minimum radius of inflow particles
Definition: Chute.cc:799
Chute()
This is the default constructor. All it does is set sensible defaults.
Definition: Chute.cc:42
Mdouble getMinInflowParticleRadius() const
returns the minimum radius of inflow particles
Definition: Chute.cc:842
void increaseNCreated()
virtual void setChuteLength(Mdouble chuteLength)
Sets the chute length (X-direction)
Definition: Chute.cc:963
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:339
void read(std::istream &is)
Reads all chute properties from an istream.
Definition: Chute.cc:139
Mdouble inflowHeight_
Height of inflow.
Definition: Chute.h:347
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Definition: Chute.h:361
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:323
void printTime() const
prints time, max time and number of particles
Definition: Chute.cc:233
Mdouble fixedParticleRadius_
radius of the fixed particles at the bottom
Definition: Chute.h:327
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:343
void makeChutePeriodic()
This makes the chute periodic in Y.
Definition: Chute.cc:564
Mdouble getInflowHeight() const
Returns the maximum inflow height (Z-direction)
Definition: Chute.cc:878
unsigned int getMaxFailed() const
Returns the number of times a particle will be tried to be added to the insertion boundary...
Definition: Chute.cc:741
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:335