FiveParticles.cpp File Reference

Classes

class  FiveParticles
 [FP:headers] More...
 

Functions

int main (int argc, char *argv[])
 [FP:class] More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

[FP:class]

[FP:main]

73 {
74  //instantiate the class
75  FiveParticles fiveParticles;
76  //set name
77  fiveParticles.setName("FiveParticles");
78 
79  //set output and time stepping properties
80  fiveParticles.setTimeMax(20); //run until the situation is static
81  fiveParticles.setSaveCount(std::numeric_limits<unsigned >::max()); //save only the first and last time step
82  //solve
83  fiveParticles.solve(argc,argv);
84 
85  logger(INFO,"Execute 'source FiveParticles.sh' to get coarse-grained statistics of the last time step");
86  helpers::writeToFile("FiveParticles.sh","../MercuryCG/fstatistics FiveParticles -stattype XZ -w 0.1 -h 0.05 -tmin 1 -tmax 30");
87 
88  logger(INFO,"Run 'FiveParticles.m' in MATLAB/octave to visualise the statistical output");
89  helpers::writeToFile("FiveParticles.m","addpath('../../MercuryCG/')\n"
90  "data = loadstatistics('FiveParticles.stat');\n"
91  "colormap(1-gray)\n"
92  "contourf(data.x,data.z,data.Density,20,'EdgeColor','none')\n"
93  "c = colorbar\n"
94  "c.Label.String = '\\rho';\n"
95  "title('Density')\n"
96  "xlabel('x')\n"
97  "ylabel('z');\n"
98  "axis equal\n"
99  "%%\n"
100  "particles=importdata('FiveParticles.data',' ',12);\n"
101  "x=particles.data(:,1);\n"
102  "z=particles.data(:,3);\n"
103  "r=particles.data(:,7);\n"
104  "a=linspace(0,2*pi,40);\n"
105  "xCircle = sin(a);\n"
106  "zCircle = cos(a);\n"
107  "hold on;\n"
108  "for i=1:length(x)\n"
109  " plot(x(i)+r(i)*xCircle,z(i)+r(i)*zCircle,'Color',.8*[1 1 1])\n"
110  "end\n"
111  "hold off");
112 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:864
void solve()
The work horse of the code.
Definition: DPMBase.cc:4334
[FP:headers]
Definition: FiveParticles.cpp:14
#define max(a, b)
Definition: datatypes.h:23
#define INFO(i)
Definition: mumps_solver.h:54
bool writeToFile(const std::string &filename, const std::string &filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:29

References INFO, logger, max, DPMBase::setName(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::solve(), and helpers::writeToFile().