TABSMDCalcMethod2.H
Go to the documentation of this file.
1 {
2  // Calculation of the mean radius based on SMR rs. Coefficient
3  // factorGamma depends on nExp.
4  scalar factorGamma = 1.;
5  scalar delta = rs/factorGamma;
6 
7  scalar minValue = min(d/2.0, 0.04*rs);
8  scalar maxValue = rs*4.0;
9 
10  scalar range = maxValue - minValue;
11 
12  if (maxValue - minValue < small)
13  {
14  minValue = d/20.0;
15  maxValue = d;
16  }
17 
18  scalar nExp = 3.5;
19  FixedList<scalar, 100> rrd;
20 
21  scalar probFactorMin = exp(-pow(minValue/delta, nExp));
22  scalar probFactorMax = exp(-pow(maxValue/delta, nExp));
23  scalar probFactor = 1./(probFactorMin - probFactorMax);
24 
25  forAll(rrd, n)
26  {
27  scalar xx = minValue + range*n/100;
28  rrd[n] = (probFactorMin - exp(-pow(xx/delta, nExp)))*probFactor;
29  }
30 
31  label n = 0;
32  bool found = false;
33  scalar random = rndGen.sample01<scalar>();
34 
35  while (!found && (n<100))
36  {
37  if (rrd[n] > random)
38  {
39  found = true;
40  }
41  n++;
42 
43  }
44 
45  rNew = minValue + range*(n - 0.5)/100.0;
46 }
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
scalar probFactorMax
forAll(rrd, n)
Random rndGen(label(0))
dimensionedScalar exp(const dimensionedScalar &ds)
scalar minValue
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
label n
FixedList< scalar, 100 > rrd