BirdCarreau.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2017-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 "BirdCarreau.H"
31 #include "surfaceFields.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace viscosityModels
38 {
39  defineTypeNameAndDebug(BirdCarreau, 0);
41  (
42  viscosityModel,
43  BirdCarreau,
44  dictionary
45  );
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
51 
54 {
55  return
56  nuInf_
57  + (nu0_ - nuInf_)
58  * pow(scalar(1) + pow(k_*strainRate(), a_), (n_ - 1.0)/a_);
59 }
60 
61 
62 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
63 
65 (
66  const word& name,
67  const dictionary& viscosityProperties,
68  const volVectorField& U,
69  const surfaceScalarField& phi
70 )
71 :
72  viscosityModel(name, viscosityProperties, U, phi),
73  BirdCarreauCoeffs_
74  (
75  viscosityProperties.optionalSubDict(typeName + "Coeffs")
76  ),
77  nu0_("nu0", dimViscosity, BirdCarreauCoeffs_),
78  nuInf_("nuInf", dimViscosity, BirdCarreauCoeffs_),
79  k_("k", dimTime, BirdCarreauCoeffs_),
80  n_("n", dimless, BirdCarreauCoeffs_),
81  a_
82  (
83  BirdCarreauCoeffs_.getOrDefault
84  (
85  "a",
86  dimensionedScalar("a", dimless, 2)
87  )
88  ),
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  BirdCarreauCoeffs_ =
114  viscosityProperties.optionalSubDict(typeName + "Coeffs");
115 
116  BirdCarreauCoeffs_.readEntry("nu0", nu0_);
117  BirdCarreauCoeffs_.readEntry("nuInf", nuInf_);
118  BirdCarreauCoeffs_.readEntry("k", k_);
119  BirdCarreauCoeffs_.readEntry("n", n_);
120  a_ = BirdCarreauCoeffs_.getOrDefault
121  (
122  "a",
123  dimensionedScalar("a", dimless, 2)
124  );
125 
126  return true;
127 }
128 
129 
130 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::viscosityModel
An abstract base class for incompressible viscosityModels.
Definition: viscosityModel.H:67
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:194
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::viscosityModels::BirdCarreau::BirdCarreau
BirdCarreau(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: BirdCarreau.C:65
surfaceFields.H
Foam::surfaceFields.
Foam::viscosityModel::read
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
Definition: viscosityModel.C:66
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::dictionary::readEntry
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Definition: dictionaryTemplates.C:302
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::viscosityModels::defineTypeNameAndDebug
defineTypeNameAndDebug(BirdCarreau, 0)
Foam::dimViscosity
const dimensionSet dimViscosity
Foam::viscosityModels::BirdCarreau::read
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: BirdCarreau.C:107
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
U
U
Definition: pEqn.H:72
Foam::viscosityModels::BirdCarreau::calcNu
tmp< volScalarField > calcNu() const
Calculate and return the laminar viscosity.
Definition: BirdCarreau.C:53
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:577
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:188
BirdCarreau.H
Foam::viscosityModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(viscosityModel, BirdCarreau, dictionary)
Foam::viscosityModel::strainRate
tmp< volScalarField > strainRate() const
Return the strain rate.
Definition: viscosityModel.C:60
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189