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[] 
)
48 {
49  //select file name to restart from
51  if (argc > 1)
52  {
53  name = argv[1];
54  argv++;
55  argc--;
56  }
57  else exit(-1);
58  //select time interval
59  Mdouble tint = .2;
60  if (argc > 1)
61  {
62  tint = atof(argv[1]);
63  argv++;
64  argc--;
65  logger(INFO, "tint=%\n", tint, Flusher::NO_FLUSH);
66  }
67  argv--;
68  argc++;
69  logger(INFO, "restart data: %.restart\n", name, Flusher::NO_FLUSH);
70 
71  //load restart data
72  logger(INFO, "XY averaging\n", Flusher::NO_FLUSH);
74  problem.setName(name.c_str());
75  problem.readRestartFile();//load_restart_data();
76  problem.setFixedParticleRadius(problem.particleHandler.getObject(0)->getRadius());
77  problem.setInflowParticleRadius(problem.particleHandler.getObject(0)->getRadius());
78  problem.restartFile.setFileType(FileType::ONE_FILE);//restartFile.setFileType(FileType::ONE_FILE);
79  problem.writeRestartFile();
80  problem.auto_set_domain();
81  //keep file name but create files in the local directory, i.e. remove folder
82  logger(INFO, "old name: %\n", problem.getName(), Flusher::NO_FLUSH);
83  size_t found = name.find_last_of("/\\");
84  problem.setName(name.substr(found + 1).c_str());
85  logger(INFO, "new name: %", problem.getName());
86  //set output to minimum
87  problem.dataFile.setFileType(FileType::NO_FILE);
88  problem.restartFile.setFileType(FileType::NO_FILE);
89  problem.fStatFile.setFileType(FileType::NO_FILE);
90  problem.eneFile.setFileType(FileType::ONE_FILE);
91  //set statistical parameters
92  problem.setDoPeriodicWalls(false);
93  //~ problem.setZMinStat(-1);
94  problem.setN(50);
95  problem.setCGWidth(.1);
96  problem.setSaveCount(25);
97  problem.setStressTypeForFixedParticles(3);
98  problem.setCGTimeMin(problem.getTime());
99  problem.setTimeMax(problem.getTime() + tint);
100  //solve and create live statistics
101  problem.readStatArguments(argc, argv);
102  //~ problem.Chute::write(cout, true);
103  //~ cout << endl << problem.StatisticsVector<XY>::write() << endl;
104  problem.solve();
105 
106  logger(INFO, "\nY averaging\n", Flusher::NO_FLUSH);
108  problemY.setName(name.c_str());
109  problemY.readRestartFile();//load_restart_data();
113  problemY.writeRestartFile();
114  problemY.auto_set_domain();
115  //keep file name but create files in the local directory, i.e. remove folder
116  logger(INFO, "old name: %\n", problemY.getName(), Flusher::NO_FLUSH);
117  std::stringstream ss;
118  ss << name.substr(found + 1).c_str() << "Y";
119  problemY.setName(ss.str().c_str());
120  logger(INFO, "new name: %", problemY.getName());
121  //set output to minimum
126  //set statistical parameters
127  problemY.setDoPeriodicWalls(false);
128  //~ problemY.setZMinStat(-1);
129  problemY.setN(50);
130  problemY.setCGWidth(.1);
131  problemY.setSaveCount(25);
132  problemY.setStressTypeForFixedParticles(3);
133  problemY.setCGTimeMin(problemY.getTime());
134  problemY.setTimeMax(problemY.getTime() + tint);
135  //solve and create live statistics
136  problemY.readStatArguments(argc, argv);
137  //~ problemY.Chute::write(cout, true);
138  //~ cout << endl << problemY.StatisticsVector<Y>::write() << endl;
139  problemY.solve();
140 
141 
142  logger(INFO, "\nX averaging\n", Flusher::NO_FLUSH);
144  problemX.setName(name.c_str());
145  problemX.readRestartFile();//load_restart_data();
149  problemX.writeRestartFile();
150  problemX.auto_set_domain();
151  //keep file name but create files in the local directory, i.e. remove folder
152  logger(INFO, "old name: %\n", problemX.getName(), Flusher::NO_FLUSH);
153  ss << name.substr(found + 1).c_str() << "X";
154  problemX.setName(ss.str().c_str());
155  logger(INFO, "new name: %", problemX.getName());
156  //set output to minimum
161 
162  //problemX.dataFile.setFileType(FileType::NO_FILE);
163  //problemX.restartFile.setFileType(FileType::ONE_FILE);
164  //problemX.fStatFile.setFileType(FileType::NO_FILE);
165  //problemX.eneFile.setFileType(FileType::ONE_FILE);
166  //set statistical parameters
167  problemX.setDoPeriodicWalls(false);
168  //~ problemX.setZMinStat(-1);
169  problemX.setN(50);
170  problemX.setCGWidth(.1);
171  problemX.setSaveCount(25);
172  problemX.setStressTypeForFixedParticles(3);
173  problemX.setCGTimeMin(problemX.getTime());
174  problemX.setTimeMax(problemX.getTime()+tint);
175  //solve and create live statistics
176  problemX.readStatArguments(argc, argv);
177  //~ problemX.Chute::write(cout, true);
178  //~ cout << endl << problemX.StatisticsVector<X>::write() << endl;
179  problemX.solve();
180 
181 }
@ NO_FILE
file will not be created/read
@ ONE_FILE
all data will be written into/ read from a single file called name_
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:621
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:331
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow).
Definition: Chute.cc:827
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom.
Definition: Chute.cc:632
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
File eneFile
An instance of class File to handle in- and output into a .ene file.
Definition: DPMBase.h:1494
File fStatFile
An instance of class File to handle in- and output into a .fstat file.
Definition: DPMBase.h:1489
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: DPMBase.cc:377
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:799
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: DPMBase.h:1484
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: DPMBase.h:1499
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:2979
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
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
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:3043
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:193
void readStatArguments(int argc, char *argv[])
void setN(int n)
Definition: StatisticsVector.h:158
void setStressTypeForFixedParticles(int new_)
Definition: StatisticsVector.h:393
void setCGTimeMin(Mdouble t)
Definition: StatisticsVector.h:202
void setCGWidth(Mdouble w)
Set CG variables w2 and CG_invvolume.
Definition: StatisticsVector.h:296
void setDoPeriodicWalls(bool new_)
Definition: StatisticsVector.h:542
Definition: statXY.cpp:9
void auto_set_domain()
Definition: statXY.cpp:27
#define INFO(i)
Definition: mumps_solver.h:54
bool found
Definition: MergeRestartFiles.py:24
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
string name
Definition: plotDoE.py:33
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213