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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2018-2020 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "HerschelBulkley.H"
30 #include "volFields.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace laminarModels
38 {
39 namespace generalizedNewtonianViscosityModels
40 {
41  defineTypeNameAndDebug(HerschelBulkley, 0);
42 
44  (
45  generalizedNewtonianViscosityModel,
46  HerschelBulkley,
47  dictionary
48  );
49 }
50 }
51 }
52 
53 
54 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55 
58 (
59  const dictionary& viscosityProperties
60 )
61 :
62  generalizedNewtonianViscosityModel(viscosityProperties),
63  HerschelBulkleyCoeffs_
64  (
65  viscosityProperties.optionalSubDict(typeName + "Coeffs")
66  ),
67  n_("n", dimless, HerschelBulkleyCoeffs_),
68  tau0_("tau0", dimViscosity/dimTime, HerschelBulkleyCoeffs_)
69 {}
70 
71 
72 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
73 
76 (
77  const dictionary& viscosityProperties
78 )
79 {
80  generalizedNewtonianViscosityModel::read(viscosityProperties);
81 
82  HerschelBulkleyCoeffs_ =
83  viscosityProperties.optionalSubDict(typeName + "Coeffs");
84 
85  HerschelBulkleyCoeffs_.readEntry("n", n_);
86  HerschelBulkleyCoeffs_.readEntry("tau0", tau0_);
87 
88  return true;
89 }
90 
91 
94 nu
95 (
96  const volScalarField& nu0,
97  const volScalarField& strainRate
98 ) const
99 {
100  const dimensionedScalar tone("tone", dimTime, 1);
101  const dimensionedScalar rtone("rtone", dimless/dimTime, 1);
102 
103  return
104  (
105  min
106  (
107  nu0,
108  (tau0_ + nu0*rtone*pow(tone*strainRate, n_))
109  /max
110  (
111  strainRate,
112  dimensionedScalar("SMALL", dimless/dimTime, VSMALL)
113  )
114  )
115  );
116 }
117 
118 
119 // ************************************************************************* //
volFields.H
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
Definition: dimensionSets.H:50
Foam::laminarModels::generalizedNewtonianViscosityModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(generalizedNewtonianViscosityModel, BirdCarreau, dictionary)
Foam::laminarModels::generalizedNewtonianViscosityModels::HerschelBulkley::read
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: HerschelBulkley.C:76
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:54
Foam::laminarModels::generalizedNewtonianViscosityModels::HerschelBulkley::HerschelBulkley
HerschelBulkley(const dictionary &viscosityProperties)
Construct from dictionary (components)
Definition: HerschelBulkley.C:58
Foam::dictionary::readEntry
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Definition: dictionaryTemplates.C:314
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::blockMeshTools::read
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
Definition: blockMeshTools.C:33
Foam::dimViscosity
const dimensionSet dimViscosity
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
HerschelBulkley.H
Foam::laminarModels::generalizedNewtonianViscosityModel
An abstract base class for generalized Newtonian viscosity models.
Definition: generalizedNewtonianViscosityModel.H:63
Foam::laminarModels::generalizedNewtonianViscosityModels::defineTypeNameAndDebug
defineTypeNameAndDebug(BirdCarreau, 0)
Foam::dictionary::optionalSubDict
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
Definition: dictionary.C:645
Foam::laminarModels::generalizedNewtonianViscosityModels::HerschelBulkley::nu
virtual tmp< volScalarField > nu(const volScalarField &nu0, const volScalarField &strainRate) const
Return the laminar viscosity.
Definition: HerschelBulkley.C:95
Foam::GeometricField< scalar, fvPatchField, volMesh >