strainRateViscosityModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "fvcGrad.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace laminarModels
34 {
35 namespace generalisedNewtonianViscosityModels
36 {
37  defineTypeNameAndDebug(strainRateViscosityModel, 0);
38 }
39 }
40 }
41 
42 
43 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
44 
48 {
49  return sqrt(2.0)*mag(symm(fvc::grad(U_)));
50 }
51 
52 
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 
57 (
58  const dictionary& viscosityProperties,
59  const viscosity& viscosity,
60  const volVectorField& U
61 )
62 :
63  generalisedNewtonianViscosityModel(viscosityProperties, viscosity, U),
64  nu_
65  (
66  IOobject
67  (
69  (
70  IOobject::modelName("nu", typeName),
71  U.group()
72  ),
73  U.time().timeName(),
74  U.mesh(),
77  ),
78  U.mesh(),
80  )
81 {}
82 
83 
84 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
85 
88 {
89  nu_ = nu(viscosity_.nu(), strainRate());
90 }
91 
92 
93 // ************************************************************************* //
const dimensionSet dimViscosity
static word group(const word &name)
Return group (extension part of name)
Definition: IOobject.C:134
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
strainRateViscosityModel(const dictionary &viscosityProperties, const viscosity &viscosity, const volVectorField &U)
Construct from components.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
dimensionedScalar sqrt(const dimensionedScalar &ds)
virtual tmp< volScalarField > strainRate() const
Return the strain-rate obtained from the velocity field.
Calculate the gradient of the given field.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
Definition: Time.C:666
static word groupName(Name name, const word &group)
const Mesh & mesh() const
Return mesh.
An abstract base class for generalised Newtonian viscosity models.
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const Time & time() const
Return time.
Definition: IOobject.C:318
dimensioned< scalar > mag(const dimensioned< Type > &)
static word modelName(Name name, const word &model)
Return the name of the object within the given model.
A class for managing temporary objects.
Definition: PtrList.H:53
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
Namespace for OpenFOAM.