turbulenceFieldsTemplates.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) 2012-2017 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 "volFields.H"
27 
28 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
29 
30 template<class Type>
32 (
33  const word& fieldName,
35 )
36 {
38 
39  const word scopedName = modelName + ':' + fieldName;
40 
41  if (obr_.foundObject<FieldType>(scopedName))
42  {
43  obr_.lookupObjectRef<FieldType>(scopedName) == tvalue();
44  }
45  else if (obr_.found(scopedName))
46  {
48  << "Cannot store turbulence field " << scopedName
49  << " since an object with that name already exists"
50  << nl << endl;
51  }
52  else
53  {
54  obr_.store
55  (
56  new FieldType
57  (
58  IOobject
59  (
60  scopedName,
61  obr_.time().timeName(),
62  obr_,
63  IOobject::READ_IF_PRESENT,
64  IOobject::NO_WRITE
65  ),
66  tvalue
67  )
68  );
69  }
70 }
71 
72 
73 template<class Model>
76 (
77  const Model& model
78 ) const
79 {
80  const scalar Cmu = 0.09;
81 
82  // Assume k and epsilon are available
83  const volScalarField k(model.k());
84  const volScalarField epsilon(model.epsilon());
85 
86  return tmp<volScalarField>
87  (
88  new volScalarField
89  (
90  IOobject
91  (
92  "omega",
93  k.mesh().time().timeName(),
94  k.mesh()
95  ),
96  epsilon/(Cmu*k),
97  epsilon.boundaryField().types()
98  )
99  );
100 }
101 
102 
103 // ************************************************************************* //
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
Generic GeometricField class.
label k
Boltzmann constant.
tmp< volScalarField > omega(const Model &model) const
Return omega calculated from k and epsilon.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
A class for handling words, derived from string.
Definition: word.H:59
static const char nl
Definition: Ostream.H:262
#define WarningInFunction
Report a warning using Foam::Warning.
void processField(const word &fieldName, const tmp< GeometricField< Type, fvPatchField, volMesh >> &tvalue)
Process the turbulence field.
scalar epsilon
A class for managing temporary objects.
Definition: PtrList.H:53
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92