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

Go to the source code of this file.

Functions

int main (int argc UNUSED, char *argv[] UNUSED)
 This code tests if the old restart format can still be read. More...
 

Function Documentation

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

This code tests if the old restart format can still be read.

The resulting simulation should be equivalent to 1Particle4WallsRestartUnitTest.

Definition at line 30 of file 1Particle4WallsOldRestartVersionUnitTest.cpp.

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

31 {
32 
33  helpers::writeToFile("1Particle4WallsOldRestartVersionUnitTest.restart",
34  "restart_version 3\n"
35  "name 1Particle4WallsOldRestartVersionUnitTest\n"
36  "xmin 0 xmax 1 ymin 0 ymax 1.1 zmin 0 zmax 1\n"
37  "dt 0.0001 t 0 tmax 0.01 save_count_data 5 save_count_ene 5 save_count_stat 5 save_count_fstat 5\n"
38  "dim 3 gravity 0 0 0\n"
39  "options_fstat 1 options_data 1 options_ene 1 options_restart 1\n"
40  "Species 2\n"
41  "k 200000 disp 50 kt 57142.857 dispt 0 mu 0.5 rho 1.9098593 dim_particle 3\n"
42  "k 200000 disp 50 kt 57142.857 dispt 0 mu 0.5 rho 1.9098593 dim_particle 3\n"
43  "k 200000 disp 50 kt 57142.857 dispt 0 mu 0.5 (mixed)\n"
44  "Walls 4\n"
45  "numFiniteWalls 0 normal -1 0 0 position 0\n"
46  "numFiniteWalls 0 normal 1 0 0 position .96\n"
47  "numFiniteWalls 0 normal 0 0 -1 position 0\n"
48  "numFiniteWalls 0 normal 0 0 1 position .96\n"
49  "WallsPeriodic 1\n"
50  "normal 0 1 0 pos_left 0 pos_right 1.1 shift 0 1.1 0\n"
51  "Particles 1\n"
52  "0.48 0 0.48 0 0 0 0.5 0 0 0 0 60 0 1 10 0\n"
53  "NUM_BUCKETS 16 HGRID_MAX_LEVELS 1 MIN_CELL_SIZE 1 SPHERE_TO_CELL_RATIO 1 CELL_TO_CELL_RATIO 2\n"
54  "FixedParticleRadius 0.5 MinInflowParticleRadius 0.5 MaxInflowParticleRadius 0.5\n"
55  "RandomizedBottom 2 ChuteAngle 20 max_failed 1 num_created 2000\n"
56  "InflowVelocity 0.1 InflowVelocityVariance 0 InflowHeight 10\n"
57  );
58  DPMBase problem;
59  problem.setName("1Particle4WallsOldRestartVersionUnitTest");
60  problem.readRestartFile();
61  problem.setAppend(false);
62  problem.solve();
63  problem.writeRestartFile();
64 
65  //Now check the rotational energy in the system; it should loose some rotational energy in the first loop due to
66  //sliding, then conserve energy as no tangential dissipation is used.
67  //gnuplot:
68  // p '1Particle4WallsRestartUnitTest_restart.ene' u 1:4 w l t 'rotational energy', '1Particle4WallsRestartUnitTest_restart.ene' u 1:($3+$4+$5-160) w l t 'total energy - normal elastic energy'
69 }
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
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
virtual void writeRestartFile()
Stores all the particle data for current save time step. Calls the write function.
Definition: DPMBase.cc:1365