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 -------------------------------------------------------------------------------
11 License
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 
29 #include "eddyViscosity.H"
30 #include "fvc.H"
31 #include "fvm.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 template<class BasicTurbulenceModel>
37 (
38  const word& type,
39  const alphaField& alpha,
40  const rhoField& rho,
41  const volVectorField& U,
42  const surfaceScalarField& alphaRhoPhi,
43  const surfaceScalarField& phi,
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  (
62  IOobject
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 
78 template<class BasicTurbulenceModel>
80 {
82 }
83 
84 
85 template<class BasicTurbulenceModel>
88 {
89  tmp<volScalarField> tk(k());
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  }
106  }
107 
109  (
110  IOobject::groupName("R", this->alphaRhoPhi_.group()),
111  IOobject::NO_REGISTER,
112  ((2.0/3.0)*I)*tk() - (nut_)*devTwoSymm(fvc::grad(this->U_)),
113  patchFieldTypes
114  );
115 }
116 
117 
118 template<class BasicTurbulenceModel>
120 {
121  correctNut();
122 }
123 
124 
125 template<class BasicTurbulenceModel>
127 {
129 }
130 
131 
132 // ************************************************************************* //
type
Types of root.
Definition: Roots.H:52
BasicTurbulenceModel::rhoField rhoField
Definition: RASModel.H:143
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
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:80
BasicTurbulenceModel::transportModel transportModel
Definition: RASModel.H:144
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
constexpr const char *const group
Group name for atomic constants.
const word calculatedType
A calculated patch field type.
virtual bool read()=0
Re-read model coefficients if they have changed.
Definition: eddyViscosity.C:72
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
word timeName
Definition: getTimeIndex.H:3
static const Identity< scalar > I
Definition: Identity.H:100
A class for handling words, derived from Foam::string.
Definition: word.H:63
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/v2406/OpenFOAM-v2406/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=clamp((rho - rholSat)/(rhovSat - rholSat), zero_one{});alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
Definition: pEqn.H:63
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:180
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:30
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:51
BasicTurbulenceModel::alphaField alphaField
Definition: RASModel.H:142
SymmTensor< Cmpt > devTwoSymm(const SymmTensor< Cmpt > &st)
Return the deviatoric part of twice the symmetric part of a SymmTensor.
Definition: SymmTensorI.H:491