distributionModel.H 4.25 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
6
7
8
9
10
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

11
12
13
14
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
15
16
17
18
19
20
21

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
22
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
23
24

Class
25
    Foam::distributionModel
26
27

Description
28
    A library of runtime-selectable distribution models.
29
30
31

    Returns a sampled value given the expectation (nu) and variance (sigma^2)

32
    Current distribution models include:
33
    - exponential
34
35
36
    - fixedValue
    - general
    - multi-normal
37
    - normal
38
39
    - Rosin-Rammler
    - uniform
40

41
42
    The distributionModel is tabulated in equidistant nPoints, in an interval.
    These values are integrated to obtain the cumulated distribution model,
43
    which is then used to change the distribution from unifrom to
44
    the actual distributionModel.
45
46

SourceFiles
47
48
    distributionModel.C
    distributionModelNew.C
49
50
51

\*---------------------------------------------------------------------------*/

52
53
#ifndef distributionModel_H
#define distributionModel_H
54
55
56

#include "IOdictionary.H"
#include "autoPtr.H"
57
#include "cachedRandom.H"
58
59
60
61
62

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
63
namespace distributionModels
64
{
65
66

/*---------------------------------------------------------------------------*\
67
                     Class distributionModel Declaration
68
69
\*---------------------------------------------------------------------------*/

70
class distributionModel
71
72
73
74
75
76
{

protected:

    // Protected data

77
        //- Coefficients dictionary
78
        const dictionary distributionModelDict_;
79

80
        //- Reference to the random number generator
81
        cachedRandom& rndGen_;
82
83


84
    // Protected Member Functions
85

86
        //- Check that the distribution model is valid
87
88
89
        virtual void check() const;


90
91
92
public:

    //-Runtime type information
93
    TypeName("distributionModel");
94
95


Andrew Heather's avatar
Andrew Heather committed
96
97
98
99
    //- Declare runtime constructor selection table
    declareRunTimeSelectionTable
    (
        autoPtr,
100
        distributionModel,
Andrew Heather's avatar
Andrew Heather committed
101
        dictionary,
102
        (
Andrew Heather's avatar
Andrew Heather committed
103
            const dictionary& dict,
104
            cachedRandom& rndGen
Andrew Heather's avatar
Andrew Heather committed
105
106
107
        ),
        (dict, rndGen)
    );
108
109
110
111


    // Constructors

Andrew Heather's avatar
Andrew Heather committed
112
        //- Construct from dictionary
113
114
115
116
117
118
        distributionModel
        (
            const word& name,
            const dictionary& dict,
            cachedRandom& rndGen
        );
119
120

        //- Construct copy
121
        distributionModel(const distributionModel& p);
122
123

        //- Construct and return a clone
124
        virtual autoPtr<distributionModel> clone() const
125
        {
126
            return autoPtr<distributionModel>(new distributionModel(*this));
127
        }
128
129


Andrew Heather's avatar
Andrew Heather committed
130
    //- Selector
131
132
133
134
135
    static autoPtr<distributionModel> New
    (
        const dictionary& dict,
        cachedRandom& rndGen
    );
136
137


Andrew Heather's avatar
Andrew Heather committed
138
    //- Destructor
139
    virtual ~distributionModel();
140
141
142
143


    // Member Functions

144
        //- Sample the distributionModel
145
        virtual scalar sample() const;
146

Andrew Heather's avatar
Andrew Heather committed
147
        //- Return the minimum value
148
        virtual scalar minValue() const;
Andrew Heather's avatar
Andrew Heather committed
149
150

        //- Return the maximum value
151
        virtual scalar maxValue() const;
152
153
154

        //- Return the maximum value
        virtual scalar meanValue() const;
155
156
157
158
159
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

160
} // End namespace distributionModels
161
162
163
164
165
166
167
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //