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) 2018-2021 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"
27 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace laminarModels
35 {
36 namespace generalisedNewtonianViscosityModels
37 {
38  defineTypeNameAndDebug(HerschelBulkley, 0);
39 
41  (
42  generalisedNewtonianViscosityModel,
43  HerschelBulkley,
44  dictionary
45  );
46 }
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
55 (
56  const dictionary& viscosityProperties
57 )
58 :
59  generalisedNewtonianViscosityModel(viscosityProperties),
60  k_("k", dimViscosity, 0),
61  n_("n", dimless, 0),
62  tau0_("tau0", dimViscosity/dimTime, 0)
63 {
64  read(viscosityProperties);
65 }
66 
67 
68 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
69 
72 (
73  const dictionary& viscosityProperties
74 )
75 {
76  generalisedNewtonianViscosityModel::read(viscosityProperties);
77 
78  const dictionary& coeffs =
79  viscosityProperties.optionalSubDict(typeName + "Coeffs");
80 
81  coeffs.lookup("k") >> k_;
82  coeffs.lookup("n") >> n_;
83  coeffs.lookup("tau0") >> tau0_;
84 
85  return true;
86 }
87 
88 
91 nu
92 (
93  const volScalarField& nu0,
94  const volScalarField& strainRate
95 ) const
96 {
97  dimensionedScalar tone("tone", dimTime, 1.0);
98  dimensionedScalar rtone("rtone", dimless/dimTime, 1.0);
99 
100  return
101  (
102  min
103  (
104  nu0,
105  (tau0_ + k_*rtone*pow(tone*strainRate, n_))
106  /max
107  (
108  strainRate,
109  dimensionedScalar ("vSmall", dimless/dimTime, vSmall)
110  )
111  )
112  );
113 }
114 
115 
116 // ************************************************************************* //
const dimensionSet dimViscosity
virtual tmp< volScalarField > nu(const volScalarField &nu0, const volScalarField &strainRate) const
Return the laminar viscosity.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const dimensionSet dimless
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Macros for easy insertion into run-time selection tables.
const dimensionSet dimTime
bool read(const char *, int32_t &)
Definition: int32IO.C:85
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:1040
addToRunTimeSelectionTable(generalisedNewtonianViscosityModel, BirdCarreau, dictionary)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
An abstract base class for generalised Newtonian viscosity models.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
A class for managing temporary objects.
Definition: PtrList.H:53
HerschelBulkley(const dictionary &viscosityProperties)
Construct from components.
Namespace for OpenFOAM.
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:844