distributionModel.H 4.21 KB
Newer Older
1 2 3 4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
OpenFOAM bot's avatar
OpenFOAM bot committed
5
    \\  /    A nd           | www.openfoam.com
6
     \\/     M anipulation  |
OpenFOAM bot's avatar
OpenFOAM bot committed
7
-------------------------------------------------------------------------------
OpenFOAM bot's avatar
OpenFOAM bot committed
8
    Copyright (C) 2011-2017 OpenFOAM Foundation
9 10 11 12
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

13 14 15 16
    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.
17 18 19 20 21 22 23

    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
24
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
25 26

Class
27
    Foam::distributionModel
28 29

Description
30
    A library of runtime-selectable distribution models.
31 32 33

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

34
    Current distribution models include:
35
    - exponential
36 37 38
    - fixedValue
    - general
    - multi-normal
39
    - normal
40
    - Rosin-Rammler
41
    - Mass-based Rosin-Rammler
42
    - uniform
43

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

SourceFiles
50 51
    distributionModel.C
    distributionModelNew.C
52 53 54

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

55 56
#ifndef distributionModel_H
#define distributionModel_H
57 58 59

#include "IOdictionary.H"
#include "autoPtr.H"
60
#include "Random.H"
61 62 63 64 65 66 67

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

namespace Foam
{

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

71
class distributionModel
72 73 74 75 76 77
{

protected:

    // Protected data

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

81
        //- Reference to the random number generator
82
        Random& rndGen_;
83 84


85
    // Protected Member Functions
86

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


91 92 93
public:

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


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


    // Constructors

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

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

        //- Construct and return a clone
125
        virtual autoPtr<distributionModel> clone() const = 0;
126 127


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


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


    // Member Functions

142
        //- Sample the distributionModel
143
        virtual scalar sample() const = 0;
144

Andrew Heather's avatar
Andrew Heather committed
145
        //- Return the minimum value
146
        virtual scalar minValue() const = 0;
Andrew Heather's avatar
Andrew Heather committed
147 148

        //- Return the maximum value
149
        virtual scalar maxValue() const = 0;
150 151

        //- Return the maximum value
152
        virtual scalar meanValue() const = 0;
153 154 155 156 157 158 159 160 161 162 163 164
};


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

} // End namespace Foam

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

#endif

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