Newtonian.H
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-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2019 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 Class
29  Foam::viscosityModels::Newtonian
30 
31 Description
32  An incompressible Newtonian viscosity model.
33 
34 SourceFiles
35  Newtonian.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Newtonian_H
40 #define Newtonian_H
41 
42 #include "viscosityModel.H"
43 #include "dimensionedScalar.H"
44 #include "volFields.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace viscosityModels
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class Newtonian Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class Newtonian
58 :
59  public viscosityModel
60 {
61  // Private Data
62 
63  //- Initial laminar viscosity
64  dimensionedScalar nu0_;
65 
66 
67 protected:
68 
69  // Protected Data
70 
71  //- Laminar viscosity field
73 
74 
75  // Protected Member Functions
76 
77  //- Calculate and return the laminar viscosity
79 
80 
81 public:
82 
83  //- Runtime type information
84  TypeName("Newtonian");
85 
86 
87  // Constructors
88 
89  //- Construct from components
90  Newtonian
91  (
92  const word& name,
94  const volVectorField& U,
95  const surfaceScalarField& phi
96  );
97 
98 
99  //- Destructor
100  virtual ~Newtonian() = default;
101 
102 
103  // Member Functions
104 
105  //- Return the laminar viscosity
106  virtual tmp<volScalarField> nu() const
107  {
108  return nu_;
109  }
110 
111  //- Return the laminar viscosity for patch
112  virtual tmp<scalarField> nu(const label patchi) const
113  {
114  return nu_.boundaryField()[patchi];
115  }
116 
117  //- Correct the laminar viscosity (not appropriate, viscosity constant)
118  virtual void correct()
119  {}
120 
121  //- Read transportProperties dictionary
122  virtual bool read(const dictionary& viscosityProperties);
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace viscosityModels
129 } // End namespace Foam
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
tmp< volScalarField > calcNu() const
Calculate and return the laminar viscosity.
Definition: Newtonian.C:42
An incompressible Newtonian viscosity model.
Definition: Newtonian.H:52
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
virtual tmp< volScalarField > nu() const
Return the laminar viscosity.
Definition: Newtonian.H:115
An abstract base class for incompressible viscosityModels.
const dictionary & viscosityProperties() const
Return the phase transport properties dictionary.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
volScalarField nu_
Laminar viscosity field.
Definition: Newtonian.H:71
virtual ~Newtonian()=default
Destructor.
Newtonian(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
Definition: Newtonian.C:56
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Definition: Newtonian.C:84
virtual void correct()
Correct the laminar viscosity (not appropriate, viscosity constant)
Definition: Newtonian.H:131
U
Definition: pEqn.H:72
TypeName("Newtonian")
Runtime type information.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
Namespace for OpenFOAM.