laminar.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2015 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 \*---------------------------------------------------------------------------*/
25 
26 #include "laminar.H"
27 #include "volFields.H"
28 #include "surfaceFields.H"
29 #include "fvcGrad.H"
30 #include "fvcDiv.H"
31 #include "fvmLaplacian.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 template<class BasicTurbulenceModel>
37 (
38  const alphaField& alpha,
39  const rhoField& rho,
40  const volVectorField& U,
41  const surfaceScalarField& alphaRhoPhi,
42  const surfaceScalarField& phi,
43  const transportModel& transport,
44  const word& propertiesName
45 )
46 :
48  (
49  typeName,
50  alpha,
51  rho,
52  U,
53  alphaRhoPhi,
54  phi,
55  transport,
56  propertiesName
57  )
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
62 
63 template<class BasicTurbulenceModel>
66 (
67  const alphaField& alpha,
68  const rhoField& rho,
69  const volVectorField& U,
70  const surfaceScalarField& alphaRhoPhi,
71  const surfaceScalarField& phi,
72  const transportModel& transport,
73  const word& propertiesName
74 )
75 {
76  return autoPtr<laminar>
77  (
78  new laminar
79  (
80  alpha,
81  rho,
82  U,
83  alphaRhoPhi,
84  phi,
85  transport,
86  propertiesName
87  )
88  );
89 }
90 
91 
92 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
93 
94 template<class BasicTurbulenceModel>
95 const Foam::dictionary&
97 {
98  return dictionary::null;
99 }
100 
101 
102 template<class BasicTurbulenceModel>
104 {
105  return true;
106 }
107 
108 
109 template<class BasicTurbulenceModel>
112 {
113  return tmp<volScalarField>
114  (
115  new volScalarField
116  (
117  IOobject
118  (
119  IOobject::groupName("nut", this->U_.group()),
120  this->runTime_.timeName(),
121  this->mesh_,
122  IOobject::NO_READ,
123  IOobject::NO_WRITE,
124  false
125  ),
126  this->mesh_,
127  dimensionedScalar("nut", dimViscosity, 0.0)
128  )
129  );
130 }
131 
132 
133 template<class BasicTurbulenceModel>
136 (
137  const label patchi
138 ) const
139 {
140  return tmp<scalarField>
141  (
142  new scalarField(this->mesh_.boundary()[patchi].size(), 0.0)
143  );
144 }
145 
146 
147 template<class BasicTurbulenceModel>
150 {
151  return tmp<volScalarField>
152  (
153  new volScalarField
154  (
155  IOobject::groupName("nuEff", this->U_.group()), this->nu()
156  )
157  );
158 }
159 
160 
161 template<class BasicTurbulenceModel>
164 (
165  const label patchi
166 ) const
167 {
168  return this->nu(patchi);
169 }
170 
171 
172 template<class BasicTurbulenceModel>
175 {
176  return tmp<volScalarField>
177  (
178  new volScalarField
179  (
180  IOobject
181  (
182  IOobject::groupName("k", this->U_.group()),
183  this->runTime_.timeName(),
184  this->mesh_,
185  IOobject::NO_READ,
186  IOobject::NO_WRITE,
187  false
188  ),
189  this->mesh_,
190  dimensionedScalar("k", sqr(this->U_.dimensions()), 0.0)
191  )
192  );
193 }
194 
195 
196 template<class BasicTurbulenceModel>
199 {
200  return tmp<volScalarField>
201  (
202  new volScalarField
203  (
204  IOobject
205  (
206  IOobject::groupName("epsilon", this->U_.group()),
207  this->runTime_.timeName(),
208  this->mesh_,
209  IOobject::NO_READ,
210  IOobject::NO_WRITE,
211  false
212  ),
213  this->mesh_,
215  (
216  "epsilon", sqr(this->U_.dimensions())/dimTime, 0.0
217  )
218  )
219  );
220 }
221 
222 
223 template<class BasicTurbulenceModel>
226 {
228  (
230  (
231  IOobject
232  (
233  IOobject::groupName("R", this->U_.group()),
234  this->runTime_.timeName(),
235  this->mesh_,
236  IOobject::NO_READ,
237  IOobject::NO_WRITE,
238  false
239  ),
240  this->mesh_,
242  (
243  "R", sqr(this->U_.dimensions()), symmTensor::zero
244  )
245  )
246  );
247 }
248 
249 
250 template<class BasicTurbulenceModel>
252 {
254 }
255 
256 
257 // ************************************************************************* //
Foam::surfaceFields.
virtual bool read()
Read turbulenceProperties dictionary.
Definition: laminar.C:103
virtual tmp< volScalarField > nuEff() const
Return the effective viscosity, i.e. the laminar viscosity.
Definition: laminar.C:149
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
BasicTurbulenceModel::transportModel transportModel
Definition: laminar.H:58
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(psi *p+alphal *rhol0+((alphav *psiv+alphal *psil)-psi)*pSat, rhoMin);#1"/home/dm2/henry/OpenFOAM/OpenFOAM-3.0.x/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H"1{alphav=max(min((rho-rholSat)/(rhovSat-rholSat), scalar(1)), scalar(0));alphal=1.0-alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
Definition: pEqn.H:74
A class for handling words, derived from string.
Definition: word.H:59
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
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy, i.e. 0 for laminar flow.
Definition: laminar.C:174
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
laminar(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &propertiesName=turbulenceModel::propertiesName)
Construct from components.
Definition: laminar.C:37
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity, i.e. 0 for laminar flow.
Definition: laminar.C:111
Calculate the gradient of the given field.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
virtual const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: laminar.C:96
label patchi
const dimensionSet dimViscosity
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:58
surfaceScalarField & phi
Calculate the matrix for the laplacian of the field.
Calculate the divergence of the given field.
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor, i.e. 0 for laminar flow.
Definition: laminar.C:225
static autoPtr< laminar > 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 turbulence model.
Definition: laminar.C:66
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate,.
Definition: laminar.C:198
volScalarField & nu
Linear viscous stress turbulence model base class.
Turbulence model for laminar flow.
Definition: laminar.H:49
BasicTurbulenceModel::rhoField rhoField
Definition: laminar.H:57
dimensionedSymmTensor sqr(const dimensionedVector &dv)
volScalarField scalarField(fieldObject, mesh)
virtual void correct()
Correct the laminar viscosity.
Definition: laminar.C:251
BasicTurbulenceModel::alphaField alphaField
Definition: laminar.H:56
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
A class for managing temporary objects.
Definition: PtrList.H:118
U
Definition: pEqn.H:82