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-2022 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"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace laminarModels
34 {
35 namespace generalisedNewtonianViscosityModels
36 {
39  (
43  );
44 }
45 }
46 }
47 
48 
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 
53 (
54  const dictionary& viscosityProperties,
56  const volVectorField& U
57 )
58 :
59  strainRateViscosityModel(viscosityProperties, viscosity, U),
60  nuInf_("nuInf", dimViscosity, 0),
61  k_("k", dimTime, 0),
62  tauStar_( "tauStar", dimViscosity/dimTime, 0),
63  n_("n", dimless, 0),
64  a_("a", dimless, 2)
65 {
66  read(viscosityProperties);
67  correct();
68 }
69 
70 
71 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
72 
74 read
75 (
76  const dictionary& viscosityProperties
77 )
78 {
79  strainRateViscosityModel::read(viscosityProperties);
80 
81  const dictionary& coeffs =
82  viscosityProperties.optionalSubDict(typeName + "Coeffs");
83 
84  nuInf_.read(coeffs);;
85 
86  if (coeffs.found("tauStar"))
87  {
88  tauStar_.read(coeffs);
89  }
90  else
91  {
92  k_.read(coeffs);
93  }
94 
95  n_.read(coeffs);
96  a_.readIfPresent(coeffs);
97 
98  return true;
99 }
100 
101 
104 nu
105 (
106  const volScalarField& nu0,
107  const volScalarField& strainRate
108 ) const
109 {
110  return
111  nuInf_
112  + (nu0 - nuInf_)
113  *pow
114  (
115  scalar(1)
116  + pow
117  (
118  tauStar_.value() > 0
119  ? nu0*strainRate/tauStar_
120  : k_*strainRate,
121  a_
122  ),
123  (n_ - 1.0)/a_
124  );
125 }
126 
127 
128 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
bool read(Istream &, const bool keepHeader=false)
Read dictionary from Istream, optionally keeping the header.
Definition: dictionaryIO.C:108
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:1076
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:659
An abstract base class for generalised Newtonian viscosity models.
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
Bird-Carreau generalised Newtonian viscosity model.
Definition: BirdCarreau.H:90
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: BirdCarreau.C:75
BirdCarreau(const dictionary &viscosityProperties, const Foam::viscosity &viscosity, const volVectorField &U)
Construct from components.
Definition: BirdCarreau.C:53
An abstract base class for strain-rate dependent generalised Newtonian viscosity models.
virtual tmp< volScalarField > nu() const
Return the laminar viscosity.
A class for managing temporary objects.
Definition: tmp.H:55
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
U
Definition: pEqn.H:72
addToRunTimeSelectionTable(generalisedNewtonianViscosityModel, Newtonian, dictionary)
Namespace for OpenFOAM.
const dimensionSet dimViscosity
const dimensionSet dimless
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const dimensionSet dimTime