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]

94 {
95  //instantiate the class
96  FiveParticles fiveParticles;
97  //set name
98  fiveParticles.setName("FiveParticles");
99 
100  //set output and time stepping properties
101  fiveParticles.setTimeMax(20); //run until the situation is static
102  fiveParticles.setSaveCount(std::numeric_limits<unsigned >::max()); //save only the first and last time step
103  //solve
104  fiveParticles.solve(argc,argv);
105 
106  logger(INFO,"Execute 'source FiveParticles.sh' to get coarse-grained statistics of the last time step");
107  helpers::writeToFile("FiveParticles.sh","../MercuryCG/fstatistics FiveParticles -stattype XZ -w 0.1 -h 0.05 -tmin 1 -tmax 30");
108 
109  logger(INFO,"Run 'FiveParticles.m' in MATLAB/octave to visualise the statistical output");
110  helpers::writeToFile("FiveParticles.m","addpath('../../MercuryCG/')\n"
111  "data = loadstatistics('FiveParticles.stat');\n"
112  "colormap(1-gray)\n"
113  "contourf(data.x,data.z,data.Density,20,'EdgeColor','none')\n"
114  "c = colorbar\n"
115  "c.Label.String = '\\rho';\n"
116  "title('Density')\n"
117  "xlabel('x')\n"
118  "ylabel('z');\n"
119  "axis equal\n"
120  "%%\n"
121  "particles=importdata('FiveParticles.data',' ',12);\n"
122  "x=particles.data(:,1);\n"
123  "z=particles.data(:,3);\n"
124  "r=particles.data(:,7);\n"
125  "a=linspace(0,2*pi,40);\n"
126  "xCircle = sin(a);\n"
127  "zCircle = cos(a);\n"
128  "hold on;\n"
129  "for i=1:length(x)\n"
130  " plot(x(i)+r(i)*xCircle,z(i)+r(i)*zCircle,'Color',.8*[1 1 1])\n"
131  "end\n"
132  "hold off");
133 }
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
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:408
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
[FP:headers]
Definition: FiveParticles.cpp:35
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:58

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