MercuryDPM  0.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AngledPeriodicBoundaryUnitTest.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 #include "Species/Species.h"
28 #include "DPMBase.h"
31 
38 {
39 public:
40 
41  //sets species and periodic boundary
43  {
45  //set density such that mass is 1.0 for diameter 1.0 particles
46  species.setDensity(6.0 / constants::pi);
47  species.setStiffness(1e2);
48  species.setAdhesionStiffness(1e2);
49  //set such that the overlap for force balance is 10%
50  species.setAdhesionForceMax(1e-1 * species.getAdhesionStiffness());
51  species.setRollingFrictionCoefficient(1e20);
52  species.setRollingStiffness(1.0);
54  setTimeStep(1e-5);
55 
57  b1.set({0,1,0},0,4);
58  //boundaryHandler.copyAndAddObject(b1);
59 
61  Mdouble c = cos(constants::pi/2.0);
62  Mdouble s = sqrt(1.0-c*c);
63  Vec3D normal_left(s,-c,0.0);
64  Vec3D normal_right(0.0,-1.0,0.0);
65  Vec3D origin(0.0,0.0,0.0);
66  b.set(normal_left,normal_right,origin);
67  //comment line below to see how the system behaves w/o AngledPeriodicBoundary
69  }
70 
71 // void actionsBeforeTimeStep()
72 // {
73 // std::cout << std::endl << "actionsBeforeTimeStep time " << getNtimeSteps() << std::endl;
74 // particleHandler.write(std::cout);
75 // interactionHandler.write(std::cout);
76 // }
77 //
78 // //computes body force
79 // void computeAllForces()
80 // {
81 // DPMBase::computeAllForces();
82 // std::cout << std::endl << "computeAllForces time " << getNtimeSteps() << std::endl;
83 // particleHandler.write(std::cout);
84 // interactionHandler.write(std::cout);
85 // }
86 
87  //sets initial particle positions
89  {
90  //centrifugal acc. a=v^2/R;
91  Mdouble R = 4.0;
92  BaseParticle p;
94  p.setRadius(0.5);
95  p.setPosition({R,0.5,0});
97 
98  p.setRadius(0.5);
99  p.setPosition({R,-0.5,0});
100  //p.setVelocity({-sqrt(R)*s,sqrt(R)*c,0});
101  p.setAngularVelocity({0,0,1});
103  }
104 };
105 
106 int main(int argc UNUSED, char *argv[] UNUSED)
107 {
109  dpm.setName("AngledPeriodicBoundaryUnitTest");
110  dpm.setTimeMax(4.0*constants::pi);
111  dpm.setTimeMax(9.5*dpm.getTimeStep());
112  dpm.setXMin(-5);
113  dpm.setXMax( 5);
114  dpm.setYMin(-5);
115  dpm.setYMax( 5);
116  dpm.setZMin(-5);
117  dpm.setZMax( 5);
118  dpm.setGravity({0,0,0});
119  dpm.solve(argc, argv);
120 
121  //Note:: currently the rolling spring is not conserved!!
122  return 0;
123 }
124 // now plot
125 // p 'interactionRadius.fstat' u 7:($9/100) every 4::5 w lp
void set(Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight)
Defines a periodic wall.
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
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:61
void setTimeMax(Mdouble newTMax)
Allows the upper time limit to be changed.
Definition: DPMBase.cc:179
void setYMin(Mdouble newYMin)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMin...
Definition: DPMBase.cc:280
int main(int argc UNUSED, char *argv[] UNUSED)
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
void setSpecies(const ParticleSpecies *species)
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) ...
Defines a pair of periodic walls. Inherits from BaseBoundary.
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
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
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:888
void setXMin(Mdouble newXMin)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin...
Definition: DPMBase.cc:266
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:878
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:415
void setDensity(Mdouble density)
Allows the density to be changed.
#define UNUSED
Definition: GeneralDefine.h:37
void set(Vec3D normalLeft, Vec3D normalRight, Vec3D origin)
Defines a periodic wall.
void setZMin(Mdouble newZMin)
If the length of the problem domain in z-direction is ZMax - ZMin, this method sets ZMin...
Definition: DPMBase.cc:295
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:868
void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
Definition: DPMBase.cc:353
Contains material and contact force properties.
Definition: Interaction.h:35
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:368
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.