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-2022 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 data
58 
59  //- laminar coefficients dictionary
61 
62  //- Flag to print the model coeffs at run-time
64 
65  //- Model coefficients dictionary
67 
68 
69  // Protected Member Functions
70 
71  //- Print model coefficients
72  virtual void printCoeffs(const word& type);
73 
74 
75 public:
76 
77  typedef typename BasicMomentumTransportModel::alphaField alphaField;
78  typedef typename BasicMomentumTransportModel::rhoField rhoField;
79 
80 
81  //- Runtime type information
82  TypeName("laminar");
83 
84 
85  // Declare run-time constructor selection table
86 
88  (
89  autoPtr,
91  dictionary,
92  (
93  const alphaField& alpha,
94  const rhoField& rho,
95  const volVectorField& U,
96  const surfaceScalarField& alphaRhoPhi,
97  const surfaceScalarField& phi,
98  const viscosity& viscosity
99  ),
100  (alpha, rho, U, alphaRhoPhi, phi, viscosity)
101  );
102 
103 
104  // Constructors
105 
106  //- Construct from components
108  (
109  const word& type,
110  const alphaField& alpha,
111  const rhoField& rho,
112  const volVectorField& U,
113  const surfaceScalarField& alphaRhoPhi,
114  const surfaceScalarField& phi,
115  const viscosity& viscosity
116  );
117 
118  //- Disallow default bitwise copy construction
119  laminarModel(const laminarModel&) = delete;
120 
121 
122  // Selectors
123 
124  //- Return a reference to the selected laminar model
126  (
127  const alphaField& alpha,
128  const rhoField& rho,
129  const volVectorField& U,
130  const surfaceScalarField& alphaRhoPhi,
131  const surfaceScalarField& phi,
132  const viscosity& viscosity
133  );
134 
135 
136  //- Destructor
137  virtual ~laminarModel()
138  {}
139 
140 
141  // Member Functions
142 
143  //- Read model coefficients if they have changed
144  virtual bool read();
145 
146  //- Const access to the coefficients dictionary
147  virtual const dictionary& coeffDict() const
148  {
149  return coeffDict_;
150  }
151 
152  //- Return the turbulence viscosity, i.e. 0 for laminar flow
153  virtual tmp<volScalarField> nut() const;
154 
155  //- Return the turbulence viscosity on patch
156  virtual tmp<scalarField> nut(const label patchi) const;
157 
158  //- Return the effective viscosity, i.e. the laminar viscosity
159  virtual tmp<volScalarField> nuEff() const = 0;
160 
161  //- Return the effective viscosity on patch
162  virtual tmp<scalarField> nuEff(const label patchi) const = 0;
163 
164  //- Return the turbulence kinetic energy, i.e. 0 for laminar flow
165  virtual tmp<volScalarField> k() const;
166 
167  //- Return the turbulence kinetic energy dissipation rate,
168  // i.e. 0 for laminar flow
169  virtual tmp<volScalarField> epsilon() const;
170 
171  //- Return the turbulence specific dissipation rate,
172  // i.e. 0 for laminar flow
173  virtual tmp<volScalarField> omega() const;
174 
175  //- Return the stress tensor [m^2/s^2], i.e. 0 for laminar flow
176  virtual tmp<volSymmTensorField> sigma() const;
177 
178  //- Predict the laminar viscosity
179  virtual void predict();
180 
181  //- Predict the laminar viscosity
182  virtual void correct();
183 
184 
185  // Member Operators
186 
187  //- Disallow default bitwise assignment
188  void operator=(const laminarModel&) = delete;
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #ifdef NoRepository
199  #include "laminarModel.C"
200 #endif
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #endif
205 
206 // ************************************************************************* //
Generic GeometricField class.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
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 keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Templated abstract base class for laminar transport models.
Definition: laminarModel.H:52
BasicMomentumTransportModel::alphaField alphaField
Definition: laminarModel.H:76
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate,.
Definition: laminarModel.C:222
dictionary coeffDict_
Model coefficients dictionary.
Definition: laminarModel.H:65
virtual void printCoeffs(const word &type)
Print model coefficients.
Definition: laminarModel.C:33
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:84
virtual const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: laminarModel.H:146
virtual void correct()
Predict the laminar viscosity.
Definition: laminarModel.C:267
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy, i.e. 0 for laminar flow.
Definition: laminarModel.C:209
virtual void predict()
Predict the laminar viscosity.
Definition: laminarModel.C:260
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:48
dictionary laminarDict_
laminar coefficients dictionary
Definition: laminarModel.H:59
TypeName("laminar")
Runtime type information.
virtual ~laminarModel()
Destructor.
Definition: laminarModel.H:136
void operator=(const laminarModel &)=delete
Disallow default bitwise assignment.
virtual tmp< volSymmTensorField > sigma() const
Return the stress tensor [m^2/s^2], i.e. 0 for laminar flow.
Definition: laminarModel.C:248
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:182
virtual tmp< volScalarField > omega() const
Return the turbulence specific dissipation rate,.
Definition: laminarModel.C:235
Switch printCoeffs_
Flag to print the model coeffs at run-time.
Definition: laminarModel.H:62
virtual bool read()
Read model coefficients if they have changed.
Definition: laminarModel.C:163
BasicMomentumTransportModel::rhoField rhoField
Definition: laminarModel.H:77
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