MercuryDPM  0.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tutorial9.cpp
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 // Tutorial 9
27 
28 /*
29 ** This file is annotated with DoxyFile comments in order to show the code on
30 ** the documentation - This is not needed for your real drivers.
31 ** Please ignore these comments.
32 */
33 
36 #include <Mercury3D.h>
37 #include <Particles/BaseParticle.h>
38 #include <Walls/InfiniteWall.h>
40 
42 class Tutorial9 : public Mercury3D
43 {
44  public:
45 
47  {
48  BaseParticle p0;
49 
50  p0.setIndSpecies(0); // sets the particle to be as species type-1
51  p0.setRadius(0.005);
52  p0.setPosition(Vec3D(0.05*getXMax(),0.01*getYMax(),getZMin()+p0.getRadius()));
53  p0.setVelocity(Vec3D(0.0,0.0,0.0));
55 
56  p0.setIndSpecies(1); // sets the particle to species type-2
57  p0.setRadius(0.005);
58  p0.setPosition(Vec3D(0.05*getXMax(),0.21*getYMax(),getZMin()+p0.getRadius()));
59  p0.setVelocity(Vec3D(0.0,0.0,0.0));
61 
62  p0.setIndSpecies(2); // sets the particle to species type-3
63  p0.setRadius(0.005);
64  p0.setPosition(Vec3D(0.05*getXMax(),0.41*getYMax(),getZMin()+p0.getRadius()));
65  p0.setVelocity(Vec3D(0.0,0.0,0.0));
67 
68 
70  InfiniteWall w0;
71 
72  w0.set(Vec3D(0.0,0.0,-1.0),Vec3D(0.0,0.0,getZMin()));
75 
76  }
77 
78 };
80 
82 int main(int argc, char *argv[])
83 {
84 
85  // Problem setup
86  Tutorial9 problem; // instantiate an object of class Tutorial 9
87 
88  double angle = constants::pi/180.0*20.0;
89 
90  problem.setName("Tutorial9");
91  problem.setSystemDimensions(3);
92  problem.setGravity(Vec3D(sin(angle),0.0,-cos(angle))*9.81);
93  problem.setXMax(0.3);
94  problem.setYMax(0.3);
95  problem.setZMax(0.05);
96  problem.setTimeMax(0.5);
97 
101  auto species01 = problem.speciesHandler.getMixedObject(species0, species1);
102  auto species02 = problem.speciesHandler.getMixedObject(species0, species2);
103 
104  // The normal spring stiffness and normal dissipation is computed and set as
105  // For collision time tc=0.005 and restitution coefficeint rc=0.88,
106 
107  species0->setDensity(2500.0); // sets the species type-0 density
108  species0->setStiffness(259.018);// sets the spring stiffness
109  species0->setSlidingStiffness(2.0/7.0*species0->getStiffness());
110  species0->setRollingStiffness(2.0/5.0*species0->getStiffness());
111  species0->setDissipation(0.0334);// sets the dissipation
112  species0->setSlidingFrictionCoefficient(0.0);
113  species0->setRollingFrictionCoefficient(0.0);
114 
115  species1->setDensity(2500.0); // sets the species type-1 density
116  species1->setStiffness(259.018);// sets the spring stiffness
117  species1->setDissipation(0.0334);// sets the dissipation
118  species1->setSlidingStiffness(2.0/7.0*species1->getStiffness());
119  species1->setRollingStiffness(2.0/5.0*species1->getStiffness());
120  species1->setSlidingFrictionCoefficient(0.5);
121  species1->setRollingFrictionCoefficient(0.0);
122 
123  species01->setStiffness(259.018);
124  species01->setDissipation(0.0334);// sets the dissipation
125  species01->setSlidingStiffness(2.0/7.0*species01->getStiffness());
126  species01->setRollingStiffness(2.0/5.0*species01->getStiffness());
127  species01->setSlidingFrictionCoefficient(0.5);
128  species01->setRollingFrictionCoefficient(0.0);
129 
130  species2->setDensity(2500.0); // sets the species type-2 density
131  species2->setStiffness(258.5);// sets the spring stiffness
132  species2->setDissipation(0.0);// sets the dissipation
133  species2->setSlidingStiffness(2.0/7.0*species2->getStiffness());
134  species2->setRollingStiffness(2.0/5.0*species2->getStiffness());
135  species2->setSlidingFrictionCoefficient(0.5);
136  species2->setRollingFrictionCoefficient(0.5);
137 
138  species02->setStiffness(259.018);
139  species02->setDissipation(0.0334);// sets the dissipation
140  species02->setSlidingStiffness(2.0/7.0*species02->getStiffness());
141  species02->setRollingStiffness(2.0/5.0*species02->getStiffness());
142  species02->setSlidingFrictionCoefficient(0.5);
143  species02->setRollingFrictionCoefficient(0.5);
144 
145  problem.setSaveCount(10);
150 
151  problem.setXBallsAdditionalArguments("-solidf -v0 -s 8");
152 
153  problem.setTimeStep(0.005/50.0);
154  problem.solve(argc, argv);
155 
156  return 0;
157 }
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
Definition: DPMBase.cc:309
void solve()
The work horse of the code.
Definition: DPMBase.cc:1895
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
void setTimeMax(Mdouble newTMax)
Allows the upper time limit to be changed.
Definition: DPMBase.cc:179
int main(int argc, char *argv[])
[T9:class]
Definition: Tutorial9.cpp:82
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: Files.h:219
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:338
Species< LinearViscoelasticNormalSpecies, FrictionSpecies > LinearViscoelasticFrictionSpecies
void setSystemDimensions(unsigned int newDim)
Allows for the dimension of the simulation to be changed.
Definition: DPMBase.cc:453
void setGravity(Vec3D newGravity)
Allows to modify the gravity vector.
Definition: DPMBase.cc:431
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:231
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Definition: DPMBase.cc:324
File eneFile
An instance of class File to handle in- and output into a .ene file.
Definition: Files.h:214
file will not be created/read
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: Files.cc:149
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:268
const Mdouble pi
Definition: ExtendedMath.h:42
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:35
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:878
all data will be written into/ read from a single file called name_
File fStatFile
An instance of class File to handle in- and output into a .fstat file.
Definition: Files.h:209
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: Files.cc:138
MERCURY_DEPRECATED void setIndSpecies(unsigned int indSpecies)
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: Files.h:204
Mdouble getRadius() const
Returns the particle's radius_.
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:868
U::MixedSpeciesType * getMixedObject(const U *S, const U *T)
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:403
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:245
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:209
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:883
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
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:70
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:252
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
Definition: DPMBase.cc:353
This is a class defining walls.
Definition: InfiniteWall.h:43
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: Tutorial9.cpp:46
[T9:headers]
Definition: Tutorial9.cpp:42