All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
powerLaw.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) 2011-2020 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 
26 #include "powerLaw.H"
28 #include "surfaceFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace viscosityModels
35 {
36  defineTypeNameAndDebug(powerLaw, 0);
37 
39  (
40  viscosityModel,
41  powerLaw,
42  dictionary
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
49 
51 Foam::viscosityModels::powerLaw::calcNu() const
52 {
53  return max
54  (
55  nuMin_,
56  min
57  (
58  nuMax_,
59  k_*pow
60  (
61  max
62  (
63  dimensionedScalar(dimTime, 1.0)*strainRate(),
65  ),
66  n_.value() - scalar(1)
67  )
68  )
69  );
70 }
71 
72 
73 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
74 
76 (
77  const word& name,
78  const dictionary& viscosityProperties,
79  const volVectorField& U,
80  const surfaceScalarField& phi
81 )
82 :
83  viscosityModel(name, viscosityProperties, U, phi),
84  powerLawCoeffs_(viscosityProperties.optionalSubDict(typeName + "Coeffs")),
85  k_("k", dimViscosity, powerLawCoeffs_),
86  n_("n", dimless, powerLawCoeffs_),
87  nuMin_("nuMin", dimViscosity, powerLawCoeffs_),
88  nuMax_("nuMax", dimViscosity, powerLawCoeffs_),
89  nu_
90  (
91  IOobject
92  (
93  name,
94  U_.time().timeName(),
95  U_.db(),
98  ),
99  calcNu()
100  )
101 {}
102 
103 
104 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
105 
107 (
108  const dictionary& viscosityProperties
109 )
110 {
111  viscosityModel::read(viscosityProperties);
112 
113  powerLawCoeffs_ = viscosityProperties.optionalSubDict(typeName + "Coeffs");
114 
115  powerLawCoeffs_.lookup("k") >> k_;
116  powerLawCoeffs_.lookup("n") >> n_;
117  powerLawCoeffs_.lookup("nuMin") >> nuMin_;
118  powerLawCoeffs_.lookup("nuMax") >> nuMax_;
119 
120  return true;
121 }
122 
123 
124 // ************************************************************************* //
Foam::surfaceFields.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const dimensionSet dimViscosity
An abstract base class for incompressible viscosityModels.
Macros for easy insertion into run-time selection tables.
addToRunTimeSelectionTable(viscosityModel, BirdCarreau, dictionary)
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:1001
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
A class for handling words, derived from string.
Definition: word.H:59
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
defineTypeNameAndDebug(BirdCarreau, 0)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
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:92
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: powerLaw.C:107
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:812
powerLaw(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: powerLaw.C:76