eddyViscosity.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2017 OpenFOAM Foundation
9  Copyright (C) 2019 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 Class
28  Foam::eddyViscosity
29 
30 Group
31  grpTurbulence
32 
33 Description
34  Eddy viscosity turbulence model base class
35 
36 SourceFiles
37  eddyViscosity.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef eddyViscosity_H
42 #define eddyViscosity_H
43 
44 #include "linearViscousStress.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class eddyViscosity Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class BasicTurbulenceModel>
56 class eddyViscosity
57 :
58  public linearViscousStress<BasicTurbulenceModel>
59 {
60 
61 protected:
62 
63  // Protected data
64 
65  // Fields
66 
68 
69 
70  // Protected Member Functions
71 
72  virtual void correctNut() = 0;
73 
74 
75 public:
76 
77  typedef typename BasicTurbulenceModel::alphaField alphaField;
78  typedef typename BasicTurbulenceModel::rhoField rhoField;
79  typedef typename BasicTurbulenceModel::transportModel transportModel;
80 
81 
82  // Constructors
83 
84  //- Construct from components
86  (
87  const word& modelName,
88  const alphaField& alpha,
89  const rhoField& rho,
90  const volVectorField& U,
91  const surfaceScalarField& alphaRhoPhi,
92  const surfaceScalarField& phi,
93  const transportModel& transport,
94  const word& propertiesName
95  );
96 
97 
98  //- Destructor
99  virtual ~eddyViscosity() = default;
100 
101 
102  // Member Functions
103 
104  //- Re-read model coefficients if they have changed
105  virtual bool read() = 0;
106 
107  //- Return the turbulence viscosity
108  virtual tmp<volScalarField> nut() const
109  {
110  return nut_;
111  }
112 
113  //- Return the turbulence viscosity on patch
114  virtual tmp<scalarField> nut(const label patchi) const
115  {
116  return nut_.boundaryField()[patchi];
117  }
118 
119  //- Return the turbulence kinetic energy
120  virtual tmp<volScalarField> k() const = 0;
121 
122  //- Return the Reynolds stress tensor
123  virtual tmp<volSymmTensorField> R() const;
124 
125  //- Validate the turbulence fields after construction
126  // Update turbulence viscosity and other derived fields as requires
127  virtual void validate();
128 
129  //- Solve the turbulence equations and correct the turbulence viscosity
130  virtual void correct() = 0;
131 };
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #ifdef NoRepository
141  #include "eddyViscosity.C"
142 #endif
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #endif
147 
148 // ************************************************************************* //
Foam::eddyViscosity::validate
virtual void validate()
Validate the turbulence fields after construction.
Definition: eddyViscosity.C:127
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::eddyViscosity::nut
virtual tmp< scalarField > nut(const label patchi) const
Return the turbulence viscosity on patch.
Definition: eddyViscosity.H:113
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::eddyViscosity::nut
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity.
Definition: eddyViscosity.H:107
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::eddyViscosity::read
virtual bool read()=0
Re-read model coefficients if they have changed.
Definition: eddyViscosity.C:77
Foam::eddyViscosity::correctNut
virtual void correctNut()=0
rho
rho
Definition: readInitialConditions.H:88
Foam::eddyViscosity::eddyViscosity
eddyViscosity(const word &modelName, const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &propertiesName)
Construct from components.
Definition: eddyViscosity.C:36
Foam::linearViscousStress
Linear viscous stress turbulence model base class.
Definition: linearViscousStress.H:53
eddyViscosity.C
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::eddyViscosity::k
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
Foam::eddyViscosity::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: eddyViscosity.H:78
Foam::RASModel::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: RASModel.H:97
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::RASModel::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: RASModel.H:96
Foam::RASModel::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: RASModel.H:98
U
U
Definition: pEqn.H:72
Foam::eddyViscosity::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: eddyViscosity.H:76
Foam::eddyViscosity::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: eddyViscosity.H:77
Foam::eddyViscosity
Eddy viscosity turbulence model base class.
Definition: eddyViscosity.H:55
Foam::eddyViscosity::correct
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
Definition: eddyViscosity.C:134
Foam::eddyViscosity::nut_
volScalarField nut_
Definition: eddyViscosity.H:66
Foam::eddyViscosity::R
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
Definition: eddyViscosity.C:85
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62
linearViscousStress.H
Foam::eddyViscosity::~eddyViscosity
virtual ~eddyViscosity()=default
Destructor.