CrossPowerLaw.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 "CrossPowerLaw.H"
27 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace laminarModels
35 {
36 namespace generalisedNewtonianViscosityModels
37 {
38  defineTypeNameAndDebug(CrossPowerLaw, 0);
39 
41  (
42  generalisedNewtonianViscosityModel,
43  CrossPowerLaw,
44  dictionary
45  );
46 }
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
55 (
56  const dictionary& viscosityProperties
57 )
58 :
59  generalisedNewtonianViscosityModel(viscosityProperties),
60  nuInf_("nuInf", dimViscosity, 0),
61  m_("m", dimTime, 0),
62  tauStar_( "tauStar", dimViscosity/dimTime, 0),
63  n_("n", dimless, 0)
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("m") >> m_;
91  }
92 
93  coeffs.lookup("n") >> n_;
94 
95  return true;
96 }
97 
98 
101 nu
102 (
103  const volScalarField& nu0,
104  const volScalarField& strainRate
105 ) const
106 {
107  return
108  nuInf_
109  + (nu0 - nuInf_)
110  /(
111  scalar(1)
112  + pow
113  (
114  tauStar_.value() > 0
115  ? nu0*strainRate/tauStar_
116  : m_*strainRate,
117  n_
118  )
119  );
120 }
121 
122 
123 // ************************************************************************* //
const dimensionSet dimViscosity
CrossPowerLaw(const dictionary &viscosityProperties)
Construct from components.
Definition: CrossPowerLaw.C:55
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
Macros for easy insertion into run-time selection tables.
const dimensionSet dimTime
virtual tmp< volScalarField > nu(const volScalarField &nu0, const volScalarField &strainRate) const
Return the laminar viscosity.
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)
An abstract base class for generalised Newtonian viscosity models.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
A class for managing temporary objects.
Definition: PtrList.H:53
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
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: CrossPowerLaw.C:73