BirdCarreau.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 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 "BirdCarreau.H"
27 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace laminarModels
35 {
36 namespace generalizedNewtonianViscosityModels
37 {
40  (
44  );
45 }
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
54 (
55  const dictionary& viscosityProperties
56 )
57 :
58  generalizedNewtonianViscosityModel(viscosityProperties),
59  nuInf_("nuInf", dimViscosity, 0),
60  k_("k", dimTime, 0),
61  tauStar_( "tauStar", dimViscosity/dimTime, 0),
62  n_("n", dimless, 0),
63  a_("a", dimless, 2)
64 {
65  read(viscosityProperties);
66 }
67 
68 
69 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
70 
72 read
73 (
74  const dictionary& viscosityProperties
75 )
76 {
77  generalizedNewtonianViscosityModel::read(viscosityProperties);
78 
79  const dictionary& coeffs =
80  viscosityProperties.optionalSubDict(typeName + "Coeffs");
81 
82  coeffs.lookup("nuInf") >> nuInf_;
83 
84  if (coeffs.found("tauStar"))
85  {
86  coeffs.lookup("tauStar") >> tauStar_;
87  }
88  else
89  {
90  coeffs.lookup("k") >> k_;
91  }
92 
93  coeffs.lookup("n") >> n_;
94 
95  a_ = coeffs.lookupOrDefault
96  (
97  "a",
98  dimensionedScalar("a", dimless, 2)
99  );
100 
101  return true;
102 }
103 
104 
107 nu
108 (
109  const volScalarField& nu0,
110  const volScalarField& strainRate
111 ) const
112 {
113  return
114  nuInf_
115  + (nu0 - nuInf_)
116  *pow
117  (
118  scalar(1)
119  + pow
120  (
121  tauStar_.value() > 0
122  ? nu0*strainRate/tauStar_
123  : k_*strainRate,
124  a_
125  ),
126  (n_ - 1.0)/a_
127  );
128 }
129 
130 
131 // ************************************************************************* //
virtual tmp< volScalarField > nu(const volScalarField &nu0, const volScalarField &strainRate) const
Return the laminar viscosity.
Definition: BirdCarreau.C:108
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:438
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
An abstract base class for generalized Newtonian viscosity models.
const dimensionSet dimViscosity
Macros for easy insertion into run-time selection tables.
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:766
BirdCarreau(const dictionary &viscosityProperties)
Construct from components.
Definition: BirdCarreau.C:54
Bird-Carreau generalized Newtonian viscosity model.
Definition: BirdCarreau.H:85
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
addToRunTimeSelectionTable(generalizedNewtonianViscosityModel, BirdCarreau, dictionary)
A class for managing temporary objects.
Definition: PtrList.H:53
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: BirdCarreau.C:73
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:583