laminarModel.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) 2016-2024 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::laminarModel
26 
27 Description
28  Templated abstract base class for laminar transport models
29 
30 SourceFiles
31  laminarModel.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef laminarModel_H
36 #define laminarModel_H
37 
38 #include "momentumTransportModel.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class laminarModel Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class BasicMomentumTransportModel>
50 class laminarModel
51 :
52  public BasicMomentumTransportModel
53 {
54 
55 protected:
56 
57  // Protected member functions
58 
59  //- Const access to the laminar dictionary
60  const dictionary& laminarDict() const;
61 
62  //- Const access to the coefficients dictionary
63  const dictionary& coeffDict() const;
64 
65 
66 public:
67 
68  typedef typename BasicMomentumTransportModel::alphaField alphaField;
69  typedef typename BasicMomentumTransportModel::rhoField rhoField;
70 
71 
72  //- Runtime type information
73  TypeName("laminar");
74 
75 
76  // Declare run-time constructor selection table
77 
79  (
80  autoPtr,
82  dictionary,
83  (
84  const alphaField& alpha,
85  const rhoField& rho,
86  const volVectorField& U,
87  const surfaceScalarField& alphaRhoPhi,
88  const surfaceScalarField& phi,
89  const viscosity& viscosity
90  ),
91  (alpha, rho, U, alphaRhoPhi, phi, viscosity)
92  );
93 
94 
95  // Constructors
96 
97  //- Construct from components
99  (
100  const word& type,
101  const alphaField& alpha,
102  const rhoField& rho,
103  const volVectorField& U,
104  const surfaceScalarField& alphaRhoPhi,
105  const surfaceScalarField& phi,
106  const viscosity& viscosity
107  );
108 
109  //- Disallow default bitwise copy construction
110  laminarModel(const laminarModel&) = delete;
111 
112 
113  // Selectors
114 
115  //- Return a reference to the selected laminar model
117  (
118  const alphaField& alpha,
119  const rhoField& rho,
120  const volVectorField& U,
121  const surfaceScalarField& alphaRhoPhi,
122  const surfaceScalarField& phi,
123  const viscosity& viscosity
124  );
125 
126 
127  //- Destructor
128  virtual ~laminarModel()
129  {}
130 
131 
132  // Member Functions
133 
134  //- Read model coefficients if they have changed
135  virtual bool read();
136 
137  //- Return the turbulence viscosity, i.e. 0 for laminar flow
138  virtual tmp<volScalarField> nut() const;
139 
140  //- Return the turbulence viscosity on patch
141  virtual tmp<scalarField> nut(const label patchi) const;
142 
143  //- Return the effective viscosity, i.e. the laminar viscosity
144  virtual tmp<volScalarField> nuEff() const = 0;
145 
146  //- Return the effective viscosity on patch
147  virtual tmp<scalarField> nuEff(const label patchi) const = 0;
148 
149  //- Return the Reynolds stress tensor [m^2/s^2], i.e. 0 for laminar flow
150  virtual tmp<volSymmTensorField> R() const;
151 
152  //- Return the turbulence kinetic energy, i.e. 0 for laminar flow
153  virtual tmp<volScalarField> k() const;
154 
155  //- Return the turbulence kinetic energy dissipation rate,
156  // i.e. 0 for laminar flow
157  virtual tmp<volScalarField> epsilon() const;
158 
159  //- Return the turbulence specific dissipation rate,
160  // i.e. 0 for laminar flow
161  virtual tmp<volScalarField> omega() const;
162 
163  //- Predict the laminar viscosity
164  virtual void predict();
165 
166  //- Predict the laminar viscosity
167  virtual void correct();
168 
169 
170  // Member Operators
171 
172  //- Disallow default bitwise assignment
173  void operator=(const laminarModel&) = delete;
174 };
175 
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #ifdef NoRepository
184  #include "laminarModel.C"
185 #endif
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Templated abstract base class for laminar transport models.
Definition: laminarModel.H:52
BasicMomentumTransportModel::alphaField alphaField
Definition: laminarModel.H:67
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate,.
Definition: laminarModel.C:229
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor [m^2/s^2], i.e. 0 for laminar flow.
Definition: laminarModel.C:255
static autoPtr< laminarModel > New(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity)
Return a reference to the selected laminar model.
Definition: laminarModel.C:65
virtual void correct()
Predict the laminar viscosity.
Definition: laminarModel.C:274
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy, i.e. 0 for laminar flow.
Definition: laminarModel.C:216
const dictionary & laminarDict() const
Const access to the laminar dictionary.
Definition: laminarModel.C:159
virtual void predict()
Predict the laminar viscosity.
Definition: laminarModel.C:267
declareRunTimeSelectionTable(autoPtr, laminarModel, dictionary,(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity),(alpha, rho, U, alphaRhoPhi, phi, viscosity))
laminarModel(const word &type, const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity)
Construct from components.
Definition: laminarModel.C:33
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: laminarModel.C:167
TypeName("laminar")
Runtime type information.
virtual ~laminarModel()
Destructor.
Definition: laminarModel.H:127
void operator=(const laminarModel &)=delete
Disallow default bitwise assignment.
virtual tmp< volScalarField > nuEff() const =0
Return the effective viscosity, i.e. the laminar viscosity.
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity, i.e. 0 for laminar flow.
Definition: laminarModel.C:189
virtual tmp< volScalarField > omega() const
Return the turbulence specific dissipation rate,.
Definition: laminarModel.C:242
virtual bool read()
Read model coefficients if they have changed.
Definition: laminarModel.C:174
BasicMomentumTransportModel::rhoField rhoField
Definition: laminarModel.H:68
A class for managing temporary objects.
Definition: tmp.H:55
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
A class for handling words, derived from string.
Definition: word.H:62
label patchi
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
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
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488