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-2026 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& typeDict() const;
64 
65  //- Const access to the coefficients dictionary
66  const dictionary& typeDict(const word&) const;
67 
68 
69 public:
70 
71  typedef typename BasicMomentumTransportModel::alphaField alphaField;
72  typedef typename BasicMomentumTransportModel::rhoField rhoField;
73 
74 
75  //- Runtime type information
76  TypeName("laminar");
77 
78 
79  // Declare run-time constructor selection table
80 
82  (
83  autoPtr,
85  dictionary,
86  (
87  const alphaField& alpha,
88  const rhoField& rho,
89  const volVectorField& U,
90  const surfaceScalarField& alphaRhoPhi,
91  const surfaceScalarField& phi,
92  const viscosity& viscosity
93  ),
94  (alpha, rho, U, alphaRhoPhi, phi, viscosity)
95  );
96 
97 
98  // Constructors
99 
100  //- Construct from components
102  (
103  const word& type,
104  const alphaField& alpha,
105  const rhoField& rho,
106  const volVectorField& U,
107  const surfaceScalarField& alphaRhoPhi,
108  const surfaceScalarField& phi,
109  const viscosity& viscosity
110  );
111 
112  //- Disallow default bitwise copy construction
113  laminarModel(const laminarModel&) = delete;
114 
115 
116  // Selectors
117 
118  //- Return a reference to the selected laminar model
120  (
121  const alphaField& alpha,
122  const rhoField& rho,
123  const volVectorField& U,
124  const surfaceScalarField& alphaRhoPhi,
125  const surfaceScalarField& phi,
126  const viscosity& viscosity
127  );
128 
129 
130  //- Destructor
131  virtual ~laminarModel()
132  {}
133 
134 
135  // Member Functions
136 
137  //- Read model coefficients if they have changed
138  virtual bool read();
139 
140  //- Return the turbulence viscosity, i.e. 0 for laminar flow
141  virtual tmp<volScalarField> nut() const;
142 
143  //- Return the turbulence viscosity on patch
144  virtual tmp<scalarField> nut(const label patchi) const;
145 
146  //- Return the effective viscosity, i.e. the laminar viscosity
147  virtual tmp<volScalarField> nuEff() const = 0;
148 
149  //- Return the effective viscosity on patch
150  virtual tmp<scalarField> nuEff(const label patchi) const = 0;
151 
152  //- Return the Reynolds stress tensor [m^2/s^2], i.e. 0 for laminar flow
153  virtual tmp<volSymmTensorField> R() const;
154 
155  //- Return the turbulence kinetic energy, i.e. 0 for laminar flow
156  virtual tmp<volScalarField> k() const;
157 
158  //- Return the turbulence kinetic energy dissipation rate,
159  // i.e. 0 for laminar flow
160  virtual tmp<volScalarField> epsilon() const;
161 
162  //- Return the turbulence specific dissipation rate,
163  // i.e. 0 for laminar flow
164  virtual tmp<volScalarField> omega() const;
165 
166  //- Predict the laminar viscosity
167  virtual void predict();
168 
169  //- Predict the laminar viscosity
170  virtual void correct();
171 
172 
173  // Member Operators
174 
175  //- Disallow default bitwise assignment
176  void operator=(const laminarModel&) = delete;
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #ifdef NoRepository
187  #include "laminarModel.C"
188 #endif
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
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:70
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate,.
Definition: laminarModel.C:230
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor [m^2/s^2], i.e. 0 for laminar flow.
Definition: laminarModel.C:256
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:275
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy, i.e. 0 for laminar flow.
Definition: laminarModel.C:217
const dictionary & laminarDict() const
Const access to the laminar dictionary.
Definition: laminarModel.C:149
virtual void predict()
Predict the laminar viscosity.
Definition: laminarModel.C:268
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 & typeDict() const
Const access to the coefficients dictionary.
Definition: laminarModel.C:157
TypeName("laminar")
Runtime type information.
virtual ~laminarModel()
Destructor.
Definition: laminarModel.H:130
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:190
virtual tmp< volScalarField > omega() const
Return the turbulence specific dissipation rate,.
Definition: laminarModel.C:243
virtual bool read()
Read model coefficients if they have changed.
Definition: laminarModel.C:175
BasicMomentumTransportModel::rhoField rhoField
Definition: laminarModel.H:71
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:63
label patchi
U
Definition: pEqn.H:72
rho
Definition: pEqn.H:1
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