Chain.cpp File Reference

Classes

class  Chain
 

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
78 {
79  Chain chain;
80  chain.setName("Chain");
81  chain.setTimeStep(1e-4);
82  chain.setTimeMax(1);
83  chain.setSaveCount(250);
84  //chain.restartFile.setName("ChainRenamed.restart");
85 
86  //define coarse-graining resolved in z
88  cgZ.setN(20);
89  cgZ.setWidth(0.5);
90  chain.cgHandler.copyAndAddObject(cgZ);
91 
92  chain.solve();
93 
94  logger(INFO,"Execute 'source Chain.sh' to get coarse-grained statistics of the last time step");
95  helpers::writeToFile("Chain.sh","../MercuryCG/fstatistics Chain -stattype XZ -w 0.1 -h 0.05 -tmin 1 -tmax 30 -o Chain.XZ.stat\n"
96  "../MercuryCG/MercuryCG Chain -stattype Z -w 0.1 -h 0.05 -tmin 1 -tmax 30 -o Chain.Z.stat\n"
97  "../MercuryCG/MercuryCG Chain -stattype O -w 0.1 -h 0.05 -tmin 1 -tmax 30 -o Chain.O.stat\n");
98 
99  logger(INFO,"Run 'Chain.m' in MATLAB/octave to visualise the statistical output");
100  helpers::writeToFile("Chain.m","addpath('../MercuryCG/')\n"
101  "data = loadstatistics('Chain.XZ.stat');\n"
102  "colormap(1-gray)\n"
103  "contourf(data.x,data.z,data.Density,20,'EdgeColor','none')\n"
104  "c = colorbar\n"
105  "c.Label.String = '\\rho';\n"
106  "title('Density')\n"
107  "xlabel('x')\n"
108  "ylabel('z');\n"
109  "axis equal\n"
110  "%%\n"
111  "particles=importdata('Chain.data',' ',12);\n"
112  "z=particles.data(:,3);\n"
113  "r=particles.data(:,7);\n"
114  "a=linspace(0,2*pi,40);\n"
115  "xCircle = sin(a);\n"
116  "zCircle = cos(a);\n"
117  "hold on;\n"
118  "for i=1:length(x)\n"
119  " plot(x(i)+r(i)*xCircle,z(i)+r(i)*zCircle,'Color',.8*[1 1 1])\n"
120  "end\n"
121  "hold off");
122  return 0;
123 }
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 setN(std::size_t n)
Sets nX_, nY_, nZ_, the number of spatial mesh points in each cartesian direction.
Definition: BaseCG.cc:132
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:379
Evaluates time-resolved continuum fields and writes the data into a stat file.
Definition: CG.h:76
void setWidth(Mdouble width) override
Definition: CG.h:220
Definition: CGSelectRegionSelfTest.cpp:34
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
CGHandler cgHandler
Object of the class cgHandler.
Definition: DPMBase.h:1473
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1234
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
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:58

References DPMBase::cgHandler, BaseHandler< T >::copyAndAddObject(), INFO, logger, BaseCG::setN(), DPMBase::setName(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), CG< Coordinates, BaseFunction, Fields >::setWidth(), DPMBase::solve(), and helpers::writeToFile().