randomise.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  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::functionObjects::randomise
26 
27 Group
28  grpFieldFunctionObjects
29 
30 Description
31  This function object adds a random component to a field,
32  with a specified perturbation magnitude.
33 
34  The operation can be applied to any volume field.
35 
36 See also
37  Foam::functionObjects::fvMeshFunctionObject
38 
39 SourceFiles
40  randomise.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef functionObjects_randomise_H
45 #define functionObjects_randomise_H
46 
47 #include "fieldExpression.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 namespace functionObjects
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class randomise Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class randomise
61 :
62  public fieldExpression
63 {
64  // Private member data
65 
66  //- The magnitude of the purturbation
67  scalar magPerturbation_;
68 
69 
70  // Private Member Functions
71 
72  //- Calculate the randomisenitude of the field and register the result
73  template<class Type>
74  bool calcRandomised();
75 
76  //- Calculate the randomised field and return true if successful
77  virtual bool calc();
78 
79 
80 public:
81 
82  //- Runtime type information
83  TypeName("randomise");
84 
85 
86  // Constructors
87 
88  //- Construct from Time and dictionary
89  randomise
90  (
91  const word& name,
92  const Time& runTime,
93  const dictionary& dict
94  );
95 
96 
97  //- Destructor
98  virtual ~randomise();
99 
100 
101  // Member Functions
102 
103  //- Read the randomise data
104  virtual bool read(const dictionary&);
105 };
106 
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 } // End namespace functionObjects
111 } // End namespace Foam
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 #ifdef NoRepository
116  #include "randomiseTemplates.C"
117 #endif
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #endif
122 
123 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
TypeName("randomise")
Runtime type information.
const word & name() const
Return the name of this functionObject.
A class for handling words, derived from string.
Definition: word.H:59
virtual bool read(const dictionary &)
Read the randomise data.
Definition: randomise.C:80
randomise(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: randomise.C:60
virtual ~randomise()
Destructor.
Definition: randomise.C:74
This function object adds a random component to a field, with a specified perturbation magnitude...
Definition: randomise.H:59
Namespace for OpenFOAM.