powerLaw.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 | Copyright (C) 2011-2015 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("one", dimTime, 1.0)*strainRate(),
64  dimensionedScalar("VSMALL", dimless, VSMALL)
65  ),
66  n_.value() - scalar(1.0)
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.subDict(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.subDict(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 // ************************************************************************* //
addToRunTimeSelectionTable(viscosityModel, BirdCarreau, dictionary)
Foam::surfaceFields.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
An abstract base class for incompressible viscosityModels.
A class for handling words, derived from string.
Definition: word.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:638
Namespace for OpenFOAM.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const dimensionSet dimViscosity
bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: powerLaw.C:107
Macros for easy insertion into run-time selection tables.
defineTypeNameAndDebug(BirdCarreau, 0)
powerLaw(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: powerLaw.C:76
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:452
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
Definition: PtrList.H:118