flowType.H
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) 2016-2025 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 Class
25  Foam::functionObjects::flowType
26 
27 Description
28  Calculates and writes a field in the range -1 to 1, in which:
29  - 1 = rotational flow
30  - 0 = parallel shear (50% rotational, 50% shear)
31  - -1 = pure shear deformation
32 
33  The field is calculated as:
34  \verbatim
35  flowType = -(devGradU && devGradU.T())/magSqr(devGradU)
36  \endverbatim
37 
38  where \c devGradU = \c dev(fvc::grad(U)). The \c flowType parameter is
39  designed for visualisation of vortices, by extracting an iso-surface of
40  these fields at a specified value. The parameter is similar to \c Q and
41  \c Lambda2, except that \c Q and \c Lambda2 represent the rotational speed,
42  or "strength", of vortices whereas \c flowType is normalised to a scale
43  between -1 and 1, making it independent of vortex strength.
44 
45  The normalisation of \c flowType provides the advantage that it is much
46  easier to select a value of iso-surface to visualise vortices effectively.
47  Generally a value of 0.2 (or between 0.05 - 0.2) is recommended. With \c Q
48  and \c Lambda2 the choice of an effective iso-surface value depends on the
49  strength of vortices for the specific CFD problem.
50 
51  The \c flowType function object writes an additional \c magSqrDevGradU field
52  corresponding to the denominator in the \c flowType field. An iso-surface
53  can then be coloured by the \c magSqrDevGradU field to indicate the strength
54  of the vortices as they move with the flow.
55 
56 See also
57  Foam::functionObjects::Q
58  Foam::functionObjects::Lambda2
59 
60 SourceFiles
61  flowType.C
62 
63 \*---------------------------------------------------------------------------*/
64 
65 #ifndef flowType_functionObject_H
66 #define flowType_functionObject_H
67 
68 #include "fvMeshFunctionObject.H"
69 #include "writeLocalObjects.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 namespace functionObjects
76 {
77 
78 /*---------------------------------------------------------------------------*\
79  Class flowType Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 class flowType
83 :
84  public fvMeshFunctionObject,
85  public writeLocalObjects
86 {
87  // Private Member data
88 
89  //- Name of the velocity field, default "U"
90  const word fieldName_;
91 
92  //- Name of the flowType field
93  const word resultName_;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("flowType");
100 
101 
102  // Constructors
103 
104  //- Construct from Time and dictionary
105  flowType
106  (
107  const word& name,
108  const Time& runTime,
109  const dictionary& dict
110  );
111 
112 
113  //- Destructor
114  virtual ~flowType();
115 
116 
117  // Member Functions
118 
119  //- Read the data
120  virtual bool read(const dictionary&);
121 
122  //- Return the list of fields required
123  virtual wordList fields() const;
124 
125  //- Calculate the flowType fields
126  virtual bool execute();
127 
128  //- Write the flowType fields
129  virtual bool write();
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace functionObjects
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const word & name() const
Return the name of this functionObject.
Calculates and writes a field in the range -1 to 1, in which:
Definition: flowType.H:85
virtual ~flowType()
Destructor.
Definition: flowType.C:72
virtual wordList fields() const
Return the list of fields required.
Definition: flowType.C:88
flowType(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: flowType.C:50
TypeName("flowType")
Runtime type information.
virtual bool execute()
Calculate the flowType fields.
Definition: flowType.C:94
virtual bool write()
Write the flowType fields.
Definition: flowType.C:123
virtual bool read(const dictionary &)
Read the data.
Definition: flowType.C:77
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
FunctionObject base class for managing a list of objects on behalf of the inheriting function object,...
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
dictionary dict