CrossPowerLaw.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2017 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 #include "surfaceFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace viscosityModels
35 {
36  defineTypeNameAndDebug(CrossPowerLaw, 0);
37 
39  (
40  viscosityModel,
41  CrossPowerLaw,
42  dictionary
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
49 
51 Foam::viscosityModels::CrossPowerLaw::calcNu() const
52 {
53  return (nu0_ - nuInf_)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_;
54 }
55 
56 
57 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58 
60 (
61  const word& name,
62  const dictionary& viscosityProperties,
63  const volVectorField& U,
64  const surfaceScalarField& phi
65 )
66 :
67  viscosityModel(name, viscosityProperties, U, phi),
68  CrossPowerLawCoeffs_
69  (
70  viscosityProperties.optionalSubDict(typeName + "Coeffs")
71  ),
72  nu0_("nu0", dimViscosity, CrossPowerLawCoeffs_),
73  nuInf_("nuInf", dimViscosity, CrossPowerLawCoeffs_),
74  m_("m", dimTime, CrossPowerLawCoeffs_),
75  n_("n", dimless, CrossPowerLawCoeffs_),
76  nu_
77  (
78  IOobject
79  (
80  name,
81  U_.time().timeName(),
82  U_.db(),
85  ),
86  calcNu()
87  )
88 {}
89 
90 
91 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
92 
94 (
95  const dictionary& viscosityProperties
96 )
97 {
98  viscosityModel::read(viscosityProperties);
99 
100  CrossPowerLawCoeffs_ =
101  viscosityProperties.optionalSubDict(typeName + "Coeffs");
102 
103  CrossPowerLawCoeffs_.lookup("nu0") >> nu0_;
104  CrossPowerLawCoeffs_.lookup("nuInf") >> nuInf_;
105  CrossPowerLawCoeffs_.lookup("m") >> m_;
106  CrossPowerLawCoeffs_.lookup("n") >> n_;
107 
108  return true;
109 }
110 
111 
112 // ************************************************************************* //
Foam::surfaceFields.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const dimensionSet dimViscosity
An abstract base class for incompressible viscosityModels.
Macros for easy insertion into run-time selection tables.
addToRunTimeSelectionTable(viscosityModel, BirdCarreau, dictionary)
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:759
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
A class for handling words, derived from string.
Definition: word.H:59
defineTypeNameAndDebug(BirdCarreau, 0)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: CrossPowerLaw.C:94
A class for managing temporary objects.
Definition: PtrList.H:53
CrossPowerLaw(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: CrossPowerLaw.C:60
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576