5ParticlesRestartUnitTest.cpp File Reference
#include "DPMBase.h"
#include "Math/Helpers.h"

Functions

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

Function Documentation

◆ main()

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

In this file, 5 Particles (4 fixed) are loaded from files "5Particles.ini" and "5Particles.restart". The particles are aligned such that the single nonfixed particle rotates sinusoidally without moving. This is to test the behaviour of the tangential spring and the file loading routines.

35 {
36 
37  helpers::writeToFile("5Particles.ini",
38  "5 0 0 0 0 1.6 1 1.6 \n"
39  "0 0 0 0 0 0 0.5 0 0 0 0 0 0 0\n"
40  "0 0 1.4 0 0 0 0.5 0 0 0 0 0 0 0\n"
41  "1.4 0 0 0 0 0 0.5 0 0 0 0 0 0 0\n"
42  "1.4 0 1.4 0 0 0 0.5 0 0 0 0 0 0 0\n"
43  "0.7 0 0.7 0 0 0 0.5 0 0 0 0 30 0 0\n"
44  );
45 
46  helpers::writeToFile("5Particles.restart",
47  "MercuryDPM 0.14 name 5ParticlesRestartUnitTest_restart revision 4946 repository https://svn.mercurydpm.org/SourceCode/Trunk\n"
48  "dataFile fileType ONE_FILE saveCount 5 counter 202 lastSavedTimeStep 1001\n"
49  "fStatFile fileType ONE_FILE saveCount 5 counter 202 lastSavedTimeStep 1001\n"
50  "eneFile fileType ONE_FILE saveCount 1 counter 1002 lastSavedTimeStep 1001\n"
51  "restartFile fileType ONE_FILE saveCount 5 counter 202 lastSavedTimeStep 1001\n"
52  "statFile fileType ONE_FILE saveCount 5 counter 0\n"
53  "interactionFile fileType ONE_FILE saveCount 5 counter 1 lastSavedTimeStep 4294967295\n"
54  "xMin 0 xMax 1.6 yMin 0 yMax 1 zMin 0 zMax 1.6\n"
55  "timeStep 1e-05 time 0.0100099999999998 ntimeSteps 1001 timeMax 0.01\n"
56  "systemDimensions 3 particleDimensions 3 gravity 0 0 0 writeVTK 0 NO_FILE NO_FILE 0 0 0 0 random 0 0 0 0 0 0 0 xBallsArguments -v0 -solidf\n"
57  "Species 1\n"
58  "LinearViscoelasticSlidingFrictionSpecies id 0 density 1.9098593 stiffness 200000 dissipation 0 slidingStiffness 57142.857 slidingDissipation 0 slidingFrictionCoefficient 0.5 slidingFrictionCoefficientStatic 0.5\n"
59  "Walls 0\n"
60  "Boundaries 0\n"
61  "Particles 5\n"
62  "BaseParticle id 0 indSpecies 0 position -0.0376743764985181 0 -0.0178234366605382 orientation 0.999395051545515 0 -0.0347783114359788 0 velocity -4.35530922224593 0 -1.99883567233961 angularVelocity 0 -8.259265876579 0 force 0 0 0 torque 0 0 0 radius 0.5 invMass 1.00000000895498\n"
63  "BaseParticle id 1 indSpecies 0 position -0.0178234366605382 0 1.43767437649853 orientation 0.999395051545515 0 -0.0347783114359777 0 velocity -1.99883567233959 0 4.35530922224583 angularVelocity 0 -8.25926587657869 0 force 0 0 0 torque 0 0 0 radius 0.5 invMass 1.00000000895498\n"
64  "BaseParticle id 2 indSpecies 0 position 1.41782343666051 0 -0.0376743764985151 orientation 0.999395051545515 0 -0.0347783114359767 0 velocity 1.99883567233947 0 -4.35530922224564 angularVelocity 0 -8.25926587657844 0 force 0 0 0 torque 0 0 0 radius 0.5 invMass 1.00000000895498\n"
65  "BaseParticle id 3 indSpecies 0 position 1.43767437649853 0 1.41782343666051 orientation 0.999395051545515 0 -0.034778311435975 0 velocity 4.35530922224547 0 1.99883567233942 angularVelocity 0 -8.25926587657801 0 force 0 0 0 torque 0 0 0 radius 0.5 invMass 1.00000000895498\n"
66  "BaseParticle id 4 indSpecies 0 position 0.7 0 0.7 orientation 0.999939404927204 0 0.0110084728199945 0 velocity 5.94120193922054e-13 0 -1.04430653949196e-14 angularVelocity 0 -3.03706350631416 0 force 0 0 0 torque 0 0 0 radius 0.5 invMass 1.00000000895498\n"
67  "Interactions 0"
68  );
69 
70  DPMBase problem;
71  problem.setName("5Particles");
72  problem.readRestartFile();
73  problem.readDataFile("5Particles.ini");
74  problem.setAppend(false);
75  problem.solve();
76 
77  //Now check the rotational energy in the system
78  //gnuplot: p '5Particles.ene' u 1:4
79  return 0;
80 }
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
bool readDataFile(std::string fileName="", unsigned int format=0)
This allows particle data to be reloaded from data files.
Definition: DPMBase.cc:2437
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
void setAppend(bool newAppendFlag)
Sets whether the "append" option is on or off.
Definition: DPMBase.cc:1522
bool readRestartFile(ReadOptions opt=ReadOptions::ReadAll)
Reads all the particle data corresponding to a given, existing . restart file (for more details regar...
Definition: DPMBase.cc:3006
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:58

References DPMBase::readDataFile(), DPMBase::readRestartFile(), DPMBase::setAppend(), DPMBase::setName(), DPMBase::solve(), and helpers::writeToFile().