strainRateFunction.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) 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::strainRateFunction
30 
31 Description
32  Run-time selected strain-rate function non-Newtonian viscosity model.
33 
34  Example linear function of strain-rate:
35  \verbatim
36  transportModel strainRateFunction;
37 
38  strainRateFunctionCoeffs
39  {
40  function polynomial ((0 0.1) (1 1.3));
41  }
42  \endverbatim
43 
44 See also
45  Foam::viscosityModel
46  Foam::Function1
47 
48 SourceFiles
49  strainRateFunction.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef strainRateFunction_H
54 #define strainRateFunction_H
55 
56 #include "viscosityModel.H"
57 #include "volFields.H"
58 #include "Function1.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 namespace viscosityModels
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class strainRateFunction Declaration
69 \*---------------------------------------------------------------------------*/
70 
72 :
73  public viscosityModel
74 {
75  // Private data
76 
77  //- Coefficients dictionary
78  dictionary strainRateFunctionCoeffs_;
79 
80  //- Strain-rate function
81  autoPtr<Function1<scalar>> strainRateFunction_;
82 
83 
84 protected:
85 
86  // Protected Data
87 
88  //- Laminar viscosity field
90 
91 
92  // Protected Member Functions
93 
94  //- Calculate and return the laminar viscosity
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("strainRateFunction");
102 
103 
104  // Constructors
105 
106  //- Construct from components
108  (
109  const word& name,
111  const volVectorField& U,
112  const surfaceScalarField& phi
113  );
114 
115 
116  //- Destructor
117  virtual ~strainRateFunction() = default;
118 
119 
120  // Member Functions
121 
122  //- Return the laminar viscosity
123  virtual tmp<volScalarField> nu() const;
124 
125  //- Return the laminar viscosity for patch
126  virtual tmp<scalarField> nu(const label patchi) const;
127 
128  //- Correct the laminar viscosity
129  virtual void correct();
130 
131  //- Read transportProperties dictionary
132  virtual bool read(const dictionary& viscosityProperties);
133 };
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace viscosityModels
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
virtual bool read(const dictionary &viscosityProperties)
Read transportProperties dictionary.
Run-time selected strain-rate function non-Newtonian viscosity model.
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.
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
virtual ~strainRateFunction()=default
Destructor.
TypeName("strainRateFunction")
Runtime type information.
strainRateFunction(const word &name, const dictionary &viscosityProperties, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
U
Definition: pEqn.H:72
volScalarField nu_
Laminar viscosity field.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void correct()
Correct the laminar viscosity.
tmp< volScalarField > calcNu() const
Calculate and return the laminar viscosity.
Namespace for OpenFOAM.