OUForce.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 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::fv::OUForce
26 
27 Description
28  Calculates and applies the random OU (Ornstein-Uhlenbeck) process force to
29  the momentum equation for direct numerical simulation of boxes of isotropic
30  turbulence.
31 
32  The energy spectrum is calculated and written at write-times which is
33  particularly useful to test and compare LES SGS models.
34 
35 Note
36  This random OU process force uses a FFT to generate the force field which
37  is not currently parallelised. Also the mesh the FFT is applied to must
38  be isotropic and have a power of 2 cells in each direction.
39 
40 Usage
41  Example usage:
42  \verbatim
43  OUForce
44  {
45  type OUForce;
46 
47  libs ("librandomProcesses.so");
48 
49  sigma 0.090295;
50  alpha 0.81532;
51  kUpper 10;
52  kLower 7;
53  }
54  \endverbatim
55 
56 SourceFiles
57  OUForce.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef OUForce_H
62 #define OUForce_H
63 
64 #include "fvModel.H"
65 #include "Kmesh.H"
66 #include "OUprocess.H"
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 namespace fv
73 {
74 
75 /*---------------------------------------------------------------------------*\
76  Class OUForce Declaration
77 \*---------------------------------------------------------------------------*/
78 
79 class OUForce
80 :
81  public fvModel
82 {
83  // Private Data
84 
85  //- Name of the velocity field
86  word UName_;
87 
88  //- The wavenumber mesh used for the random OU process
89  Kmesh K_;
90 
91  //- The random OU process force generator
92  OUprocess forceGen_;
93 
94 
95  // Private Member Functions
96 
97  //- Non-virtual read
98  void readCoeffs();
99 
100 
101 public:
102 
103  //- Runtime type information
104  TypeName("OUForce");
105 
106 
107  // Constructors
108 
109  //- Construct from explicit source name and mesh
110  OUForce
111  (
112  const word& name,
113  const word& modelType,
114  const fvMesh& mesh,
115  const dictionary& dict
116  );
117 
118  //- Disallow default bitwise copy construction
119  OUForce(const OUForce&) = delete;
120 
121 
122  // Member Functions
123 
124  // Checks
125 
126  //- Return the list of fields for which the fvModel adds source term
127  // to the transport equation
128  virtual wordList addSupFields() const;
129 
130 
131  // Evaluate
132 
133  //- Add explicit contribution to incompressible momentum equation
134  virtual void addSup
135  (
136  const volVectorField& field,
137  fvMatrix<vector>& eqn
138  ) const;
139 
140 
141  // Mesh changes
142 
143  //- Update for mesh motion
144  virtual bool movePoints();
145 
146  //- Update topology using the given map
147  virtual void topoChange(const polyTopoChangeMap&);
148 
149  //- Update from another mesh using the given map
150  virtual void mapMesh(const polyMeshMap&);
151 
152  //- Redistribute or update using the given distribution map
153  virtual void distribute(const polyDistributionMap&);
154 
155 
156  // IO
157 
158  //- Read source dictionary
159  virtual bool read(const dictionary& dict);
160 
161  //- Write energy spectrum
162  virtual bool write(const bool write = true) const;
163 
164 
165  // Member Operators
166 
167  //- Disallow default bitwise assignment
168  void operator=(const OUForce&) = delete;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace fv
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
Generic GeometricField class.
Calculate the wavenumber vector field corresponding to the space vector field of a finite volume mesh...
Definition: Kmesh.H:52
Random Ornstein-Uhlenbeck process.
Definition: OUprocess.H:53
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
Calculates and applies the random OU (Ornstein-Uhlenbeck) process force to the momentum equation for ...
Definition: OUForce.H:81
virtual bool movePoints()
Update for mesh motion.
Definition: OUForce.C:113
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: OUForce.C:79
virtual void addSup(const volVectorField &field, fvMatrix< vector > &eqn) const
Add explicit contribution to incompressible momentum equation.
Definition: OUForce.C:86
TypeName("OUForce")
Runtime type information.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: OUForce.C:119
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: OUForce.C:127
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: OUForce.C:131
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: OUForce.C:123
virtual bool write(const bool write=true) const
Write energy spectrum.
Definition: OUForce.C:145
OUForce(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
Definition: OUForce.C:61
void operator=(const OUForce &)=delete
Disallow default bitwise assignment.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict