MercuryDPM  Trunk
 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-2020, 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 
29 #include "Mercury3D.h"
30 
31 class InsertionBoundary;
32 
33 
52 {
54 };
55 
64 class Chute : public Mercury3D
65 {
66 public:
70  Chute();
71 
75  explicit Chute(const DPMBase& other);
76 
80  explicit Chute(const MercuryBase& other);
81 
85  explicit Chute(const Mercury3D& other);
86 
90  Chute(const Chute& other);
91 
96  void constructor();
97 
101  bool readNextArgument(int& i, int argc, char* argv[]) override;
102 
106  void setupSideWalls();
107 
111  void makeChutePeriodic();
112 
116  bool getIsPeriodic() const;
117 
121  void setupInitialConditions() override;
122 
126  void read(std::istream& is, ReadOptions opt = ReadOptions::ReadAll) override;
127 
132  void write(std::ostream& os, bool writeAllParticles = true) const override;
133 
134 //setters and getters
135 
140  void setFixedParticleRadius(Mdouble fixedParticleRadius);
141 
147 
151  void setRoughBottomType(RoughBottomType roughBottomType);
152 
157  void setRoughBottomType(std::string roughBottomTypeString);
158 
163 
167  void setChuteAngle(Mdouble chuteAngle);
168 
172  void setChuteAngleAndMagnitudeOfGravity(Mdouble chuteAngle, Mdouble gravity);
173 
174  //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;}
175 
179  Mdouble getChuteAngle() const;
180 
185 
189  void setMaxFailed(unsigned int maxFailed);
190 
194  unsigned int getMaxFailed() const;
195 
200  void setInflowParticleRadius(Mdouble inflowParticleRadius);
201 
205  void setInflowParticleRadius(Mdouble minInflowParticleRadius, Mdouble maxInflowParticleRadius);
206 
210  void setMinInflowParticleRadius(Mdouble minInflowParticleRadius);
211 
215  void setMaxInflowParticleRadius(Mdouble maxInflowParticleRadius);
216 
221 
226 
231 
235  void setInflowHeight(Mdouble inflowHeight);
236 
240  Mdouble getInflowHeight() const;
241 
245  void setInflowVelocity(Mdouble inflowVelocity);
246 
250  Mdouble getInflowVelocity() const;
251 
255  void setInflowVelocityVariance(Mdouble inflowVelocityVariance);
256 
261 
265  void setChuteWidth(Mdouble chuteWidth);
266 
270  Mdouble getChuteWidth() const;
271 
275  virtual void setChuteLength(Mdouble chuteLength);
276 
280  Mdouble getChuteLength() const;
281 
285  void setInsertionBoundary(InsertionBoundary* insertionBoundary);
286 
287 protected:
291  void actionsBeforeTimeStep() override;
292 
296  void cleanChute();
297 
301  virtual void createBottom();
302 
304  virtual void addFlowParticlesCompactly();
305 
307 
311  void printTime() const override;
312 
313 private:
314 
352  unsigned int maxFailed_;
362 
363 };
364 
365 #endif
void setInflowVelocity(Mdouble inflowVelocity)
Sets the average inflow velocity.
Definition: Chute.cc:918
void setInflowHeight(Mdouble inflowHeight)
Sets maximum inflow height (Z-direction)
Definition: Chute.cc:892
void actionsBeforeTimeStep() override
Calls Chute::cleanChute().
Definition: Chute.cc:225
RoughBottomType
enum for determining the type of rough bottom (if any) of the chute. Either of the enum options can b...
Definition: Chute.h:51
virtual SphericalParticle createFlowParticle()
Definition: Chute.cc:1040
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:72
void setChuteAngleAndMagnitudeOfGravity(Mdouble chuteAngle, Mdouble gravity)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:724
A basic particle.
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:352
double Mdouble
Definition: GeneralDefine.h:34
void setChuteWidth(Mdouble chuteWidth)
Sets the chute width (Y-direction)
Definition: Chute.cc:974
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:326
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
Definition: Chute.h:361
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:762
Mdouble getInflowVelocityVariance() const
Returns the inflow velocity variance.
Definition: Chute.cc:964
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
bool readNextArgument(int &i, int argc, char *argv[]) override
This method can be used for reading object properties from a string.
Definition: Chute.cc:518
void setMaxInflowParticleRadius(Mdouble maxInflowParticleRadius)
Sets the maximum radius of inflow particles.
Definition: Chute.cc:847
Mdouble getChuteLength() const
Returns the chute length (X-direction)
Definition: Chute.cc:1004
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:703
Definition: Chute.h:53
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:649
Mdouble getChuteAngleDegrees() const
Returns the chute angle (in degrees)
Definition: Chute.cc:751
Mdouble getInflowVelocity() const
Returns the average inflow velocity.
Definition: Chute.cc:935
Mdouble getInflowParticleRadius() const
Returns the average radius of inflow particles.
Definition: Chute.cc:864
RoughBottomType getRoughBottomType() const
Returns the type of (rough) bottom of the chute.
Definition: Chute.cc:689
Creates chutes with different bottoms. Inherits from Mercury3D (-> MercuryBase -> DPMBase)...
Definition: Chute.h:64
This is the base class for both Mercury2D and Mercury3D. Note the actually abstract grid is defined i...
Definition: MercuryBase.h:125
Mdouble getMaxInflowParticleRadius() const
Returns the maximum radius of inflow particles.
Definition: Chute.cc:882
void setupInitialConditions() override
Creates bottom, side walls and a particle insertion boundary.
Definition: Chute.cc:249
bool getIsPeriodic() const
Returns whether the chute is periodic in Y.
Definition: Chute.cc:605
virtual void addFlowParticlesCompactly()
Add initial flow particles in a dense packing.
Definition: Chute.cc:1018
Mdouble getChuteWidth() const
Returns the chute width (Y-direction)
Definition: Chute.cc:984
Mdouble getFixedParticleRadius() const
Returns the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:634
void setupSideWalls()
Creates chute side walls (either solid or periodic)
Definition: Chute.cc:296
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:36
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Definition: Chute.h:347
void read(std::istream &is, ReadOptions opt=ReadOptions::ReadAll) override
Reads all chute properties from an istream.
Definition: Chute.cc:139
void setInsertionBoundary(InsertionBoundary *insertionBoundary)
Sets the chute insertion boundary.
Definition: Chute.cc:1013
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow)...
Definition: Chute.cc:783
void setInflowVelocityVariance(Mdouble inflowVelocityVariance)
Sets the inflow velocity variance.
Definition: Chute.cc:945
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:742
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:616
virtual void createBottom()
Creates the chute bottom, which can be either flat or one of three flavours of rough.
Definition: Chute.cc:331
void cleanChute()
Deletes all outflow particles once every 100 time steps.
Definition: Chute.cc:472
void setMinInflowParticleRadius(Mdouble minInflowParticleRadius)
sets the minimum radius of inflow particles
Definition: Chute.cc:830
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:873
void write(std::ostream &os, bool writeAllParticles=true) const override
This function writes the Chute properties to an ostream, and adds the properties of ALL chute particl...
Definition: Chute.cc:206
virtual void setChuteLength(Mdouble chuteLength)
Sets the chute length (X-direction)
Definition: Chute.cc:994
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:334
Mdouble inflowHeight_
Height of inflow.
Definition: Chute.h:342
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Definition: Chute.h:356
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:318
void printTime() const override
prints time, max time and number of particles
Definition: Chute.cc:235
Mdouble fixedParticleRadius_
radius of the fixed particles at the bottom
Definition: Chute.h:322
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:338
void makeChutePeriodic()
This makes the chute periodic in Y.
Definition: Chute.cc:595
Mdouble getInflowHeight() const
Returns the maximum inflow height (Z-direction)
Definition: Chute.cc:909
ReadOptions
Definition: DPMBase.h:240
unsigned int getMaxFailed() const
Returns the number of times a particle will be tried to be added to the insertion boundary...
Definition: Chute.cc:772
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:330