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) 2018-2020 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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"
30#include "volFields.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
37namespace laminarModels
38{
39namespace generalizedNewtonianViscosityModels
40{
42
44 (
48 );
49}
50}
51}
52
53
54// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55
56Foam::laminarModels::generalizedNewtonianViscosityModels::CrossPowerLaw::
57CrossPowerLaw
58(
59 const dictionary& viscosityProperties
60)
61:
62 generalizedNewtonianViscosityModel(viscosityProperties),
63 CrossPowerLawCoeffs_
64 (
65 viscosityProperties.optionalSubDict(typeName + "Coeffs")
66 ),
67 nuInf_("nuInf", dimViscosity, CrossPowerLawCoeffs_),
68 m_("m", dimTime, CrossPowerLawCoeffs_),
69 n_("n", dimless, CrossPowerLawCoeffs_),
70 tauStar_("tauStar", dimViscosity/dimTime, CrossPowerLawCoeffs_)
71{}
72
73
74// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
75
77read
78(
79 const dictionary& viscosityProperties
80)
81{
83
84 CrossPowerLawCoeffs_ =
85 viscosityProperties.optionalSubDict(typeName + "Coeffs");
86
87 CrossPowerLawCoeffs_.readEntry("nuInf", nuInf_);
88 CrossPowerLawCoeffs_.readEntry("m", m_);
89 CrossPowerLawCoeffs_.readEntry("n", n_);
90
91 return true;
92}
93
94
97nu
98(
99 const volScalarField& nu0,
100 const volScalarField& strainRate
101) const
102{
103 return
104 (
105 nuInf_
106 + (nu0 - nuInf_)
107 /
108 (
109 scalar(1)
110 + pow
111 (
112 (tauStar_.value() > 0)
113 ? nu0*strainRate/tauStar_
114 : m_*strainRate,
115 n_
116 )
117 )
118 );
119}
120
121
122// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
virtual bool read()
Re-read model coefficients if they have changed.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
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:577
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
An abstract base class for generalized Newtonian viscosity models.
Cross-Power law generalized Newtonian viscosity model.
Definition: CrossPowerLaw.H:86
A class for managing temporary objects.
Definition: tmp.H:65
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
Namespace for OpenFOAM.
const dimensionSet dimViscosity
const dimensionSet dimless
Dimensionless.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
volScalarField & nu