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 
24 
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 }
rNew
rNew
Definition: TABSMDCalcMethod2.H:45
rrd
FixedList< scalar, 100 > rrd
Definition: TABSMDCalcMethod2.H:19
probFactorMin
scalar probFactorMin
Definition: TABSMDCalcMethod2.H:21
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
probFactor
scalar probFactor
Definition: TABSMDCalcMethod2.H:23
n
label n
Definition: TABSMDCalcMethod2.H:31
nExp
scalar nExp
Definition: TABSMDCalcMethod2.H:18
random
scalar random
Definition: TABSMDCalcMethod2.H:33
delta
scalar delta
Definition: TABSMDCalcMethod2.H:5
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
maxValue
scalar maxValue
Definition: TABSMDCalcMethod2.H:8
probFactorMax
scalar probFactorMax
Definition: TABSMDCalcMethod2.H:22
found
bool found
Definition: TABSMDCalcMethod2.H:32
minValue
scalar minValue
Definition: TABSMDCalcMethod2.H:7
forAll
forAll(rrd, n)
Definition: TABSMDCalcMethod2.H:25
range
scalar range
Definition: TABSMDCalcMethod2.H:10
rndGen
Random rndGen
Definition: createFields.H:23