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-2018 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 "TurbulenceModel.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class laminarModel Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class BasicTurbulenceModel>
50 class laminarModel
51 :
52  public BasicTurbulenceModel
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 private:
76 
77  // Private Member Functions
78 
79  //- Disallow default bitwise copy construct
80  laminarModel(const laminarModel&);
81 
82  //- Disallow default bitwise assignment
83  void operator=(const laminarModel&);
84 
85 
86 public:
87 
88  typedef typename BasicTurbulenceModel::alphaField alphaField;
89  typedef typename BasicTurbulenceModel::rhoField rhoField;
90  typedef typename BasicTurbulenceModel::transportModel transportModel;
91 
92 
93  //- Runtime type information
94  TypeName("laminar");
95 
96 
97  // Declare run-time constructor selection table
98 
100  (
101  autoPtr,
102  laminarModel,
103  dictionary,
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  (alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
114  );
115 
116 
117  // Constructors
118 
119  //- Construct from components
121  (
122  const word& type,
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
130  );
131 
132 
133  // Selectors
134 
135  //- Return a reference to the selected laminar model
137  (
138  const alphaField& alpha,
139  const rhoField& rho,
140  const volVectorField& U,
141  const surfaceScalarField& alphaRhoPhi,
142  const surfaceScalarField& phi,
143  const transportModel& transport,
144  const word& propertiesName = turbulenceModel::propertiesName
145  );
146 
147 
148  //- Destructor
149  virtual ~laminarModel()
150  {}
151 
152 
153  // Member Functions
154 
155  //- Read model coefficients if they have changed
156  virtual bool read();
157 
158 
159  // Access
160 
161  //- Const access to the coefficients dictionary
162  virtual const dictionary& coeffDict() const
163  {
164  return coeffDict_;
165  }
166 
167  //- Return the turbulence viscosity, i.e. 0 for laminar flow
168  virtual tmp<volScalarField> nut() const;
169 
170  //- Return the turbulence viscosity on patch
171  virtual tmp<scalarField> nut(const label patchi) const;
172 
173  //- Return the effective viscosity, i.e. the laminar viscosity
174  virtual tmp<volScalarField> nuEff() const;
175 
176  //- Return the effective viscosity on patch
177  virtual tmp<scalarField> nuEff(const label patchi) const;
178 
179  //- Return the turbulence kinetic energy, i.e. 0 for laminar flow
180  virtual tmp<volScalarField> k() const;
181 
182  //- Return the turbulence kinetic energy dissipation rate,
183  // i.e. 0 for laminar flow
184  virtual tmp<volScalarField> epsilon() const;
185 
186  //- Return the Reynolds stress tensor, i.e. 0 for laminar flow
187  virtual tmp<volSymmTensorField> R() const;
188 
189  //- Correct the laminar transport
190  virtual void correct();
191 };
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #ifdef NoRepository
201  #include "laminarModel.C"
202 #endif
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
Templated abstract base class for laminar transport models.
Definition: laminarModel.H:49
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:137
virtual tmp< volScalarField > nuEff() const
Return the effective viscosity, i.e. the laminar viscosity.
Definition: laminarModel.C:224
virtual ~laminarModel()
Destructor.
Definition: laminarModel.H:148
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
Definition: Switch.H:60
TypeName("laminar")
Runtime type information.
virtual bool read()
Read model coefficients if they have changed.
Definition: laminarModel.C:167
BasicTurbulenceModel::transportModel transportModel
Definition: laminarModel.H:89
static autoPtr< laminarModel > 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 laminar model.
Definition: laminarModel.C:83
dictionary laminarDict_
laminar coefficients dictionary
Definition: laminarModel.H:59
BasicTurbulenceModel::rhoField rhoField
Definition: laminarModel.H:88
declareRunTimeSelectionTable(autoPtr, laminarModel, 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))
BasicTurbulenceModel::alphaField alphaField
Definition: laminarModel.H:87
static const word propertiesName
Default name of the turbulence properties dictionary.
A class for handling words, derived from string.
Definition: word.H:59
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate,.
Definition: laminarModel.C:273
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity, i.e. 0 for laminar flow.
Definition: laminarModel.C:186
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy, i.e. 0 for laminar flow.
Definition: laminarModel.C:249
virtual void printCoeffs(const word &type)
Print model coefficients.
Definition: laminarModel.C:32
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:481
label patchi
U
Definition: pEqn.H:72
virtual void correct()
Correct the laminar transport.
Definition: laminarModel.C:326
Switch printCoeffs_
Flag to print the model coeffs at run-time.
Definition: laminarModel.H:62
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor, i.e. 0 for laminar flow.
Definition: laminarModel.C:300
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
dictionary coeffDict_
Model coefficients dictionary.
Definition: laminarModel.H:65
A class for managing temporary objects.
Definition: PtrList.H:53
virtual const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: laminarModel.H:161
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Namespace for OpenFOAM.