MercuryDPM  0.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SquarePackingSelfTest.cpp File Reference
#include "Mercury3D.h"
#include "StatisticsVector.h"
#include "Particles/BaseParticle.h"
#include "Walls/InfiniteWall.h"
#include <cmath>
#include <iostream>
#include <iomanip>
#include <Species/LinearViscoelasticSpecies.h>

Go to the source code of this file.

Classes

class  SquarePacking
 

Functions

int main (int argc UNUSED, char *argv[] UNUSED)
 

Function Documentation

int main ( int argc  UNUSED,
char *argv[]  UNUSED 
)

Definition at line 82 of file SquarePackingSelfTest.cpp.

References BaseHandler< T >::copyAndAddObject(), DPMBase::getTimeMax(), SquarePacking::N, constants::pi, StatisticsVector< T >::setCGTimeMin(), StatisticsVector< T >::setCGWidth(), DPMBase::setGravity(), StatisticsVector< T >::setN(), File::setName(), Files::setName(), DPMBase::setParticleDimensions(), Files::setSaveCount(), DPMBase::setSystemDimensions(), DPMBase::setTimeMax(), StatisticsVector< T >::setTimeMaxStat(), DPMBase::setTimeStep(), DPMBase::solve(), DPMBase::speciesHandler, Files::statFile, and StatisticsVector< T >::statistics_from_fstat_and_data().

83 {
84  SquarePacking problem;
85  problem.setName("SquarePackingSelfTest");
87  //set the number of particles
88  problem.N=5;
89  problem.setSystemDimensions(2);
90  problem.setParticleDimensions(2);
91  species->setDensity(6.0/constants::pi*2./3.);
92  //species->setDensity(1.9098593*2/3);
93  problem.setGravity(Vec3D(0.,-1,0.));
94  species->setCollisionTimeAndRestitutionCoefficient(.01,.1,1.);
95  problem.setTimeStep(.0002);
96  problem.setTimeMax(1.0);
97  problem.setSaveCount(1000);
98 
99  problem.setCGTimeMin(problem.getTimeMax()*.98);
100  problem.setTimeMaxStat(1e20);
101 
102  std::cout << "Relax the packing" << std::endl;
103  problem.solve();
104 
105  std::cout << "Get statistics" << std::endl;
106  StatisticsVector<Y> stats("SquarePackingSelfTest");
107  stats.statFile.setName("SquarePackingSelfTest.Y.stat");
108  double n = 500;
109  stats.setN(n);
110  stats.setCGWidth(.1);
111  stats.setCGTimeMin(problem.getTimeMax()*.98);
112  stats.setTimeMaxStat(1e20);
113  //stats.verbose();
114  //stats.set_boundedDomain(true);
115  stats.statistics_from_fstat_and_data();
116 
117  std::cout << "Get fully averaged statistics" << std::endl;
118  StatisticsVector<O> statsO("SquarePackingSelfTest");
119  statsO.statFile.setName("SquarePackingSelfTest.O.stat");
120  statsO.setCGTimeMin(problem.getTimeMax()*.98);
121  statsO.setTimeMaxStat(1e20);
122  statsO.statistics_from_fstat_and_data();
123  // should give you Density 1
124 }
void solve()
The work horse of the code.
Definition: DPMBase.cc:1895
void setTimeMax(Mdouble newTMax)
Allows the upper time limit to be changed.
Definition: DPMBase.cc:179
void setParticleDimensions(unsigned int particleDimensions)
Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres...
Definition: DPMBase.cc:474
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 setCGTimeMin(Mdouble t)
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
void setTimeMaxStat(Mdouble t)
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: Files.cc:138
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:868
This class is used to extract statistical data from MD simulations.
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
Definition: DPMBase.cc:353
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
Definition: DPMBase.cc:194