MercuryDPM  0.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AdhesiveForceUnitTest.cpp File Reference

Go to the source code of this file.

Classes

class  ParticleParticleInteraction
 This code is written to test short-distance non-contact forces such as van-der-Waals or liquid bridge forces. More...
 
class  ParticleParticleInteractionWithPlasticForces
 
class  ParticleWallInteraction
 

Functions

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

Function Documentation

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

Definition at line 212 of file AdhesiveForceUnitTest.cpp.

References BaseHandler< T >::begin(), FATAL, INFO, logger, DPMBase::particleHandler, and DPMBase::solve().

213 {
214  //First test Particle Particle interactions with no plastic forces so reverseable.
215  ParticleParticleInteraction ParticleParticleInteractionProblem;
216  ParticleParticleInteractionProblem.solve();
217 
218  logger(INFO,"Testing particle-particle collision for elastic adhesive forces");
219  std::vector<BaseParticle*>::iterator pIt = ParticleParticleInteractionProblem.particleHandler.begin();
220  if (!(*pIt)->getPosition().isEqualTo(Vec3D(-0.00101582359198137,0.0,0.0), 1e-7))
221  logger(FATAL,"First particle is in the wrong position. It is at %",(*pIt)->getPosition());
222  if (!(*pIt)->getVelocity().isEqualTo(Vec3D(-0.0436824,0.0,0.0) , 1e-7))
223  logger(FATAL,"First particle has the wrong velocity. It is at %",(*pIt)->getVelocity());
224  ++pIt;
225  if (!(*pIt)->getPosition().isEqualTo(Vec3D(0.00101582359198137,0.0,0.0), 1e-7))
226  logger(FATAL,"Second particle is in the wrong position. It is at %",(*pIt)->getPosition());
227  if (!(*pIt)->getVelocity().isEqualTo(Vec3D(0.0436824,0.0,0.0) , 1e-7))
228  logger(FATAL,"Second particle has the wrong velocity. It is at %",(*pIt)->getVelocity());
229 
230  //Second test Particle Particle interaction with a plastic force (non reverseable)
231  ParticleParticleInteractionWithPlasticForces ParticleParticleInteractionWithPlasticForcesProblem;
232  ParticleParticleInteractionWithPlasticForcesProblem.solve();
233 
234  logger(INFO,"Testing particle particles collision for plastic adhesive forces");
235  std::vector<BaseParticle*>::iterator pIt2 = ParticleParticleInteractionWithPlasticForcesProblem.particleHandler.begin();
236  if (!(*pIt2)->getPosition().isEqualTo(Vec3D(-0.00107858,0.0,0.0), 1e-7))
237  logger(FATAL,"First particle is in the wrong position. It is at %",(*pIt2)->getPosition());
238  if (!(*pIt2)->getVelocity().isEqualTo(Vec3D(-0.0352526,0.0,0.0) , 1e-7))
239  logger(FATAL,"First particle has the wrong velocity. It is at %",(*pIt2)->getVelocity());
240  ++pIt2;
241  if (!(*pIt2)->getPosition().isEqualTo(Vec3D(0.00107858,0.0,0.0), 1e-7))
242  logger(FATAL,"Second particle is in the wrong position. It is at %",(*pIt2)->getPosition());
243  if (!(*pIt2)->getVelocity().isEqualTo(Vec3D(0.0352526,0.0,0.0) , 1e-7))
244  logger(FATAL,"Second particle has the wrong velocity. It is at %",(*pIt2)->getVelocity());
245 
246  //Final test Particle-Wall interactions with a plastic force (non reversable)
248  ParticleWallInteraction.solve();
249 
250  logger(INFO,"Testing particle-wall collision for plastic adhesive forces");
251  std::vector<BaseParticle*>::iterator pIt3 = ParticleWallInteraction.particleHandler.begin();
252  if (!(*pIt3)->getPosition().isEqualTo(Vec3D(0.00104381,0.0,0.0), 1e-7))
253  logger(FATAL,"The particle is in the wrong position. It is at %",(*pIt3)->getPosition());
254  if (!(*pIt3)->getVelocity().isEqualTo(Vec3D(0.0362122,0.0,0.0) , 1e-7))
255  logger(FATAL,"The particle has the wrong velocity. It is at %",(*pIt3)->getVelocity());
256 
257  return 0;
258 }
void solve()
The work horse of the code.
Definition: DPMBase.cc:1895
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:28
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:482
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:878
LL< Log::FATAL > FATAL
Fatal log level.
Definition: Logger.cc:25
This code is written to test short-distance non-contact forces such as van-der-Waals or liquid bridge...
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45