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-------------------------------------------------------------------------------
10License
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
34template<class BasicTurbulenceModel>
36(
37 const word& type,
38 const alphaField& alpha,
39 const rhoField& rho,
40 const volVectorField& U,
41 const surfaceScalarField& alphaRhoPhi,
43 const transportModel& transport,
44 const word& propertiesName
45)
46:
47 linearViscousStress<BasicTurbulenceModel>
48 (
49 type,
50 alpha,
51 rho,
52 U,
53 alphaRhoPhi,
54 phi,
55 transport,
56 propertiesName
57 ),
58
59 nut_
60 (
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
76template<class BasicTurbulenceModel>
78{
79 return BasicTurbulenceModel::read();
80}
81
82
83template<class BasicTurbulenceModel>
86{
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 }
105
107 (
109 (
111 (
112 IOobject::groupName("R", this->alphaRhoPhi_.group()),
113 this->runTime_.timeName(),
114 this->mesh_,
117 false
118 ),
119 ((2.0/3.0)*I)*tk() - (nut_)*dev(twoSymm(fvc::grad(this->U_))),
120 patchFieldTypes
121 )
122 );
123}
124
125
126template<class BasicTurbulenceModel>
128{
129 correctNut();
130}
131
132
133template<class BasicTurbulenceModel>
135{
136 BasicTurbulenceModel::correct();
137}
138
139
140// ************************************************************************* //
label k
bool found
surfaceScalarField & phi
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
Eddy viscosity turbulence model base class.
Definition: eddyViscosity.H:58
BasicTurbulenceModel::alphaField alphaField
Definition: eddyViscosity.H:76
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
Definition: eddyViscosity.C:85
BasicTurbulenceModel::rhoField rhoField
Definition: eddyViscosity.H:77
virtual void validate()
Validate the turbulence fields after construction.
virtual bool read()=0
Re-read model coefficients if they have changed.
Definition: eddyViscosity.C:77
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
BasicTurbulenceModel::transportModel transportModel
Definition: eddyViscosity.H:78
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:82
Linear viscous stress turbulence model base class.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
U
Definition: pEqn.H:72
word timeName
Definition: getTimeIndex.H:3
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:54
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
static const Identity< scalar > I
Definition: Identity.H:94
volScalarField & alpha
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333