cylindricalFunctionObject.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) 2020 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::cylindrical
26 
27 Description
28  Transforms the specified velocity field into a
29  cylindrical polar coordinate system or back to Cartesian.
30 
31  Example of function object specification to convert the velocity field U
32  into cylindrical polar coordinates before averaging and returning the
33  average to Cartesian coordinates:
34  \verbatim
35  cartesianToCylindrical
36  {
37  type cylindrical;
38  libs ("libfieldFunctionObjects.so");
39 
40  origin (0 0 0);
41  axis (0 0 1);
42 
43  field U;
44 
45  writeControl outputTime;
46  writeInterval 1;
47  }
48 
49  #includeFunc fieldAverage(cylindrical(U))
50 
51  cylindricalToCartesian
52  {
53  type cylindrical;
54  libs ("libfieldFunctionObjects.so");
55 
56  origin (0 0 0);
57  axis (0 0 1);
58 
59  field cylindrical(U)Mean;
60  toCartesian true;
61  result UMean;
62 
63  writeControl outputTime;
64  writeInterval 1;
65  }
66  \endverbatim
67  This is particularly useful for cases with rotating regions, e.g. mixer
68  vessels with AMI.
69 
70 See also
71  Foam::functionObjects::fieldExpression
72  Foam::functionObjects::fvMeshFunctionObject
73 
74 SourceFiles
75  cylindrical.C
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #ifndef cylindricalFunctionObject_H
80 #define cylindricalFunctionObject_H
81 
82 #include "fieldExpression.H"
83 #include "primitiveFieldsFwd.H"
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 namespace Foam
88 {
89 namespace functionObjects
90 {
91 
92 /*---------------------------------------------------------------------------*\
93  Class cylindrical Declaration
94 \*---------------------------------------------------------------------------*/
95 
96 class cylindrical
97 :
98  public fieldExpression
99 {
100  // Private Data
101 
102  vector origin_;
103 
104  vector axis_;
105 
106 
107  // Private Member Functions
108 
109  tensor R(const vector& p) const;
110 
111  void transform(vectorField& vf, const vectorField& points) const;
112 
113  bool toCartesian_;
114 
115  //- Calculate the cylindrical field and return true if successful
116  virtual bool calc();
117 
118 
119 public:
120 
121  //- Runtime type information
122  TypeName("cylindrical");
123 
124 
125  // Constructors
126 
127  //- Construct from Time and dictionary
129  (
130  const word& name,
131  const Time& runTime,
132  const dictionary& dict
133  );
134 
135 
136  //- Destructor
137  virtual ~cylindrical();
138 };
139 
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 } // End namespace functionObjects
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
dictionary dict
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
engineTime & runTime
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Transforms the specified velocity field into a cylindrical polar coordinate system or back to Cartesi...
cylindrical(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
TypeName("cylindrical")
Runtime type information.
volScalarField & p
Namespace for OpenFOAM.