fixedValue.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "fixedValue.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace distributionModels
37 {
38  defineTypeNameAndDebug(fixedValue, 0);
39  addToRunTimeSelectionTable(distributionModel, fixedValue, dictionary);
40 }
41 }
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
46 (
47  const dictionary& dict,
48  Random& rndGen
49 )
50 :
51  distributionModel(typeName, dict, rndGen),
52  value_(distributionModelDict_.get<scalar>("value"))
53 {
54  if (value_ < VSMALL)
55  {
57  << "Fixed value cannot be equal to or less than zero:" << nl
58  << " value = " << value_
59  << exit(FatalError);
60  }
61 }
62 
63 
65 :
67  value_(p.value_)
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
73 Foam::scalar Foam::distributionModels::fixedValue::fixedValue::sample() const
74 {
75  return value_;
76 }
77 
78 
80 {
81  return value_;
82 }
83 
84 
86 {
87  return value_;
88 }
89 
90 
91 Foam::scalar Foam::distributionModels::fixedValue::fixedValue::meanValue() const
92 {
93  return value_;
94 }
95 
96 
97 // ************************************************************************* //
Foam::Random
Random number generator.
Definition: Random.H:59
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::distributionModels::fixedValue
Particle-size distribution model wherein samples are given fixed values.
Definition: fixedValue.H:108
Foam::distributionModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(distributionModel, binned, dictionary)
Foam::distributionModel
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
Definition: distributionModel.H:72
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::distributionModels::defineTypeNameAndDebug
defineTypeNameAndDebug(binned, 0)
Foam::distributionModels::fixedValue::fixedValue
fixedValue(const dictionary &dict, Random &rndGen)
Construct from components.
Definition: fixedValue.C:46
minValue
scalar minValue
Definition: LISASMDCalcMethod2.H:12
rndGen
Random rndGen
Definition: createFields.H:23
fixedValue.H
maxValue
scalar maxValue
Definition: LISASMDCalcMethod1.H:5