laminarModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::laminarModel
28 
29 Description
30  Templated abstract base class for laminar transport models
31 
32 SourceFiles
33  laminarModel.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef laminarModel_H
38 #define laminarModel_H
39 
40 #include "TurbulenceModel.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class laminarModel Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class BasicTurbulenceModel>
52 class laminarModel
53 :
54  public BasicTurbulenceModel
55 {
56 
57 protected:
58 
59  // Protected data
60 
61  //- laminar coefficients dictionary
63 
64  //- Flag to print the model coeffs at run-time
66 
67  //- Model coefficients dictionary
69 
70 
71  // Protected Member Functions
72 
73  //- Print model coefficients
74  virtual void printCoeffs(const word& type);
75 
76  //- No copy construct
77  laminarModel(const laminarModel&) = delete;
78 
79  //- No copy assignment
80  void operator=(const laminarModel&) = delete;
81 
82 
83 public:
84 
85  typedef typename BasicTurbulenceModel::alphaField alphaField;
86  typedef typename BasicTurbulenceModel::rhoField rhoField;
87  typedef typename BasicTurbulenceModel::transportModel transportModel;
88 
89 
90  //- Runtime type information
91  TypeName("laminar");
92 
93 
94  // Declare run-time constructor selection table
95 
97  (
98  autoPtr,
100  dictionary,
101  (
102  const alphaField& alpha,
103  const rhoField& rho,
104  const volVectorField& U,
105  const surfaceScalarField& alphaRhoPhi,
106  const surfaceScalarField& phi,
107  const transportModel& transport,
108  const word& propertiesName
109  ),
110  (alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
111  );
112 
113 
114  // Constructors
115 
116  //- Construct from components
118  (
119  const word& type,
120  const alphaField& alpha,
121  const rhoField& rho,
122  const volVectorField& U,
123  const surfaceScalarField& alphaRhoPhi,
124  const surfaceScalarField& phi,
125  const transportModel& transport,
126  const word& propertiesName
127  );
128 
129 
130  // Selectors
131 
132  //- Return a reference to the selected laminar model
134  (
135  const alphaField& alpha,
136  const rhoField& rho,
137  const volVectorField& U,
138  const surfaceScalarField& alphaRhoPhi,
139  const surfaceScalarField& phi,
140  const transportModel& transport,
141  const word& propertiesName = turbulenceModel::propertiesName
142  );
143 
144 
145  //- Destructor
146  virtual ~laminarModel() = default;
147 
148 
149  // Member Functions
150 
151  //- Read model coefficients if they have changed
152  virtual bool read();
153 
154 
155  // Access
156 
157  //- Const access to the coefficients dictionary
158  virtual const dictionary& coeffDict() const
159  {
160  return coeffDict_;
161  }
162 
163  //- Return the turbulence viscosity, i.e. 0 for laminar flow
164  virtual tmp<volScalarField> nut() const;
165 
166  //- Return the turbulence viscosity on patch
167  virtual tmp<scalarField> nut(const label patchi) const;
168 
169  //- Return the effective viscosity, i.e. the laminar viscosity
170  virtual tmp<volScalarField> nuEff() const;
171 
172  //- Return the effective viscosity on patch
173  virtual tmp<scalarField> nuEff(const label patchi) const;
174 
175  //- Return the turbulence kinetic energy, i.e. 0 for laminar flow
176  virtual tmp<volScalarField> k() const;
177 
178  //- Return the turbulence kinetic energy dissipation rate,
179  // i.e. 0 for laminar flow
180  virtual tmp<volScalarField> epsilon() const;
181 
182  //- Return the Reynolds stress tensor, i.e. 0 for laminar flow
183  virtual tmp<volSymmTensorField> R() const;
184 
185  //- Correct the laminar transport
186  virtual void correct();
187 };
188 
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 } // End namespace Foam
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #ifdef NoRepository
197  #include "laminarModel.C"
198 #endif
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #endif
203 
204 // ************************************************************************* //
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:70
Foam::laminarModel::declareRunTimeSelectionTable
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))
Foam::laminarModel::laminarDict_
dictionary laminarDict_
laminar coefficients dictionary
Definition: laminarModel.H:61
Foam::laminarModel::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: laminarModel.H:84
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::tmp< volScalarField >
Foam::laminarModel::laminarModel
laminarModel(const laminarModel &)=delete
No copy construct.
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::laminarModel::coeffDict
virtual const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: laminarModel.H:157
Foam::turbulenceModel::propertiesName
static const word propertiesName
Default name of the turbulence properties dictionary.
Definition: turbulenceModel.H:100
Foam::laminarModel::~laminarModel
virtual ~laminarModel()=default
Destructor.
rho
rho
Definition: readInitialConditions.H:96
Foam::laminarModel
Templated abstract base class for laminar transport models.
Definition: laminarModel.H:51
laminarModel.C
Foam::label
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:62
Foam::laminarModel::read
virtual bool read()
Read model coefficients if they have changed.
Definition: laminarModel.C:169
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::laminarModel::printCoeffs
virtual void printCoeffs(const word &type)
Print model coefficients.
Definition: laminarModel.C:35
Foam::laminarModel::printCoeffs_
Switch printCoeffs_
Flag to print the model coeffs at run-time.
Definition: laminarModel.H:64
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::laminarModel::coeffDict_
dictionary coeffDict_
Model coefficients dictionary.
Definition: laminarModel.H:67
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::laminarModel::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: laminarModel.H:86
Foam::laminarModel::R
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor, i.e. 0 for laminar flow.
Definition: laminarModel.C:288
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
U
U
Definition: pEqn.H:72
Foam::laminarModel::correct
virtual void correct()
Correct the laminar transport.
Definition: laminarModel.C:308
Foam::laminarModel::k
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy, i.e. 0 for laminar flow.
Definition: laminarModel.C:246
Foam::laminarModel::New
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:86
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
TurbulenceModel.H
Foam::laminarModel::nuEff
virtual tmp< volScalarField > nuEff() const
Return the effective viscosity, i.e. the laminar viscosity.
Definition: laminarModel.C:221
Foam::laminarModel::operator=
void operator=(const laminarModel &)=delete
No copy assignment.
Foam::laminarModel::epsilon
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate,.
Definition: laminarModel.C:267
Foam::laminarModel::TypeName
TypeName("laminar")
Runtime type information.
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::laminarModel::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: laminarModel.H:85
Foam::laminarModel::nut
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity, i.e. 0 for laminar flow.
Definition: laminarModel.C:186