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 :
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  (
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 
106  return tmp<volSymmTensorField>
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 // ************************************************************************* //
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:88
type
Types of root.
Definition: Roots.H:52
BasicTurbulenceModel::rhoField rhoField
Definition: RASModel.H:143
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Linear viscous stress turbulence model base class.
label k
Boltzmann constant.
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
Definition: eddyViscosity.C:78
BasicTurbulenceModel::transportModel transportModel
Definition: RASModel.H:144
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:413
constexpr const char *const group
Group name for atomic constants.
virtual bool read()=0
Re-read model coefficients if they have changed.
Definition: eddyViscosity.C:70
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
word timeName
Definition: getTimeIndex.H:3
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
static const Identity< scalar > I
Definition: Identity.H:100
A class for handling words, derived from Foam::string.
Definition: word.H:63
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
void read(Istream &, label &val, const dictionary &)
In-place read with dictionary lookup.
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/chef2/andy/OpenFOAM/release/v2212/OpenFOAM-v2212/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:72
U
Definition: pEqn.H:72
virtual void validate()
Validate the turbulence fields after construction.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:166
bool found
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:29
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:49
BasicTurbulenceModel::alphaField alphaField
Definition: RASModel.H:142