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) 2018-2021 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"
27 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace laminarModels
35 {
36 namespace generalisedNewtonianViscosityModels
37 {
38  defineTypeNameAndDebug(Casson, 0);
40  (
41  generalisedNewtonianViscosityModel,
42  Casson,
43  dictionary
44  );
45 }
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 (
54  const dictionary& viscosityProperties
55 )
56 :
57  generalisedNewtonianViscosityModel(viscosityProperties),
58  m_("m", dimViscosity, 0),
59  tau0_("tau0", dimViscosity/dimTime, 0),
60  nuMin_("nuMin", dimViscosity, 0),
61  nuMax_("nuMax", dimViscosity, 0)
62 {
63  read(viscosityProperties);
64 }
65 
66 
67 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
68 
70 (
71  const dictionary& viscosityProperties
72 )
73 {
74  generalisedNewtonianViscosityModel::read(viscosityProperties);
75 
76  const dictionary& coeffs =
77  viscosityProperties.optionalSubDict(typeName + "Coeffs");
78 
79  coeffs.lookup("m") >> m_;
80  coeffs.lookup("tau0") >> tau0_;
81  coeffs.lookup("nuMin_") >> nuMin_;
82  coeffs.lookup("nuMax_") >> nuMax_;
83 
84  return true;
85 }
86 
87 
90 nu
91 (
92  const volScalarField& nu0,
93  const volScalarField& strainRate
94 ) const
95 {
96  return max
97  (
98  nuMin_,
99  min
100  (
101  nuMax_,
102  sqr
103  (
104  sqrt
105  (
106  tau0_
107  /max
108  (
109  strainRate,
111  )
112  ) + sqrt(m_)
113  )
114  )
115  );
116 }
117 
118 
119 // ************************************************************************* //
const dimensionSet dimViscosity
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: Casson.C:70
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar sqrt(const dimensionedScalar &ds)
const dimensionSet dimless
Macros for easy insertion into run-time selection tables.
Casson(const dictionary &viscosityProperties)
Construct from components.
Definition: Casson.C:53
const dimensionSet dimTime
bool read(const char *, int32_t &)
Definition: int32IO.C:85
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:1040
addToRunTimeSelectionTable(generalisedNewtonianViscosityModel, BirdCarreau, dictionary)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
An abstract base class for generalised Newtonian viscosity models.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual tmp< volScalarField > nu(const volScalarField &nu0, const volScalarField &strainRate) const
Return the laminar viscosity.
Definition: Casson.C:91
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:844