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-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 "CrossPowerLaw.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace laminarModels
34 {
35 namespace generalisedNewtonianViscosityModels
36 {
38 
40  (
44  );
45 }
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
54 (
55  const dictionary& viscosityProperties,
57  const volVectorField& U
58 )
59 :
60  strainRateViscosityModel(viscosityProperties, viscosity, U),
61  nuInf_("nuInf", dimViscosity, 0),
62  m_("m", dimTime, 0),
63  tauStar_( "tauStar", dimViscosity/dimTime, 0),
64  n_("n", dimless, 0)
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  m_.read(coeffs);
93  }
94 
95  n_.read(coeffs);
96 
97  return true;
98 }
99 
100 
103 nu
104 (
105  const volScalarField& nu0,
106  const volScalarField& strainRate
107 ) const
108 {
109  return
110  nuInf_
111  + (nu0 - nuInf_)
112  /(
113  scalar(1)
114  + pow
115  (
116  tauStar_.value() > 0
117  ? nu0*strainRate/tauStar_
118  : m_*strainRate,
119  n_
120  )
121  );
122 }
123 
124 
125 // ************************************************************************* //
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.
Cross-Power law generalised Newtonian viscosity model.
Definition: CrossPowerLaw.H:85
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: CrossPowerLaw.C:75
CrossPowerLaw(const dictionary &viscosityProperties, const Foam::viscosity &viscosity, const volVectorField &U)
Construct from components.
Definition: CrossPowerLaw.C:54
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