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) 2018-2020 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd
10 -------------------------------------------------------------------------------
11 License
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"
30 #include "volFields.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace laminarModels
38 {
39 namespace generalizedNewtonianViscosityModels
40 {
41  defineTypeNameAndDebug(Casson, 0);
43  (
44  generalizedNewtonianViscosityModel,
45  Casson,
46  dictionary
47  );
48 }
49 }
50 }
51 
52 
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 
56 (
57  const dictionary& viscosityProperties
58 )
59 :
60  generalizedNewtonianViscosityModel(viscosityProperties),
61  m_("m", dimViscosity, viscosityProperties),
62  tau0_("tau0", dimViscosity/dimTime, viscosityProperties),
63  nuMin_("nuMin", dimViscosity, viscosityProperties),
64  nuMax_("nuMax", dimViscosity, viscosityProperties)
65 {}
66 
67 
68 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
69 
71 (
72  const dictionary& viscosityProperties
73 )
74 {
76 
77  const dictionary& coeffs =
78  viscosityProperties.optionalSubDict(typeName + "Coeffs");
79 
80  coeffs.readEntry("m", m_);
81  coeffs.readEntry("tau0", tau0_);
82  coeffs.readEntry("nuMin", nuMin_);
83  coeffs.readEntry("nuMax", nuMax_);
84 
85  return true;
86 }
87 
88 
91 nu
92 (
93  const volScalarField& nu0,
94  const volScalarField& strainRate
95 ) const
96 {
97  return max
98  (
99  nuMin_,
100  min
101  (
102  nuMax_,
103  sqr
104  (
105  sqrt
106  (
107  tau0_
108  /max
109  (
110  strainRate,
111  dimensionedScalar("SMALL", dimless/dimTime, VSMALL)
112  )
113  ) + sqrt(m_)
114  )
115  )
116  );
117 }
118 
119 
120 // ************************************************************************* //
Casson(const dictionary &viscosityProperties)
Construct from dictionary (components)
Definition: Casson.C:49
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: Casson.C:64
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
An abstract base class for generalized Newtonian viscosity models.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimViscosity
dimensionedScalar sqrt(const dimensionedScalar &ds)
const dimensionSet dimless
Dimensionless.
Macros for easy insertion into run-time selection tables.
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 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
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
const dictionary & viscosityProperties() const
Return the phase transport properties dictionary.
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
addToRunTimeSelectionTable(generalizedNewtonianViscosityModel, BirdCarreau, dictionary)
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual tmp< volScalarField > nu(const volScalarField &nu0, const volScalarField &strainRate) const
Return the laminar viscosity.
Definition: Casson.C:85
Namespace for OpenFOAM.