Chain.cpp File Reference

Classes

class  Chain
 

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
57 {
58  Chain chain;
59  chain.setName("Chain");
60  chain.setTimeStep(1e-4);
61  chain.setTimeMax(1);
62  chain.setSaveCount(250);
63  //chain.restartFile.setName("ChainRenamed.restart");
64 
65  //define coarse-graining resolved in z
67  cgZ.setN(20);
68  cgZ.setWidth(0.5);
69  chain.cgHandler.copyAndAddObject(cgZ);
70 
71  chain.solve();
72 
73  logger(INFO,"Execute 'source Chain.sh' to get coarse-grained statistics of the last time step");
74  helpers::writeToFile("Chain.sh","../MercuryCG/fstatistics Chain -stattype XZ -w 0.1 -h 0.05 -tmin 1 -tmax 30 -o Chain.XZ.stat\n"
75  "../MercuryCG/MercuryCG Chain -stattype Z -w 0.1 -h 0.05 -tmin 1 -tmax 30 -o Chain.Z.stat\n"
76  "../MercuryCG/MercuryCG Chain -stattype O -w 0.1 -h 0.05 -tmin 1 -tmax 30 -o Chain.O.stat\n");
77 
78  logger(INFO,"Run 'Chain.m' in MATLAB/octave to visualise the statistical output");
79  helpers::writeToFile("Chain.m","addpath('../MercuryCG/')\n"
80  "data = loadstatistics('Chain.XZ.stat');\n"
81  "colormap(1-gray)\n"
82  "contourf(data.x,data.z,data.Density,20,'EdgeColor','none')\n"
83  "c = colorbar\n"
84  "c.Label.String = '\\rho';\n"
85  "title('Density')\n"
86  "xlabel('x')\n"
87  "ylabel('z');\n"
88  "axis equal\n"
89  "%%\n"
90  "particles=importdata('Chain.data',' ',12);\n"
91  "z=particles.data(:,3);\n"
92  "r=particles.data(:,7);\n"
93  "a=linspace(0,2*pi,40);\n"
94  "xCircle = sin(a);\n"
95  "zCircle = cos(a);\n"
96  "hold on;\n"
97  "for i=1:length(x)\n"
98  " plot(x(i)+r(i)*xCircle,z(i)+r(i)*zCircle,'Color',.8*[1 1 1])\n"
99  "end\n"
100  "hold off");
101  return 0;
102 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
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:111
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:360
Evaluates time-resolved continuum fields and writes the data into a stat file.
Definition: CG.h:55
void setWidth(Mdouble width) override
Definition: CG.h:199
Definition: CGSelectRegionSelfTest.cpp:13
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
CGHandler cgHandler
Object of the class cgHandler.
Definition: DPMBase.h:1479
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
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
#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 DPMBase::cgHandler, BaseHandler< T >::copyAndAddObject(), e(), INFO, logger, BaseCG::setN(), DPMBase::setName(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), CG< Coordinates, BaseFunction, Fields >::setWidth(), DPMBase::solve(), and helpers::writeToFile().