Loading...
Searching...
No Matches
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 Copyright (C) 2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
30#include "fvc.H"
31#include "fvm.H"
32
33// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34
35template<class BasicTurbulenceModel>
37(
38 const word& type,
39 const alphaField& alpha,
40 const rhoField& rho,
41 const volVectorField& U,
42 const surfaceScalarField& alphaRhoPhi,
44 const transportModel& transport,
45 const word& propertiesName
46)
47:
48 linearViscousStress<BasicTurbulenceModel>
49 (
50 type,
51 alpha,
52 rho,
53 U,
54 alphaRhoPhi,
55 phi,
56 transport,
57 propertiesName
58 ),
59
60 nut_
61 (
63 (
64 IOobject::groupName("nut", alphaRhoPhi.group()),
65 this->runTime_.timeName(),
66 this->mesh_,
67 IOobject::MUST_READ,
68 IOobject::AUTO_WRITE,
69 IOobject::REGISTER
70 ),
71 this->mesh_
72 )
73{}
74
75
76// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77
78template<class BasicTurbulenceModel>
81 return BasicTurbulenceModel::read();
83
84
85template<class BasicTurbulenceModel>
88{
90
91 // Get list of patchField type names from k
92 wordList patchFieldTypes(tk().boundaryField().types());
93
94 // For k patchField types which do not have an equivalent for symmTensor
95 // set to calculated
96 forAll(patchFieldTypes, i)
97 {
98 if
99 (
101 ->contains(patchFieldTypes[i])
102 )
103 {
104 patchFieldTypes[i] = fvPatchFieldBase::calculatedType();
105 }
107
109 (
110 IOobject::groupName("R", this->alphaRhoPhi_.group()),
112 ((2.0/3.0)*I)*tk() - (nut_)*devTwoSymm(fvc::grad(this->U_)),
113 patchFieldTypes
114 );
115}
116
117
118template<class BasicTurbulenceModel>
123
124
125template<class BasicTurbulenceModel>
127{
128 BasicTurbulenceModel::correct();
129}
130
131
132// ************************************************************************* //
label k
static tmp< GeometricField< symmTensor, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< symmTensor >::calculatedType())
@ NO_REGISTER
Do not request registration (bool: false).
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
BasicTurbulenceModel::alphaField alphaField
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
BasicTurbulenceModel::rhoField rhoField
virtual void validate()
Validate the turbulence fields after construction.
volScalarField nut_
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.
virtual bool read()=0
Re-read model coefficients if they have changed.
virtual void correctNut()=0
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
BasicTurbulenceModel::transportModel transportModel
static const word & calculatedType() noexcept
The type name for calculated patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
linearViscousStress(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.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
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:47
List< word > wordList
List of word.
Definition fileName.H:60
GeometricField< vector, fvPatchField, volMesh > volVectorField
SymmTensor< Cmpt > devTwoSymm(const SymmTensor< Cmpt > &st)
Return the deviatoric part of twice the symmetric part of a SymmTensor.
static const Identity< scalar > I
Definition Identity.H:100
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
volScalarField & alpha
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299