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

Classes

class  ExtremeOverlapUnitTest
 Makes sure that the behavior is still sensible if the overlap of two particles grows extremely large. More...
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
101 {
102  ExtremeOverlapUnitTest OverlapProblem;
103 
104  //set some contact parameters; the contact is elastic (so we can check
105  //energy conservation), and very soft (so the particles repel each other slowly))
106  //To check Energy conservation, use gnuplot:
107  // p 'ExtremeOverlapUnitTest.ene' u 1:($2+$3+$4+$5)
109  species->setDensity(2000);
110  species->setStiffness(1e1);
111  species->setDissipation(0.0);
112  species->setSlidingFrictionCoefficient(1.0);
113  species->setSlidingStiffness(2.0/7.0*species->getStiffness());
114  species->setSlidingDissipation(2.0/7.0*species->getDissipation());
115 
116  OverlapProblem.setName("ExtremeOverlapUnitTest");
117  OverlapProblem.setFileType(FileType::NO_FILE);
118  OverlapProblem.dataFile.setFileType(FileType::ONE_FILE);
119  OverlapProblem.setSaveCount(1e3);
120  OverlapProblem.setDimension(2);
121  OverlapProblem.setTimeStep(1e-7);
122  OverlapProblem.setTimeMax(1e-2);
123  OverlapProblem.solve(argc,argv);
124 
125  /* JMFT: We don't need this any more, we have the self test system.
126  * ART Not true it is a unit test it is below that level, so I added it back in
127  * Note I had to change the tollenace to get this to work now from 1e-7 1-e10
128  * \todo Thomas could you have a look why I have to change the tollence on this code and if it is a sign of a major problem*/
129 
130  Vec3D position = OverlapProblem.particleHandler.getObject(0)->getPosition();
131  Vec3D positionToCompare = Vec3D(-1.031389999146e-06, 0.009506389407855, 0);
132  if (!position.isEqualTo(positionToCompare, 1e-7))
133  logger(FATAL,"Large particle is in the wrong position. It is at % and should be %",position,positionToCompare);
134  else
135  std::cout << "Test passed" << std::endl;
136  position = OverlapProblem.particleHandler.getObject(1)->getPosition();
137  positionToCompare = Vec3D(0.01010314899993, 0.01487096023445, 0);
138  if (!position.isEqualTo(positionToCompare, 1e-7))
139  logger(FATAL,"Small particle is in the wrong position. It is at % and should be %",position,positionToCompare);
140  else
141  std::cout << "Test passed" << std::endl;
142  //std::cout.precision(13); std::cout << position << std::endl;
143 
144  return 0;
145 }
@ 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, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
Definition: LinearViscoelasticSlidingFrictionSpecies.h:34
LL< Log::FATAL > FATAL
Definition of the different loglevels by its wrapper class LL. These are used as tags in template met...
Definition: Logger.cc:52
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
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
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 setDimension(unsigned int newDim)
Sets both the system dimensions and the particle dimensionality.
Definition: DPMBase.cc:1403
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: DPMBase.h:1478
void setFileType(FileType fileType)
Sets File::fileType_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:459
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
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 solve()
The work horse of the code.
Definition: DPMBase.cc:4270
Makes sure that the behavior is still sensible if the overlap of two particles grows extremely large.
Definition: ExtremeOverlapUnitTest.cpp:44
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:215
Definition: Vector.h:51
bool isEqualTo(const Vec3D &other, double tol) const
Checks if the length this Vec3D is equal the length of other with a certain tolerance.
Definition: Vector.cc:294

References BaseHandler< T >::copyAndAddObject(), DPMBase::dataFile, FATAL, BaseHandler< T >::getObject(), BaseInteractable::getPosition(), Vec3D::isEqualTo(), logger, 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.