LISASMDCalcMethod2.H
Go to the documentation of this file.
1 {
2  // calculate the new diameter with the standard 1D Rosin Rammler
3  // distribution. Calculation of the mean radius based on SMR rs.
4  // Coefficient factorGamma depends on nExp. Note that Reitz either used
5  // (Schmidt et al., 1999-01-0496) or skipped (Senecal et al.) this factor!
6  // scalar factorGamma = 0.75*sqrt(mathematicalConstant::pi); // nExp=2
7  scalar factorGamma = 1.;
8  scalar delta = dD/factorGamma;
9 
10  // dD is the SMD, and the delta is calculated using gamma
11  // function. Here we assume nExp = 2
12  scalar minValue = dD/10.0;
13  scalar maxValue = dD;
14 
15  // The pdf value for 4.0*delta is already very small.
16  // scalar maxValue = delta*4.0;
17 
18  if (maxValue - minValue < small)
19  {
20  minValue = maxValue/20.0;
21  }
22 
23  scalar range = maxValue - minValue;
24 
25  scalar nExp = 3;
26  FixedList<scalar, 500> rrd;
27  scalar probFactorMin = exp(-pow(minValue/delta, nExp));
28  scalar probFactorMax = exp(-pow(maxValue/delta, nExp));
29  scalar probFactor = 1.0/(probFactorMin - probFactorMax);
30 
31  forAll(rrd, n)
32  {
33  scalar xx = minValue + range*n/500;
34  rrd[n] = (probFactorMin - exp(-pow(xx/delta, nExp)))*probFactor;
35  }
36 
37 
38  bool success = false;
39 
40  scalar y = rndGen.sample01<scalar>();
41  label k = 0;
42 
43  while(!success && (k<500))
44  {
45  if (rrd[k] > y)
46  {
47  success = true;
48  }
49  k++;
50  }
51 
52  x = minValue + range*(k - 0.5)/500.0;
53 }
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 minValue
scalar probFactorMax
forAll(rrd, n)
Random rndGen(label(0))
dimensionedScalar exp(const dimensionedScalar &ds)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
label n
FixedList< scalar, 500 > rrd