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

Classes

class  SilbertHstop
 

Functions

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

Variables

fstream ReportFile
 

Function Documentation

◆ HstopCurve()

void HstopCurve ( int  study_num)
136 {
137  Mdouble hStart = 4; //height at which bisection algorithm starts
138  Mdouble aStart = 21; //angle at which bisection algorithm starts
139 
140  Mdouble hMax = 60; //height at which bisection algorithm stops
141  Mdouble dh = 2; //how much I decrease the height after a point is found
142  Mdouble da = .5; // how exact I want the angle to be determined
143  Mdouble daMax = 1; //how much (in absolute) I increase the angle if the chute still stops
144 
145  stringstream name;
146  name << "Report" << study_num;
147  ReportFile.open(name.str().c_str(),fstream::out);
148  ReportFile << "height\tangle\tlambda\tmu\tabovemuBottom\tabove\n";
149 
150  //we start at (aStart,hStart) and find the largest non-flowing angle for hStart
151  //first we search in large steps daMax
152 
153  //find a flowing angle aMax and stopping angle aMin
154  Mdouble aMax = aStart;
155  while(!PointIsAboveCurve(hStart,aMax,study_num)) aMax+=daMax;
156  Mdouble aMin=aMax-daMax;
157  if (aMax==aStart) while(PointIsAboveCurve(hStart,aMin,study_num)) {aMin-=daMax; aMax-=daMax;}
158  //bisect until aMin is highest stopping angle
159  while (aMax-aMin>da*1.99) {
160  Mdouble a=(aMin+aMax)/2;
161  if (PointIsAboveCurve(hStart,a,study_num)) aMax=a;
162  else aMin=a;
163  }
164  //now increase height gradually; decrease angle if flow starts
165  Mdouble a = aMin;
166  for (Mdouble h=hStart+dh; h<hMax; h+=dh) {
167  while (PointIsAboveCurve(h,a,study_num)) a-=da;
168  }
169 
170  ReportFile.close();
171  return;
172 }
double Mdouble
Definition: GeneralDefine.h:34
bool PointIsAboveCurve(Mdouble h, Mdouble a, int study_num)
Definition: hstop.cpp:111
fstream ReportFile
Definition: hstop.cpp:109
std::string name
Definition: MercuryProb.h:48

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

Referenced by main().

◆ main()

int main ( int argc  ,
char argv[] 
)
175 {
176  if (argc>1) HstopCurve(atoi(argv[1]));
177  else exit(-1);
178 }
void HstopCurve(int study_num)
Definition: hstop.cpp:135

References HstopCurve().

◆ PointIsAboveCurve()

bool PointIsAboveCurve ( Mdouble  h,
Mdouble  a,
int  study_num 
)
111  {
112  SilbertHstop problem;
113  problem.setInflowHeight(h) ;
114  problem.setChuteAngle(a);
115  problem.set_study(study_num);
116  stringstream name;
117  name << "H" << problem.getInflowHeight()
118  << "A" << problem.getChuteAngleDegrees()
119  << "L" << round(100.*problem.getFixedParticleRadius()*2.)/100.
120  << "M" << problem.getSlidingFrictionCoefficient()
121  << "B" << problem.getSlidingFrictionCoefficientBottom();
122  problem.setName(name.str().c_str());
123  problem.solve();
124  stringstream com;
125  ReportFile << problem.getInflowHeight()
126  << "\t" << problem.getChuteAngleDegrees()
127  << "\t" << round(100.*problem.getFixedParticleRadius()*2.)/100.
128  << "\t" << problem.getSlidingFrictionCoefficient()
129  << "\t" << problem.getSlidingFrictionCoefficientBottom()
130  << "\t" << problem.pointIsAboveCurve
131  << endl;
132  return problem.pointIsAboveCurve;
133 }
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
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
Definition: hstop_StudyHeightHmaxAngle.cpp:33
double pointIsAboveCurve
Definition: hstop_StudyHeightHmaxAngle.cpp:45
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(), units::name, SilbertHstop::pointIsAboveCurve, ReportFile, helpers::round(), SilbertPeriodic::set_study(), Chute::setChuteAngle(), Chute::setInflowHeight(), DPMBase::setName(), and DPMBase::solve().

Referenced by HstopCurve().

Variable Documentation

◆ ReportFile

fstream ReportFile

Referenced by HstopCurve(), and PointIsAboveCurve().