HerschelBulkley.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 "HerschelBulkley.H"
28 #include "surfaceFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace viscosityModels
35 {
36  defineTypeNameAndDebug(HerschelBulkley, 0);
37 
39  (
40  viscosityModel,
41  HerschelBulkley,
42  dictionary
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
49 
51 Foam::viscosityModels::HerschelBulkley::calcNu() const
52 {
53  dimensionedScalar tone("tone", dimTime, 1.0);
54  dimensionedScalar rtone("rtone", dimless/dimTime, 1.0);
55 
56  tmp<volScalarField> sr(strainRate());
57 
58  return
59  (
60  min
61  (
62  nu0_,
63  (tau0_ + k_*rtone*pow(tone*sr(), n_))
64  /(max(sr(), dimensionedScalar ("VSMALL", dimless/dimTime, VSMALL)))
65  )
66  );
67 }
68 
69 
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 
73 (
74  const word& name,
75  const dictionary& viscosityProperties,
76  const volVectorField& U,
77  const surfaceScalarField& phi
78 )
79 :
80  viscosityModel(name, viscosityProperties, U, phi),
81  HerschelBulkleyCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
82  k_("k", dimViscosity, HerschelBulkleyCoeffs_),
83  n_("n", dimless, HerschelBulkleyCoeffs_),
84  tau0_("tau0", dimViscosity/dimTime, HerschelBulkleyCoeffs_),
85  nu0_("nu0", dimViscosity, HerschelBulkleyCoeffs_),
86  nu_
87  (
88  IOobject
89  (
90  name,
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  HerschelBulkleyCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
111 
112  HerschelBulkleyCoeffs_.lookup("k") >> k_;
113  HerschelBulkleyCoeffs_.lookup("n") >> n_;
114  HerschelBulkleyCoeffs_.lookup("tau0") >> tau0_;
115  HerschelBulkleyCoeffs_.lookup("nu0") >> nu0_;
116 
117  return true;
118 }
119 
120 
121 // ************************************************************************* //
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.
bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
HerschelBulkley(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
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
Macros for easy insertion into run-time selection tables.
defineTypeNameAndDebug(BirdCarreau, 0)
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