momentumTransportModel.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) 2013-2022 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::momentumTransportModel
26 
27 Description
28  Abstract base class for turbulence models (RAS, LES and laminar).
29 
30 SourceFiles
31  momentumTransportModel.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef momentumTransportModel_H
36 #define momentumTransportModel_H
37 
38 #include "IOdictionary.H"
39 #include "primitiveFieldsFwd.H"
40 #include "volFields.H"
41 #include "surfaceFieldsFwd.H"
42 #include "fvMatricesFwd.H"
43 #include "geometricOneField.H"
44 #include "viscosity.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declarations
52 class fvMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class momentumTransportModel Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public IOdictionary
61 {
62 protected:
63 
64  // Protected data
65 
66  const Time& runTime_;
67  const fvMesh& mesh_;
68 
71  const surfaceScalarField& phi_;
72 
73  const viscosity& viscosity_;
74 
75 
76  // Protected member functions
77 
79  (
80  const objectRegistry& obr,
81  const word& group,
82  bool registerObject = false
83  );
84 
85 
86  template<class MomentumTransportModel>
88  (
89  const typename MomentumTransportModel::alphaField& alpha,
90  const typename MomentumTransportModel::rhoField& rho,
91  const volVectorField& U,
93  const surfaceScalarField& phi,
94  const viscosity& viscosity
95  );
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("momentumTransport");
102 
103 
104  // Constructors
105 
106  //- Construct from components
108  (
109  const volVectorField& U,
111  const surfaceScalarField& phi,
112  const viscosity& viscosity
113  );
114 
115  //- Disallow default bitwise copy construction
117 
118 
119  //- Destructor
120  virtual ~momentumTransportModel()
121  {}
122 
123 
124  // Member Functions
125 
126  //- Read model coefficients if they have changed
127  virtual bool read() = 0;
129  const Time& time() const
130  {
131  return runTime_;
132  }
134  const fvMesh& mesh() const
135  {
136  return mesh_;
137  }
138 
139  //- Const access to the coefficients dictionary
140  virtual const dictionary& coeffDict() const = 0;
141 
142  //- Helper function to return the name of the turbulence G field
143  inline word GName() const
144  {
145  return modelName("G");
146  }
147 
148  //- Access function to velocity field
149  inline const volVectorField& U() const
150  {
151  return U_;
152  }
153 
154  //- Access function to phase flux field
155  inline const surfaceScalarField& alphaRhoPhi() const
156  {
157  return alphaRhoPhi_;
158  }
159 
160  //- Return the volumetric flux field
161  virtual tmp<surfaceScalarField> phi() const;
162 
163  //- Access function to fluid properties
164  const class Foam::viscosity& properties() const
165  {
166  return viscosity_;
167  }
168 
169  //- Return the near wall distance
170  const volScalarField::Boundary& y() const;
171 
172  //- Return the laminar viscosity
173  virtual tmp<volScalarField> nu() const
174  {
175  return this->viscosity_.nu();
176  }
177 
178  //- Return the laminar viscosity on patchi
179  virtual tmp<scalarField> nu(const label patchi) const
180  {
181  return this->viscosity_.nu(patchi);
182  }
183 
184  //- Return the turbulence viscosity
185  virtual tmp<volScalarField> nut() const = 0;
186 
187  //- Return the turbulence viscosity on patch
188  virtual tmp<scalarField> nut(const label patchi) const = 0;
189 
190  //- Return the effective viscosity
191  virtual tmp<volScalarField> nuEff() const = 0;
192 
193  //- Return the effective viscosity on patch
194  virtual tmp<scalarField> nuEff(const label patchi) const = 0;
195 
196  //- Return the turbulence kinetic energy
197  virtual tmp<volScalarField> k() const = 0;
198 
199  //- Return the turbulence kinetic energy dissipation rate
200  virtual tmp<volScalarField> epsilon() const = 0;
201 
202  //- Return the turbulence specific dissipation rate
203  virtual tmp<volScalarField> omega() const = 0;
204 
205  //- Return the stress tensor [m^2/s^2]
206  virtual tmp<volSymmTensorField> sigma() const = 0;
207 
208  //- Validate the turbulence fields after construction
209  // Update derived fields as required
210  virtual void validate();
211 
212  //- Solve the turbulence equations and correct the turbulence viscosity
213  virtual void correct() = 0;
214 
215 
216  // Member Operators
217 
218  //- Disallow default bitwise assignment
219  void operator=(const momentumTransportModel&) = delete;
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
void operator=(const momentumTransportModel &)=delete
Disallow default bitwise assignment.
virtual tmp< volScalarField > nu() const
Return the laminar viscosity.
const surfaceScalarField & alphaRhoPhi_
virtual tmp< volSymmTensorField > sigma() const =0
Return the stress tensor [m^2/s^2].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Templated form of IOobject providing type information for file reading and header type checking...
Definition: IOobject.H:537
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
virtual void validate()
Validate the turbulence fields after construction.
Generic GeometricField class.
word group() const
Return group (extension part of name)
Definition: IOobject.C:324
const volScalarField::Boundary & y() const
Return the near wall distance.
static typeIOobject< IOdictionary > readModelDict(const objectRegistry &obr, const word &group, bool registerObject=false)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
const surfaceScalarField & phi_
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
A class for handling words, derived from string.
Definition: word.H:59
momentumTransportModel(const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity)
Construct from components.
virtual const dictionary & coeffDict() const =0
Const access to the coefficients dictionary.
virtual tmp< volScalarField > nu() const =0
Return the laminar viscosity.
virtual tmp< volScalarField > nut() const =0
Return the turbulence viscosity.
Abstract base class for all fluid physical properties.
Definition: viscosity.H:49
TypeName("momentumTransport")
Runtime type information.
const class Foam::viscosity & properties() const
Access function to fluid properties.
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
Abstract base class for turbulence models (RAS, LES and laminar).
virtual bool read()=0
Read model coefficients if they have changed.
const volVectorField & U() const
Access function to velocity field.
const surfaceScalarField & alphaRhoPhi() const
Access function to phase flux field.
Forward declarations of fvMatrix specialisations.
label patchi
virtual tmp< volScalarField > omega() const =0
Return the turbulence specific dissipation rate.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
virtual ~momentumTransportModel()
Destructor.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
word GName() const
Helper function to return the name of the turbulence G field.
static word modelName(Name name, const word &model)
Return the name of the object within the given model.
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
static autoPtr< MomentumTransportModel > New(const typename MomentumTransportModel::alphaField &alpha, const typename MomentumTransportModel::rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity)
bool & registerObject()
Register object created from this IOobject with registry if true.
Definition: IOobject.H:351
virtual tmp< volScalarField > epsilon() const =0
Return the turbulence kinetic energy dissipation rate.
virtual tmp< volScalarField > nuEff() const =0
Return the effective viscosity.
virtual tmp< surfaceScalarField > phi() const
Return the volumetric flux field.
Namespace for OpenFOAM.