HerschelBulkley.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 "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_
82  (
83  viscosityProperties.optionalSubDict(typeName + "Coeffs")
84  ),
85  k_("k", dimViscosity, HerschelBulkleyCoeffs_),
86  n_("n", dimless, HerschelBulkleyCoeffs_),
87  tau0_("tau0", dimViscosity/dimTime, HerschelBulkleyCoeffs_),
88  nu0_("nu0", dimViscosity, HerschelBulkleyCoeffs_),
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  HerschelBulkleyCoeffs_ =
114  viscosityProperties.optionalSubDict(typeName + "Coeffs");
115 
116  HerschelBulkleyCoeffs_.lookup("k") >> k_;
117  HerschelBulkleyCoeffs_.lookup("n") >> n_;
118  HerschelBulkleyCoeffs_.lookup("tau0") >> tau0_;
119  HerschelBulkleyCoeffs_.lookup("nu0") >> nu0_;
120 
121  return true;
122 }
123 
124 
125 // ************************************************************************* //
Foam::surfaceFields.
HerschelBulkley(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
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
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
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
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