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-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 "BirdCarreau.H"
27 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace laminarModels
35 {
36 namespace generalisedNewtonianViscosityModels
37 {
40  (
44  );
45 }
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
54 (
55  const dictionary& viscosityProperties
56 )
57 :
58  generalisedNewtonianViscosityModel(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  generalisedNewtonianViscosityModel::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 // ************************************************************************* //
const dimensionSet dimViscosity
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:643
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
const dimensionSet dimless
BirdCarreau(const dictionary &viscosityProperties)
Construct from components.
Definition: BirdCarreau.C:54
Macros for easy insertion into run-time selection tables.
const dimensionSet dimTime
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: BirdCarreau.C:73
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)
virtual tmp< volScalarField > nu(const volScalarField &nu0, const volScalarField &strainRate) const
Return the laminar viscosity.
Definition: BirdCarreau.C:108
An abstract base class for generalised Newtonian viscosity models.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
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.
A class for managing temporary objects.
Definition: PtrList.H:53
Bird-Carreau generalised Newtonian viscosity model.
Definition: BirdCarreau.H:85
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