MercuryDPM  0.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
5ParticlesRestartUnitTest.cpp File Reference
#include "DPMBase.h"
#include "Math/Helpers.h"

Go to the source code of this file.

Functions

int main (int argc UNUSED, char *argv[] UNUSED)
 In this file, 5 Particles (4 fixed) are loaded from files "5Particles.ini" and "5Particles.restart". More...
 

Function Documentation

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.

Definition at line 34 of file 5ParticlesRestartUnitTest.cpp.

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

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  "restart_version 1.0 name 1Particle4WallsRestartUnitTest_restart\n"
48  "dataFile name 1Particle4WallsRestartUnitTest_restart.data fileType ONE_FILE saveCount 5 counter 0 nextSavedTimeStep 0\n"
49  "fStatFile name 1Particle4WallsRestartUnitTest_restart.fstat fileType ONE_FILE saveCount 5 counter 0 nextSavedTimeStep 0\n"
50  "eneFile name 1Particle4WallsRestartUnitTest_restart.ene fileType ONE_FILE saveCount 1 counter 0 nextSavedTimeStep 0\n"
51  "restartFile name 1Particle4WallsRestartUnitTest_restart.restart fileType ONE_FILE saveCount 5 counter 0 nextSavedTimeStep 0\n"
52  "statFile name 1Particle4WallsRestartUnitTest_restart.stat fileType ONE_FILE saveCount 5 counter 0 nextSavedTimeStep 0\n"
53  "xMin 0 xMax 1.6 yMin 0 yMax 1 zMin 0 zMax 1.6\n"
54  "timeStep 1e-05 time 0 ntimeSteps 0 timeMax 0.01\n"
55  "systemDimensions 3 particleDimensions 3 gravity 0 0 0\n"
56  "Species 1\n"
57  "LinearViscoelasticSlidingFrictionSpecies id 0 rho 1.9098593 k 200000 disp 0 slidingStiffness 57142.857 slidingDissipation 0 frictionCoefficient 0.5 frictionCoefficientStatic 0.5\n"
58  "Walls 0\n"
59  "WallsPeriodic 0\n"
60  "Particles 5\n"
61  "BP 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0\n"
62  "BP 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0\n"
63  "BP 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0\n"
64  "BP 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0\n"
65  "BP 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0\n"
66  "Interactions 0\n"
67  );
68 
69  DPMBase problem;
70  problem.setName("5Particles");
71  problem.readRestartFile();
72  problem.readDataFile("5Particles.ini");
73  problem.setAppend(false);
74  problem.solve();
75 
76  //Now check the rotational energy in the system
77  //gnuplot: p '5Particles_restart.ene' u 1:4
78 }
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: Helpers.cc:411
void solve()
The work horse of the code.
Definition: DPMBase.cc:1895
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:61
bool readDataFile(const std::string fileName, unsigned int format=0)
This allows particle data to be reloaded from data files.
Definition: DPMBase.cc:989
void setAppend(bool newAppendFlag)
Allows to set the append option.
Definition: DPMBase.cc:544
int readRestartFile()
Reads all the particle data corresponding to the current saved time step. Which is what the restart f...
Definition: DPMBase.cc:1375
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: Files.cc:149