hstop_StudyHeightHmaxAngle_exponential.cpp File Reference
#include "SilbertPeriodic.h"

Classes

class  SilbertHstop
 

Functions

bool PointIsAboveCurve (int argc, char *argv[], Mdouble h, Mdouble a, int study_num)
 
int HstopCurve (int argc, char *argv[], int study_num, Mdouble h, Mdouble hMax, Mdouble a)
 
int main (int argc, char *argv[])
 

Variables

std::fstream ReportFile
 

Function Documentation

◆ HstopCurve()

int HstopCurve ( int  argc,
char argv[],
int  study_num,
Mdouble  h,
Mdouble  hMax,
Mdouble  a 
)
155 {
156  logger(INFO, "restart at study_num=%, h=%, a=%", study_num, h, a);
157 
158  std::stringstream name;
159  name << "Report" << study_num;
160  ReportFile.open(name.str().c_str(),std::fstream::out | std::fstream::app);
161  //~ ReportFile << "height\tangle\tlambda\tmu\tabovemuBottom\tabove\n";
162  bool piac = PointIsAboveCurve(argc,argv,h,a,study_num);
163  ReportFile.close();
164 
165  //now increase height gradually; decrease angle if flow starts
166  if (h<hMax)
167  {
168  //exponential
169  if (piac) a -= .5;
170  else
171  {
172  h *= pow(2., .25);
173  a += .25;
174  }
175  //linear
176  //if (piac) a-=.5;
177  //else h+=2;
178  //write arg file
179  std::stringstream command;
180  command << "echo " << study_num << " " << h << " " << hMax << " " << a << " > arg";
181  logger(INFO, "%", command.str());
182  return system(command.str().c_str());
183  } else {
184  return 0;
185  }
186 }
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.
bool PointIsAboveCurve(int argc, char *argv[], Mdouble h, Mdouble a, int study_num)
Definition: hstop_StudyHeightHmaxAngle_exponential.cpp:118
std::fstream ReportFile
Definition: hstop_StudyHeightHmaxAngle_exponential.cpp:116
std::string name
Definition: MercuryProb.h:48

References INFO, logger, units::name, PointIsAboveCurve(), and ReportFile.

Referenced by main().

◆ main()

int main ( int argc  ,
char argv[] 
)
189 {
190  if (argc < 4)
191  {
192  logger(ERROR, "Please specify Study, Height, max. Height and Angle");
193  }
194  HstopCurve(argc, argv, atoi(argv[1]), atof(argv[2]), atof(argv[3]), atof(argv[4]));
195 }
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
int HstopCurve(int argc, char *argv[], int study_num, Mdouble h, Mdouble hMax, Mdouble a)
Definition: hstop_StudyHeightHmaxAngle_exponential.cpp:154

References ERROR, HstopCurve(), and logger.

◆ PointIsAboveCurve()

bool PointIsAboveCurve ( int  argc,
char argv[],
Mdouble  h,
Mdouble  a,
int  study_num 
)
118  {
119  logger(INFO, "PointIsAboveCurve(%, h=%, a=%)", study_num, h, a);
120  SilbertHstop problem;
121  problem.setInflowHeight(h);
122  problem.setChuteAngle(a);
123  problem.set_study(study_num);
124  std::stringstream name;
125  name << "H" << problem.getInflowHeight()
126  << "A" << problem.getChuteAngleDegrees()
127  << "L" << round(100. * problem.getFixedParticleRadius() * 2.) / 100.
128  << "M" << problem.species->getSlidingFrictionCoefficient()
129  << "B" << problem.getSlidingFrictionCoefficientBottom();
130  problem.setName(name.str().c_str());
131  logger(INFO, "starting %", name.str().c_str());
132  problem.writeRestartFile();
133  if ((argc > 5) && (!strcmp(argv[5], "-test")))
134  {
135  // for test runs:
136  problem.solve_analytic();
137  }
138  else
139  {
140  // for real runs:
141  problem.solve();
142  }
143  std::stringstream com;
144  ReportFile << problem.getInflowHeight()
145  << "\t" << problem.getChuteAngleDegrees()
146  << "\t" << round(100.*problem.getFixedParticleRadius()*2.)/100.
147  << "\t" << problem.species->getSlidingFrictionCoefficient()
148  << "\t" << problem.getSlidingFrictionCoefficientBottom()
149  << "\t" << problem.pointIsAboveCurve
150  << std::endl;
151  return problem.pointIsAboveCurve;
152 }
Mdouble getFixedParticleRadius() const
Returns the particle radius of the fixed particles which constitute the (rough) chute bottom.
Definition: Chute.cc:671
Mdouble getInflowHeight() const
Returns the maximum inflow height (Z-direction)
Definition: Chute.cc:974
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:768
void setInflowHeight(Mdouble inflowHeight)
Sets maximum inflow height (Z-direction)
Definition: Chute.cc:957
Mdouble getChuteAngleDegrees() const
Returns the chute angle (in degrees)
Definition: Chute.cc:816
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
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
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
Definition: hstop_StudyHeightHmaxAngle.cpp:33
void solve_analytic()
Definition: hstop_StudyHeightHmaxAngle.cpp:76
double pointIsAboveCurve
Definition: hstop_StudyHeightHmaxAngle.cpp:45
LinearViscoelasticSpecies * species
Definition: flowRuleDiego_HeightAngle.cpp:265
Mdouble getSlidingFrictionCoefficientBottom()
Definition: GlasPeriodic.h:81
void set_study(int study_num)
Definition: flowRuleDiego_HeightAngle.cpp:101
Mdouble round(Mdouble value, unsigned int precision)
rounds a floating point number with a given precision
Definition: MathHelpers.cc:28

References Chute::getChuteAngleDegrees(), Chute::getFixedParticleRadius(), Chute::getInflowHeight(), SilbertPeriodic::getSlidingFrictionCoefficientBottom(), INFO, logger, units::name, SilbertHstop::pointIsAboveCurve, ReportFile, helpers::round(), SilbertPeriodic::set_study(), Chute::setChuteAngle(), Chute::setInflowHeight(), DPMBase::setName(), DPMBase::solve(), SilbertHstop::solve_analytic(), SilbertPeriodic::species, and DPMBase::writeRestartFile().

Referenced by HstopCurve().

Variable Documentation

◆ ReportFile

std::fstream ReportFile

Referenced by HstopCurve(), and PointIsAboveCurve().