eddyViscosity.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-2020 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::eddyViscosity
26 
27 Description
28  Eddy viscosity turbulence model base class
29 
30 SourceFiles
31  eddyViscosity.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef eddyViscosity_H
36 #define eddyViscosity_H
37 
38 #include "linearViscousStress.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class eddyViscosity Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class BasicMomentumTransportModel>
50 class eddyViscosity
51 :
52  public linearViscousStress<BasicMomentumTransportModel>
53 {
54 
55 protected:
56 
57  // Protected data
58 
59  // Fields
60 
62 
63 
64  // Protected Member Functions
65 
66  virtual void correctNut() = 0;
67 
68 
69 public:
70 
71  typedef typename BasicMomentumTransportModel::alphaField alphaField;
72  typedef typename BasicMomentumTransportModel::rhoField rhoField;
73  typedef typename BasicMomentumTransportModel::transportModel transportModel;
74 
75 
76  // Constructors
77 
78  //- Construct from components
80  (
81  const word& modelName,
82  const alphaField& alpha,
83  const rhoField& rho,
84  const volVectorField& U,
85  const surfaceScalarField& alphaRhoPhi,
86  const surfaceScalarField& phi,
87  const transportModel& transport
88  );
89 
90 
91  //- Destructor
92  virtual ~eddyViscosity()
93  {}
94 
95 
96  // Member Functions
97 
98  //- Re-read model coefficients if they have changed
99  virtual bool read() = 0;
100 
101  //- Return the turbulence viscosity
102  virtual tmp<volScalarField> nut() const
103  {
104  return nut_;
105  }
106 
107  //- Return the turbulence viscosity on patch
108  virtual tmp<scalarField> nut(const label patchi) const
109  {
110  return nut_.boundaryField()[patchi];
111  }
112 
113  //- Return the turbulence kinetic energy
114  virtual tmp<volScalarField> k() const = 0;
115 
116  //- Return the Reynolds stress tensor [m^2/s^2]
117  virtual tmp<volSymmTensorField> sigma() const;
118 
119  //- Validate the turbulence fields after construction
120  // Update turbulence viscosity and other derived fields as requires
121  virtual void validate();
122 
123  //- Solve the turbulence equations and correct the turbulence viscosity
124  virtual void correct() = 0;
125 };
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #ifdef NoRepository
135  #include "eddyViscosity.C"
136 #endif
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
virtual tmp< volSymmTensorField > sigma() const
Return the Reynolds stress tensor [m^2/s^2].
Definition: eddyViscosity.C:81
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity.
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Linear viscous stress turbulence model base class.
volScalarField nut_
Definition: eddyViscosity.H:60
Eddy viscosity turbulence model base class.
Definition: eddyViscosity.H:49
BasicMomentumTransportModel::rhoField rhoField
Definition: eddyViscosity.H:71
virtual bool read()=0
Re-read model coefficients if they have changed.
Definition: eddyViscosity.C:73
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
BasicMomentumTransportModel::transportModel transportModel
Definition: eddyViscosity.H:72
A class for handling words, derived from string.
Definition: word.H:59
virtual void correctNut()=0
BasicMomentumTransportModel::alphaField alphaField
Definition: eddyViscosity.H:70
phi
Definition: correctPhi.H:3
virtual ~eddyViscosity()
Destructor.
Definition: eddyViscosity.H:91
label patchi
U
Definition: pEqn.H:72
virtual void validate()
Validate the turbulence fields after construction.
eddyViscosity(const word &modelName, const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport)
Construct from components.
Definition: eddyViscosity.C:34
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.