Newtonian.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-2015 OpenFOAM Foundation
9  Copyright (C) 2017 OpenCFD Ltd
10  Copyright (C) 2026 Keysight Technologies
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 \*---------------------------------------------------------------------------*/
29 
30 #include "Newtonian.H"
32 #include "surfaceFields.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace viscosityModels
39 {
40  defineTypeNameAndDebug(Newtonian, 0);
41  addToRunTimeSelectionTable(viscosityModel, Newtonian, dictionary);
42 }
43 }
44 
45 
46 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
47 
50 {
52  (
53  U_.mesh().newIOobject("nu"),
54  U_.mesh(),
55  nu0_
56  );
57 }
58 
59 
60 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
61 
63 (
64  const word& name,
65  const dictionary& viscosityProperties,
66  const volVectorField& U,
67  const surfaceScalarField& phi
68 )
69 :
70  viscosityModel(name, viscosityProperties, U, phi),
71  nu0_("nu", dimViscosity, viscosityProperties_),
72  nu_
73  (
74  IOobject
75  (
76  name,
77  U_.time().timeName(),
78  U_.db(),
79  IOobject::NO_READ,
80  IOobject::NO_WRITE
81  ),
82  U_.mesh(),
83  nu0_
84  )
85 {}
86 
87 
88 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
89 
91 (
92  const dictionary& viscosityProperties
93 )
94 {
95  viscosityModel::read(viscosityProperties);
96 
97  viscosityProperties_.readEntry("nu", nu0_);
98  nu_ = nu0_;
99 
100  return true;
101 }
102 
103 
104 // ************************************************************************* //
Foam::surfaceFields.
tmp< volScalarField > calcNu() const
Calculate and return the laminar viscosity.
Definition: Newtonian.C:42
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
const dimensionSet dimViscosity
const volVectorField & U_
An abstract base class for incompressible viscosityModels.
Macros for easy insertion into run-time selection tables.
word timeName
Definition: getTimeIndex.H:3
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
addToRunTimeSelectionTable(viscosityModel, BirdCarreau, dictionary)
virtual bool read(const dictionary &viscosityProperties)=0
Read transportProperties dictionary.
A class for handling words, derived from Foam::string.
Definition: word.H:63
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:217
Newtonian(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: Newtonian.C:56
defineTypeNameAndDebug(BirdCarreau, 0)
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: Newtonian.C:84
U
Definition: pEqn.H:72
const Mesh & mesh() const noexcept
Return const reference to mesh.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:188
Namespace for OpenFOAM.