statXY.cpp File Reference
#include "Chute.h"
#include "StatisticsVector.h"

Classes

class  statistics_while_running< T >
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
69 {
70  //select file name to restart from
71  std::string name;
72  if (argc > 1)
73  {
74  name = argv[1];
75  argv++;
76  argc--;
77  }
78  else exit(-1);
79  //select time interval
80  Mdouble tint = .2;
81  if (argc > 1)
82  {
83  tint = atof(argv[1]);
84  argv++;
85  argc--;
86  logger(INFO, "tint=%\n", tint, Flusher::NO_FLUSH);
87  }
88  argv--;
89  argc++;
90  logger(INFO, "restart data: %.restart\n", name, Flusher::NO_FLUSH);
91 
92  //load restart data
93  logger(INFO, "XY averaging\n", Flusher::NO_FLUSH);
95  problem.setName(name.c_str());
96  problem.readRestartFile();//load_restart_data();
99  problem.restartFile.setFileType(FileType::ONE_FILE);//restartFile.setFileType(FileType::ONE_FILE);
100  problem.writeRestartFile();
101  problem.auto_set_domain();
102  //keep file name but create files in the local directory, i.e. remove folder
103  logger(INFO, "old name: %\n", problem.getName(), Flusher::NO_FLUSH);
104  size_t found = name.find_last_of("/\\");
105  problem.setName(name.substr(found + 1).c_str());
106  logger(INFO, "new name: %", problem.getName());
107  //set output to minimum
112  //set statistical parameters
113  problem.setDoPeriodicWalls(false);
114  //~ problem.setZMinStat(-1);
115  problem.setN(50);
116  problem.setCGWidth(.1);
117  problem.setSaveCount(25);
119  problem.setCGTimeMin(problem.getTime());
120  problem.setTimeMax(problem.getTime() + tint);
121  //solve and create live statistics
122  problem.readStatArguments(argc, argv);
123  //~ problem.Chute::write(cout, true);
124  //~ cout << endl << problem.StatisticsVector<XY>::write() << endl;
125  problem.solve();
126 
127  logger(INFO, "\nY averaging\n", Flusher::NO_FLUSH);
129  problemY.setName(name.c_str());
130  problemY.readRestartFile();//load_restart_data();
134  problemY.writeRestartFile();
135  problemY.auto_set_domain();
136  //keep file name but create files in the local directory, i.e. remove folder
137  logger(INFO, "old name: %\n", problemY.getName(), Flusher::NO_FLUSH);
138  std::stringstream ss;
139  ss << name.substr(found + 1).c_str() << "Y";
140  problemY.setName(ss.str().c_str());
141  logger(INFO, "new name: %", problemY.getName());
142  //set output to minimum
147  //set statistical parameters
148  problemY.setDoPeriodicWalls(false);
149  //~ problemY.setZMinStat(-1);
150  problemY.setN(50);
151  problemY.setCGWidth(.1);
152  problemY.setSaveCount(25);
153  problemY.setStressTypeForFixedParticles(3);
154  problemY.setCGTimeMin(problemY.getTime());
155  problemY.setTimeMax(problemY.getTime() + tint);
156  //solve and create live statistics
157  problemY.readStatArguments(argc, argv);
158  //~ problemY.Chute::write(cout, true);
159  //~ cout << endl << problemY.StatisticsVector<Y>::write() << endl;
160  problemY.solve();
161 
162 
163  logger(INFO, "\nX averaging\n", Flusher::NO_FLUSH);
165  problemX.setName(name.c_str());
166  problemX.readRestartFile();//load_restart_data();
170  problemX.writeRestartFile();
171  problemX.auto_set_domain();
172  //keep file name but create files in the local directory, i.e. remove folder
173  logger(INFO, "old name: %\n", problemX.getName(), Flusher::NO_FLUSH);
174  ss << name.substr(found + 1).c_str() << "X";
175  problemX.setName(ss.str().c_str());
176  logger(INFO, "new name: %", problemX.getName());
177  //set output to minimum
182 
183  //problemX.dataFile.setFileType(FileType::NO_FILE);
184  //problemX.restartFile.setFileType(FileType::ONE_FILE);
185  //problemX.fStatFile.setFileType(FileType::NO_FILE);
186  //problemX.eneFile.setFileType(FileType::ONE_FILE);
187  //set statistical parameters
188  problemX.setDoPeriodicWalls(false);
189  //~ problemX.setZMinStat(-1);
190  problemX.setN(50);
191  problemX.setCGWidth(.1);
192  problemX.setSaveCount(25);
193  problemX.setStressTypeForFixedParticles(3);
194  problemX.setCGTimeMin(problemX.getTime());
195  problemX.setTimeMax(problemX.getTime()+tint);
196  //solve and create live statistics
197  problemX.readStatArguments(argc, argv);
198  //~ problemX.Chute::write(cout, true);
199  //~ cout << endl << problemX.StatisticsVector<X>::write() << endl;
200  problemX.solve();
201 
202 }
@ NO_FILE
file will not be created/read
@ ONE_FILE
all data will be written into/ read from a single file called name_
double Mdouble
Definition: GeneralDefine.h:34
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.
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:348
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow).
Definition: Chute.cc:848
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom.
Definition: Chute.cc:653
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
File eneFile
An instance of class File to handle in- and output into a .ene file.
Definition: DPMBase.h:1488
File fStatFile
An instance of class File to handle in- and output into a .fstat file.
Definition: DPMBase.h:1483
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: DPMBase.cc:399
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:808
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: DPMBase.h:1478
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: DPMBase.h:1493
virtual void writeRestartFile()
Stores all the particle data for current save time step to a "restart" file, which is a file simply i...
Definition: DPMBase.cc:2942
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
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 readRestartFile(ReadOptions opt=ReadOptions::ReadAll)
Reads all the particle data corresponding to a given, existing . restart file (for more details regar...
Definition: DPMBase.cc:3006
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:215
void readStatArguments(int argc, char *argv[])
void setN(int n)
Definition: StatisticsVector.h:179
void setStressTypeForFixedParticles(int new_)
Definition: StatisticsVector.h:414
void setCGTimeMin(Mdouble t)
Definition: StatisticsVector.h:223
void setCGWidth(Mdouble w)
Set CG variables w2 and CG_invvolume.
Definition: StatisticsVector.h:317
void setDoPeriodicWalls(bool new_)
Definition: StatisticsVector.h:563
Definition: statXY.cpp:30
void auto_set_domain()
Definition: statXY.cpp:48
std::string name
Definition: MercuryProb.h:48