eddyViscosity.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2017 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 \*---------------------------------------------------------------------------*/
27 
28 #include "eddyViscosity.H"
29 #include "fvc.H"
30 #include "fvm.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class BasicTurbulenceModel>
36 (
37  const word& type,
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  type,
50  alpha,
51  rho,
52  U,
53  alphaRhoPhi,
54  phi,
55  transport,
56  propertiesName
57  ),
58 
59  nut_
60  (
61  IOobject
62  (
63  IOobject::groupName("nut", alphaRhoPhi.group()),
64  this->runTime_.timeName(),
65  this->mesh_,
66  IOobject::MUST_READ,
67  IOobject::AUTO_WRITE
68  ),
69  this->mesh_
70  )
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
76 template<class BasicTurbulenceModel>
78 {
80 }
81 
82 
83 template<class BasicTurbulenceModel>
86 {
87  tmp<volScalarField> tk(k());
88 
89  // Get list of patchField type names from k
90  wordList patchFieldTypes(tk().boundaryField().types());
91 
92  // For k patchField types which do not have an equivalent for symmTensor
93  // set to calculated
94  forAll(patchFieldTypes, i)
95  {
96  if
97  (
99  ->found(patchFieldTypes[i])
100  )
101  {
103  }
104  }
105 
107  (
109  (
110  IOobject
111  (
112  IOobject::groupName("R", this->alphaRhoPhi_.group()),
113  this->runTime_.timeName(),
114  this->mesh_,
115  IOobject::NO_READ,
116  IOobject::NO_WRITE,
117  false
118  ),
119  ((2.0/3.0)*I)*tk() - (nut_)*dev(twoSymm(fvc::grad(this->U_))),
120  patchFieldTypes
121  )
122  );
123 }
124 
125 
126 template<class BasicTurbulenceModel>
128 {
129  correctNut();
130 }
131 
132 
133 template<class BasicTurbulenceModel>
135 {
137 }
138 
139 
140 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::eddyViscosity::validate
virtual void validate()
Validate the turbulence fields after construction.
Definition: eddyViscosity.C:127
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::eddyViscosity::read
virtual bool read()=0
Re-read model coefficients if they have changed.
Definition: eddyViscosity.C:77
Foam::fac::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:56
rho
rho
Definition: readInitialConditions.H:88
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::blockMeshTools::read
void read(Istream &, label &val, const dictionary &)
In-place read with dictionary lookup.
Definition: blockMeshTools.C:57
eddyViscosity.H
Foam::eddyViscosity::eddyViscosity
eddyViscosity(const word &modelName, const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &propertiesName)
Construct from components.
Definition: eddyViscosity.C:36
Foam::linearViscousStress
Linear viscous stress turbulence model base class.
Definition: linearViscousStress.H:53
correct
fvOptions correct(rho)
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
fvm.H
Foam::RASModel::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: RASModel.H:98
Foam::calculatedFvPatchField
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
Definition: calculatedFvPatchField.H:66
Foam::RASModel::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: RASModel.H:97
found
bool found
Definition: TABSMDCalcMethod2.H:32
Foam::RASModel::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: RASModel.H:99
U
U
Definition: pEqn.H:72
Foam::List< word >
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
Foam::roots::type
type
Types of root.
Definition: Roots.H:54
fvc.H
Foam::eddyViscosity::correct
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
Definition: eddyViscosity.C:134
Foam::eddyViscosity::R
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
Definition: eddyViscosity.C:85
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::twoSymm
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:95
Foam::I
static const Identity< scalar > I
Definition: Identity.H:95
Foam::dev
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:106