All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Casson.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) 2016-2020 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 "Casson.H"
28 #include "surfaceFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace viscosityModels
35 {
36  defineTypeNameAndDebug(Casson, 0);
38  (
39  viscosityModel,
40  Casson,
41  dictionary
42  );
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
48 
50 Foam::viscosityModels::Casson::calcNu() const
51 {
52  return max
53  (
54  nuMin_,
55  min
56  (
57  nuMax_,
58  sqr
59  (
60  sqrt
61  (
62  tau0_
63  /max
64  (
65  strainRate(),
67  )
68  ) + sqrt(m_)
69  )
70  )
71  );
72 }
73 
74 
75 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
76 
78 (
79  const word& name,
80  const dictionary& viscosityProperties,
81  const volVectorField& U,
82  const surfaceScalarField& phi
83 )
84 :
85  viscosityModel(name, viscosityProperties, U, phi),
86  CassonCoeffs_(viscosityProperties.optionalSubDict(typeName + "Coeffs")),
87  m_("m", dimViscosity, CassonCoeffs_),
88  tau0_("tau0", dimViscosity/dimTime, CassonCoeffs_),
89  nuMin_("nuMin", dimViscosity, CassonCoeffs_),
90  nuMax_("nuMax", dimViscosity, CassonCoeffs_),
91  nu_
92  (
93  IOobject
94  (
95  "nu",
96  U_.time().timeName(),
97  U_.db(),
100  ),
101  calcNu()
102  )
103 {}
104 
105 
106 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
107 
109 (
110  const dictionary& viscosityProperties
111 )
112 {
113  viscosityModel::read(viscosityProperties);
114 
115  CassonCoeffs_ = viscosityProperties.optionalSubDict(typeName + "Coeffs");
116 
117  CassonCoeffs_.lookup("m") >> m_;
118  CassonCoeffs_.lookup("tau0") >> tau0_;
119  CassonCoeffs_.lookup("nuMin_") >> nuMin_;
120  CassonCoeffs_.lookup("nuMax_") >> nuMax_;
121 
122  return true;
123 }
124 
125 
126 // ************************************************************************* //
Foam::surfaceFields.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimViscosity
dimensionedScalar sqrt(const dimensionedScalar &ds)
An abstract base class for incompressible viscosityModels.
Macros for easy insertion into run-time selection tables.
addToRunTimeSelectionTable(viscosityModel, BirdCarreau, dictionary)
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:1001
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
A class for handling words, derived from string.
Definition: word.H:59
Casson(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: Casson.C:78
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: Casson.C:109
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
defineTypeNameAndDebug(BirdCarreau, 0)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
A class for managing temporary objects.
Definition: PtrList.H:53
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:812