ExtremeOverlapWithWallsUnitTest.cpp File Reference
#include "DPMBase.h"
#include "Walls/InfiniteWall.h"
#include <iostream>
#include <Species/LinearViscoelasticSpecies.h>
#include <Logger.h>

Classes

class  ExtremeOverlapWithWallsUnitTest
 Compresses 2 particles (vertically) until they have an extreme overlap. More...
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Start off my solving the default problem

89 {
91  ExtremeOverlapWithWallsUnitTest OverlapProblem;
92  auto species = OverlapProblem.speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
93  species->setDensity(2000);
94  species->setStiffness(1e5);
95  species->setDissipation(1e-2);
96  OverlapProblem.setName("ExtremeOverlapWithWallsUnitTest");
97  OverlapProblem.setFileType(FileType::NO_FILE);
98  OverlapProblem.dataFile.setFileType(FileType::ONE_FILE);
99  //OverlapProblem.wallHandler.setWriteVTK(true);
100  //OverlapProblem.setParticlesWriteVTK(true);
101  OverlapProblem.setSaveCount(1000);
102  OverlapProblem.setDimension(3);
103  OverlapProblem.setTimeStep(1e-7);
104  OverlapProblem.setTimeMax(0.01);
105  // OverlapProblem.dataFile.getFstream().precision(10);
106  OverlapProblem.solve(argc,argv);
107 
108  Vec3D position = OverlapProblem.particleHandler.getObject(0)->getPosition();
109  helpers::check(position,Vec3D(0.00402345, 0, 0), 1e-8,"First particle position");
110 
111  position = OverlapProblem.particleHandler.getObject(1)->getPosition();
112  helpers::check(position,Vec3D(0.00901182, 0, 0), 1e-8,"Second particle position");
113 
114  return 0;
115 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
@ NO_FILE
file will not be created/read
@ ONE_FILE
all data will be written into/ read from a single file called name_
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:11
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:360
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:621
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:197
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
void setDimension(unsigned int newDim)
Sets both the system dimensions and the particle dimensionality.
Definition: DPMBase.cc:1394
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: DPMBase.h:1484
void setFileType(FileType fileType)
Sets File::fileType_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:437
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:864
void solve()
The work horse of the code.
Definition: DPMBase.cc:4334
Compresses 2 particles (vertically) until they have an extreme overlap.
Definition: ExtremeOverlapWithWallsUnitTest.cpp:35
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:193
Definition: Kernel/Math/Vector.h:30
void check(double real, double ideal, double error, std::string errorMessage)
Definition: TestHelpers.cc:16

References helpers::check(), BaseHandler< T >::copyAndAddObject(), DPMBase::dataFile, e(), BaseHandler< T >::getObject(), BaseInteractable::getPosition(), NO_FILE, ONE_FILE, DPMBase::particleHandler, DPMBase::setDimension(), DPMBase::setFileType(), File::setFileType(), DPMBase::setName(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::solve(), and DPMBase::speciesHandler.