powerLaw.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 "powerLaw.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace laminarModels
34 {
35 namespace generalisedNewtonianViscosityModels
36 {
38 
40  (
42  powerLaw,
44  );
45 }
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 (
54  const dictionary& viscosityProperties,
56  const volVectorField& U
57 )
58 :
59  strainRateViscosityModel(viscosityProperties, viscosity, U),
60  k_("k", dimViscosity, 0),
61  n_("n", dimless, 0),
62  nuMin_("nuMin", dimViscosity, 0),
63  nuMax_("nuMax", dimViscosity, 0)
64 {
65  read(viscosityProperties);
66  correct();
67 }
68 
69 
70 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
71 
73 (
74  const dictionary& viscosityProperties
75 )
76 {
77  strainRateViscosityModel::read(viscosityProperties);
78 
79  const dictionary& coeffs =
80  viscosityProperties.optionalSubDict(typeName + "Coeffs");
81 
82  k_.read(coeffs);
83  n_.read(coeffs);
84  nuMin_.read(coeffs);
85  nuMax_.read(coeffs);
86 
87  return true;
88 }
89 
90 
93 nu
94 (
95  const volScalarField& nu0,
96  const volScalarField& strainRate
97 ) const
98 {
99  return max
100  (
101  nuMin_,
102  min
103  (
104  nuMax_,
105  k_*pow
106  (
107  max
108  (
109  dimensionedScalar(dimTime, 1.0)*strainRate,
110  dimensionedScalar(dimless, small)
111  ),
112  n_.value() - scalar(1)
113  )
114  )
115  );
116 }
117 
118 
119 // ************************************************************************* //
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
An abstract base class for generalised Newtonian viscosity models.
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
Standard power-law generalised Newtonian viscosity model.
Definition: powerLaw.H:75
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: powerLaw.C:73
powerLaw(const dictionary &viscosityProperties, const Foam::viscosity &viscosity, const volVectorField &U)
Construct from components.
Definition: powerLaw.C:53
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
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimless
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const dimensionSet dimTime
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)