hstop_StudyHeightHmaxAngle.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 
)
125 {
126  logger(INFO, "restart at study_num=%, h=%, a=%", study_num, h, a);
127 
128  std::stringstream name;
129  name << "Report" << study_num;
130  ReportFile.open(name.str().c_str(),std::fstream::out | std::fstream::app);
131  //~ ReportFile << "height\tangle\tlambda\tmu\tabovemuBottom\tabove\n";
132  bool piac = PointIsAboveCurve(argc,argv,h,a,study_num);
133  ReportFile.close();
134 
135  //now increase height gradually; decrease angle if flow starts
136  if (h<hMax)
137  {
138  if (piac) a -= .5;
139  else h += 2;
140  //write arg file
141  std::stringstream command;
142  command << "echo " << study_num << " " << h << " " << hMax << " " << a << " > arg";
143  logger(INFO, "%", command.str());
144  return system(command.str().c_str());
145  } else {
146  return 0;
147  }
148 }
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.cpp:88
std::fstream ReportFile
Definition: hstop_StudyHeightHmaxAngle.cpp:86
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[] 
)
151 {
152  if (argc < 5)
153  {
154  logger(ERROR, "Please specify Study, Height, max. Height and Angle");
155  }
156  HstopCurve(argc, argv, atoi(argv[1]), atof(argv[2]), atof(argv[3]), atof(argv[4]));
157 }
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.cpp:124

References ERROR, HstopCurve(), and logger.

◆ PointIsAboveCurve()

bool PointIsAboveCurve ( int  argc,
char argv[],
Mdouble  h,
Mdouble  a,
int  study_num 
)
88  {
89  logger(INFO, "PointIsAboveCurve(%, h=%, a=%)", study_num, h, a);
90  SilbertHstop problem;
91  problem.setInflowHeight(h);
92  problem.setChuteAngle(a);
93  problem.set_study(study_num);
94  std::stringstream name;
95  name << "H" << problem.getInflowHeight()
96  << "A" << problem.getChuteAngleDegrees()
97  << "L" << round(100. * problem.getFixedParticleRadius() * 2.) / 100.
98  << "M" << problem.species->getSlidingFrictionCoefficient()
99  << "B" << problem.getSlidingFrictionCoefficientBottom();
100  problem.setName(name.str().c_str());
101  logger(INFO, "starting %", name.str().c_str());
102  problem.writeRestartFile();
103  if ((argc > 5) && (!strcmp(argv[5], "-test")))
104  {
105  // for test runs:
106  problem.solve_analytic();
107  }
108  else
109  {
110  // for real runs:
111  problem.solve();
112  }
113  std::stringstream com;
114  ReportFile << problem.getInflowHeight()
115  << "\t" << problem.getChuteAngleDegrees()
116  << "\t" << round(100.*problem.getFixedParticleRadius()*2.)/100.
117  << "\t" << problem.species->getSlidingFrictionCoefficient()
118  << "\t" << problem.getSlidingFrictionCoefficientBottom()
119  << "\t" << problem.pointIsAboveCurve
120  << std::endl;
121  return problem.pointIsAboveCurve;
122 }
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().