TurbulenceModel.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-2019 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::TurbulenceModel
26 
27 Description
28  Templated abstract base class for turbulence models
29 
30 SourceFiles
31  TurbulenceModel.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef TurbulenceModel_H
36 #define TurbulenceModel_H
37 
38 #include "turbulenceModel.H"
39 #include "autoPtr.H"
40 #include "runTimeSelectionTables.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class TurbulenceModel Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template
52 <
53  class Alpha,
54  class Rho,
55  class BasicTurbulenceModel,
56  class TransportModel
57 >
58 class TurbulenceModel
59 :
60  public BasicTurbulenceModel
61 {
62 
63 public:
64 
65  typedef Alpha alphaField;
66  typedef Rho rhoField;
67  typedef TransportModel transportModel;
68 
69 
70 protected:
71 
72  // Protected data
73 
74  const alphaField& alpha_;
75  const transportModel& transport_;
76 
77 
78 public:
79 
80  // Declare run-time constructor selection table
81 
83  (
84  autoPtr,
86  dictionary,
87  (
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  (alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
97  );
98 
99 
100  // Constructors
101 
102  //- Construct
104  (
105  const alphaField& alpha,
106  const rhoField& rho,
107  const volVectorField& U,
108  const surfaceScalarField& alphaRhoPhi,
109  const surfaceScalarField& phi,
110  const transportModel& transport,
111  const word& propertiesName
112  );
113 
114  //- Disallow default bitwise copy construction
115  TurbulenceModel(const TurbulenceModel&) = delete;
116 
117 
118  // Selectors
119 
120  //- Return a reference to the selected turbulence model
122  (
123  const alphaField& alpha,
124  const rhoField& rho,
125  const volVectorField& U,
126  const surfaceScalarField& alphaRhoPhi,
127  const surfaceScalarField& phi,
128  const transportModel& transport,
129  const word& propertiesName = turbulenceModel::propertiesName
130  );
131 
132 
133  //- Destructor
134  virtual ~TurbulenceModel()
135  {}
136 
137 
138  // Member Functions
139 
140  //- Access function to phase fraction
141  const alphaField& alpha() const
142  {
143  return alpha_;
144  }
145 
146  //- Access function to incompressible transport model
147  const transportModel& transport() const
148  {
149  return transport_;
150  }
151 
152  //- Return the laminar viscosity
153  virtual tmp<volScalarField> nu() const
154  {
155  return transport_.nu();
156  }
157 
158  //- Return the laminar viscosity on patchi
159  virtual tmp<scalarField> nu(const label patchi) const
160  {
161  return transport_.nu(patchi);
162  }
163 
164 
165  // Member Operators
166 
167  //- Disallow default bitwise assignment
168  void operator=(const TurbulenceModel&) = delete;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #ifdef NoRepository
179  #include "TurbulenceModel.C"
180 #endif
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
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
surfaceScalarField & phi
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
static autoPtr< TurbulenceModel > New(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &propertiesName=turbulenceModel::propertiesName)
Return a reference to the selected turbulence model.
TransportModel transportModel
Templated abstract base class for turbulence models.
const transportModel & transport() const
Access function to incompressible transport model.
void operator=(const TurbulenceModel &)=delete
Disallow default bitwise assignment.
TurbulenceModel(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &propertiesName)
Construct.
const alphaField & alpha_
static const word propertiesName
Default name of the turbulence properties dictionary.
A class for handling words, derived from string.
Definition: word.H:59
const alphaField & alpha() const
Access function to phase fraction.
virtual ~TurbulenceModel()
Destructor.
label patchi
U
Definition: pEqn.H:72
declareRunTimeNewSelectionTable(autoPtr, TurbulenceModel, dictionary,(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &propertiesName),(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName))
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
Definition: PtrList.H:53
const transportModel & transport_
Namespace for OpenFOAM.
virtual tmp< volScalarField > nu() const
Return the laminar viscosity.