Casson.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) 2016-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 "Casson.H"
31#include "surfaceFields.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
37namespace viscosityModels
38{
41 (
43 Casson,
45 );
46}
47}
48
49
50// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
51
54{
55 return max
56 (
57 nuMin_,
58 min
59 (
60 nuMax_,
61 sqr
62 (
63 sqrt
64 (
65 tau0_
66 /max
67 (
68 strainRate(),
69 dimensionedScalar("VSMALL", dimless/dimTime, VSMALL)
70 )
71 ) + sqrt(m_)
72 )
73 )
74 );
75}
76
77
78// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
79
81(
82 const word& name,
83 const dictionary& viscosityProperties,
84 const volVectorField& U,
86)
87:
88 viscosityModel(name, viscosityProperties, U, phi),
89 CassonCoeffs_(viscosityProperties.optionalSubDict(typeName + "Coeffs")),
90 m_("m", dimViscosity, CassonCoeffs_),
91 tau0_("tau0", dimViscosity/dimTime, CassonCoeffs_),
92 nuMin_("nuMin", dimViscosity, CassonCoeffs_),
93 nuMax_("nuMax", dimViscosity, CassonCoeffs_),
94 nu_
95 (
97 (
98 name,
99 U_.time().timeName(),
100 U_.db(),
101 IOobject::NO_READ,
102 IOobject::AUTO_WRITE
103 ),
104 calcNu()
105 )
106{}
107
108
109// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
110
112(
113 const dictionary& viscosityProperties
114)
115{
116 viscosityModel::read(viscosityProperties);
117
118 CassonCoeffs_ = viscosityProperties.optionalSubDict(typeName + "Coeffs");
119
120 CassonCoeffs_.readEntry("m", m_);
121 CassonCoeffs_.readEntry("tau0", tau0_);
122 CassonCoeffs_.readEntry("nuMin_", nuMin_);
123 CassonCoeffs_.readEntry("nuMax_", nuMax_);
124
125 return true;
126}
127
128
129// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
surfaceScalarField & phi
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
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
A class for managing temporary objects.
Definition: tmp.H:65
An abstract base class for incompressible viscosityModels.
tmp< volScalarField > strainRate() const
Return the strain rate.
An incompressible Casson non-Newtonian viscosity model.
Definition: Casson.H:85
tmp< volScalarField > calcNu() const
Calculate and return the laminar viscosity.
Definition: Casson.C:53
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
U
Definition: pEqn.H:72
word timeName
Definition: getTimeIndex.H:3
Namespace for OpenFOAM.
const dimensionSet dimViscosity
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
const dimensionSet dimless
Dimensionless.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
dimensionedScalar sqrt(const dimensionedScalar &ds)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::surfaceFields.