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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2017 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "CrossPowerLaw.H"
31 #include "surfaceFields.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace viscosityModels
38 {
39  defineTypeNameAndDebug(CrossPowerLaw, 0);
40 
42  (
43  viscosityModel,
44  CrossPowerLaw,
45  dictionary
46  );
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
52 
55 {
56  return (nu0_ - nuInf_)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_;
57 }
58 
59 
60 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
61 
63 (
64  const word& name,
65  const dictionary& viscosityProperties,
66  const volVectorField& U,
67  const surfaceScalarField& phi
68 )
69 :
70  viscosityModel(name, viscosityProperties, U, phi),
71  CrossPowerLawCoeffs_
72  (
73  viscosityProperties.optionalSubDict(typeName + "Coeffs")
74  ),
75  nu0_("nu0", dimViscosity, CrossPowerLawCoeffs_),
76  nuInf_("nuInf", dimViscosity, CrossPowerLawCoeffs_),
77  m_("m", dimTime, CrossPowerLawCoeffs_),
78  n_("n", dimless, CrossPowerLawCoeffs_),
79  nu_
80  (
81  IOobject
82  (
83  name,
84  U_.time().timeName(),
85  U_.db(),
86  IOobject::NO_READ,
87  IOobject::AUTO_WRITE
88  ),
89  calcNu()
90  )
91 {}
92 
93 
94 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
95 
97 (
98  const dictionary& viscosityProperties
99 )
100 {
101  viscosityModel::read(viscosityProperties);
102 
103  CrossPowerLawCoeffs_ =
104  viscosityProperties.optionalSubDict(typeName + "Coeffs");
105 
106  CrossPowerLawCoeffs_.readEntry("nu0", nu0_);
107  CrossPowerLawCoeffs_.readEntry("nuInf", nuInf_);
108  CrossPowerLawCoeffs_.readEntry("m", m_);
109  CrossPowerLawCoeffs_.readEntry("n", n_);
110 
111  return true;
112 }
113 
114 
115 // ************************************************************************* //
Foam::surfaceFields.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const dimensionSet dimViscosity
tmp< volScalarField > strainRate() const
Return the strain rate.
tmp< volScalarField > calcNu() const
Calculate and return the laminar viscosity.
Definition: CrossPowerLaw.C:47
const dimensionSet dimless
Dimensionless.
An abstract base class for incompressible viscosityModels.
Macros for easy insertion into run-time selection tables.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect...
word timeName
Definition: getTimeIndex.H:3
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
Definition: dictionary.C:560
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
addToRunTimeSelectionTable(viscosityModel, BirdCarreau, dictionary)
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
A class for handling words, derived from Foam::string.
Definition: word.H:63
defineTypeNameAndDebug(BirdCarreau, 0)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
U
Definition: pEqn.H:72
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:90
A class for managing temporary objects.
Definition: HashPtrTable.H:50
CrossPowerLaw(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: CrossPowerLaw.C:56
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Namespace for OpenFOAM.