InclinedPlaneUnitTest.cpp File Reference

Classes

class  InclinedPlane
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Start off my solving the default problem

52 {
53  logger(INFO, "Single particle rolling on a bottom plate");
55  InclinedPlane problem;
56 
58  problem.setName("InclinedPlane");
59  problem.setFileType(FileType::NO_FILE); //comment if you want file output
60  problem.setSaveCount(50000);
61  problem.setSystemDimensions(2);
62  problem.setParticleDimensions(3);
63  Mdouble theta = 15.0*constants::pi/180.0;
64  problem.setGravity(9.8*Vec3D(std::sin(theta),-std::cos(theta),0.0));
65  species->setDensity(2000);
66  species->setStiffness(10000);
67  species->setDissipation(0);
68  species->setSlidingStiffness(10000);
69  species->setSlidingDissipation(0);
70  species->setSlidingFrictionCoefficient(0.5);
71  //species->setRollingStiffness(10000);
72  //species->setRollingDissipation(0);
73  //species->setRollingFrictionCoefficient(0.5);
74  //tc=7e-5
75  problem.setTimeStep(0.02*species->getCollisionTime(species->getMassFromRadius(0.005)));
76  problem.setTimeMax(1.0);
77  problem.setXMax(0.1);
78  problem.setYMax(0.1);
79  problem.setZMax(0.1);
80  problem.solve(argc, argv);
81  //problem.write(std::cout, true);
82  const Vec3D v = problem.particleHandler.getObject(0)->getVelocity();
83  logger(INFO,"v_x(t_max)=% should be ~1.81",v.X);
84  logger(INFO,"v_y(t_max)=% should be ~0",v.Y);
85  helpers::check(v.X,1.81167,1e-4,"v_x");
86  helpers::check(v.Y,0.00234107,1e-4,"v_y");
87 
88 }
@ NO_FILE
file will not be created/read
double Mdouble
Definition: GeneralDefine.h:34
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
Definition: LinearViscoelasticSlidingFrictionSpecies.h:34
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:379
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:329
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
void setParticleDimensions(unsigned int particleDimensions)
Sets the particle dimensionality.
Definition: DPMBase.cc:1448
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1191
void setFileType(FileType fileType)
Sets File::fileType_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:459
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1165
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1217
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1234
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void setSystemDimensions(unsigned int newDim)
Sets the system dimensionality.
Definition: DPMBase.cc:1417
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1383
Definition: InclinedPlaneUnitTest.cpp:32
Definition: Vector.h:51
Mdouble Y
Definition: Vector.h:66
Mdouble X
the vector components
Definition: Vector.h:66
const Mdouble pi
Definition: ExtendedMath.h:45
void check(double real, double ideal, double error, std::string errorMessage)
Definition: TestHelpers.cc:37
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:64
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:44

References helpers::check(), BaseHandler< T >::copyAndAddObject(), mathsFunc::cos(), BaseHandler< T >::getObject(), BaseInteractable::getVelocity(), INFO, logger, NO_FILE, DPMBase::particleHandler, constants::pi, DPMBase::setFileType(), DPMBase::setGravity(), DPMBase::setName(), DPMBase::setParticleDimensions(), DPMBase::setSaveCount(), DPMBase::setSystemDimensions(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::setXMax(), DPMBase::setYMax(), DPMBase::setZMax(), mathsFunc::sin(), DPMBase::solve(), DPMBase::speciesHandler, Vec3D::X, and Vec3D::Y.