BirdCarreau.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-2018 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 "BirdCarreau.H"
28 #include "surfaceFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace viscosityModels
35 {
38  (
42  );
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
48 
50 Foam::viscosityModels::BirdCarreau::calcNu() const
51 {
52  return
53  nuInf_
54  + (nu0_ - nuInf_)
55  *pow(scalar(1) + pow(k_*strainRate(), a_), (n_ - 1.0)/a_);
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
60 
62 (
63  const word& name,
64  const dictionary& viscosityProperties,
65  const volVectorField& U,
66  const surfaceScalarField& phi
67 )
68 :
69  viscosityModel(name, viscosityProperties, U, phi),
70  BirdCarreauCoeffs_
71  (
72  viscosityProperties.optionalSubDict(typeName + "Coeffs")
73  ),
74  nu0_("nu0", dimViscosity, BirdCarreauCoeffs_),
75  nuInf_("nuInf", dimViscosity, BirdCarreauCoeffs_),
76  k_("k", dimTime, BirdCarreauCoeffs_),
77  n_("n", dimless, BirdCarreauCoeffs_),
78  a_
79  (
80  BirdCarreauCoeffs_.lookupOrDefault
81  (
82  "a",
83  dimensionedScalar("a", dimless, 2)
84  )
85  ),
86  nu_
87  (
88  IOobject
89  (
90  "nu",
91  U_.time().timeName(),
92  U_.db(),
95  ),
96  calcNu()
97  )
98 {}
99 
100 
101 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
102 
104 (
105  const dictionary& viscosityProperties
106 )
107 {
108  viscosityModel::read(viscosityProperties);
109 
110  BirdCarreauCoeffs_ =
111  viscosityProperties.optionalSubDict(typeName + "Coeffs");
112 
113  BirdCarreauCoeffs_.lookup("nu0") >> nu0_;
114  BirdCarreauCoeffs_.lookup("nuInf") >> nuInf_;
115  BirdCarreauCoeffs_.lookup("k") >> k_;
116  BirdCarreauCoeffs_.lookup("n") >> n_;
117  a_ = BirdCarreauCoeffs_.lookupOrDefault
118  (
119  "a",
120  dimensionedScalar("a", dimless, 2)
121  );
122 
123  return true;
124 }
125 
126 
127 // ************************************************************************* //
Foam::surfaceFields.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: BirdCarreau.C:104
const dimensionSet dimViscosity
An incompressible Bird-Carreau non-Newtonian viscosity model.
Definition: BirdCarreau.H:55
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:759
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
A class for handling words, derived from string.
Definition: word.H:59
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
BirdCarreau(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: BirdCarreau.C:62
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576