Loading...
Searching...
No Matches
powerLaw.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-------------------------------------------------------------------------------
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 "powerLaw.H"
31#include "surfaceFields.H"
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35namespace Foam
36{
37namespace viscosityModels
38{
40
42 (
46 );
48}
49
50
51// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
52
55{
56 return max
57 (
58 nuMin_,
59 min
60 (
61 nuMax_,
62 k_*pow
63 (
64 max
65 (
67 dimensionedScalar("SMALL", dimless, SMALL)
68 ),
69 n_.value() - scalar(1)
70 )
71 )
72 );
73}
74
75
76// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
77
79(
80 const word& name,
81 const dictionary& viscosityProperties,
82 const volVectorField& U,
84)
85:
86 viscosityModel(name, viscosityProperties, U, phi),
87 powerLawCoeffs_(viscosityProperties.optionalSubDict(typeName + "Coeffs")),
88 k_("k", dimViscosity, powerLawCoeffs_),
89 n_("n", dimless, powerLawCoeffs_),
90 nuMin_("nuMin", dimViscosity, powerLawCoeffs_),
91 nuMax_("nuMax", dimViscosity, powerLawCoeffs_),
92 nu_
93 (
95 (
96 name,
97 U_.time().timeName(),
98 U_.db(),
99 IOobject::NO_READ,
100 IOobject::AUTO_WRITE
101 ),
103 )
104{}
105
106
107// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
108
110(
111 const dictionary& viscosityProperties
112)
113{
114 viscosityModel::read(viscosityProperties);
115
116 powerLawCoeffs_ = viscosityProperties.optionalSubDict(typeName + "Coeffs");
117
118 powerLawCoeffs_.readEntry("k", k_);
119 powerLawCoeffs_.readEntry("n", n_);
120 powerLawCoeffs_.readEntry("nuMin", nuMin_);
121 powerLawCoeffs_.readEntry("nuMax", nuMax_);
122
123 return true;
124}
125
126
127// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
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
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,...
const Type & value() const noexcept
Return const reference to value.
A class for managing temporary objects.
Definition tmp.H:75
An abstract base class for incompressible viscosityModels.
const volVectorField & U_
tmp< volScalarField > strainRate() const
Return the strain rate.
viscosityModel(const viscosityModel &)=delete
No copy construct.
const dictionary & viscosityProperties() const
Return the phase transport properties dictionary.
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
Standard power-law non-Newtonian viscosity model.
Definition powerLaw.H:54
powerLaw(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition powerLaw.C:72
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition powerLaw.C:103
tmp< volScalarField > calcNu() const
Calculate and return the laminar viscosity.
Definition powerLaw.C:47
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
U
Definition pEqn.H:72
word timeName
Definition getTimeIndex.H:3
A namespace for various incompressible viscosityModel implementations.
Definition Arrhenius.H:48
Namespace for OpenFOAM.
const dimensionSet dimViscosity
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:26
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Foam::surfaceFields.