wallShearStress.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) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2015-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::functionObjects::wallShearStress
29 
30 Group
31  grpForcesFunctionObjects
32 
33 Description
34  Computes the wall-shear stress at selected wall patches.
35 
36  \f[
37  \vec \tau = \vec R \cdot \vec n
38  \f]
39 
40  where
41  \vartable
42  \vec \tau | Wall shear stress vector [m^2/s^2]
43  \vec R | Shear-stress symmetric tensor (retrieved from turbulence model)
44  \vec n | Patch normal vector (into the domain)
45  \endvartable
46 
47  Operands:
48  \table
49  Operand | Type | Location
50  input | - | -
51  output file | dat | $FOAM_CASE/postProcessing/<FO>/<time>/<field>
52  output field | volVectorField (only boundaryField) <!--
53  --> | $FOAM_CASE/<time>/<outField>
54  \endtable
55 
56 Usage
57  Minimal example by using \c system/controlDict.functions:
58  \verbatim
59  wallShearStress1
60  {
61  // Mandatory entries (unmodifiable)
62  type wallShearStress;
63  libs (fieldFunctionObjects);
64 
65  // Optional entries (runtime modifiable)
66  patches (<patch1> ... <patchN>); // (wall1 "(wall2|wall3)");
67 
68  // Optional entries
69  writeFields true;
70  }
71  \endverbatim
72 
73  where the entries mean:
74  \table
75  Property | Description | Type | Req'd | Dflt
76  type | Type name: wallShearStress | word | yes | -
77  libs | Library name: fieldFunctionObjects | word | yes | -
78  patches | Names of operand patches | wordRes | no | all wall patches
79  writeFields | Flag to write shear stress field | bool | no | true
80  \endtable
81 
82  The inherited entries are elaborated in:
83  - \link functionObject.H \endlink
84  - \link writeFile.H \endlink
85 
86  Minimal example by using the \c postProcess utility:
87  \verbatim
88  <solver> -postProcess -func wallShearStress
89  \endverbatim
90 
91 Note
92  The \c writeFields flag currently defaults to \c true
93  (for consistency with previous versions that did not have that flag)
94  but this is subject to change in the near future for consistency
95  with other function objects.
96 
97 See also
98  - Foam::functionObject
99  - Foam::functionObjects::fvMeshFunctionObject
100  - Foam::functionObjects::writeFile
101  - ExtendedCodeGuide::functionObjects::field::wallShearStress
102 
103 SourceFiles
104  wallShearStress.C
105 
106 \*---------------------------------------------------------------------------*/
107 
108 #ifndef Foam_functionObjects_wallShearStress_H
109 #define Foam_functionObjects_wallShearStress_H
110 
111 #include "fvMeshFunctionObject.H"
112 #include "writeFile.H"
113 #include "volFieldsFwd.H"
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 namespace Foam
118 {
119 namespace functionObjects
120 {
121 
122 /*---------------------------------------------------------------------------*\
123  Class wallShearStress Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 class wallShearStress
127 :
128  public fvMeshFunctionObject,
129  public writeFile
130 {
131  // Private Data
132 
133  //- Write the shear stress field ?
134  bool writeFields_;
135 
136 
137 protected:
138 
139  // Protected Data
140 
141  //- Wall patches to process (optionally filtered by name)
143 
144 
145  // Protected Member Functions
146 
147  //- File header information
148  virtual void writeFileHeader(Ostream& os) const;
149 
150  //- Calculate the shear-stress
151  void calcShearStress
152  (
153  const volSymmTensorField& Reff,
154  volVectorField& shearStress
155  );
156 
157 
158 public:
159 
160  //- Runtime type information
161  TypeName("wallShearStress");
162 
163 
164  // Constructors
165 
166  //- Construct from Time and dictionary
168  (
169  const word& name,
170  const Time& runTime,
171  const dictionary&
172  );
173 
174  //- No copy construct
175  wallShearStress(const wallShearStress&) = delete;
176 
177  //- No copy assignment
178  void operator=(const wallShearStress&) = delete;
179 
180 
181  //- Destructor
182  virtual ~wallShearStress() = default;
183 
184 
185  // Member Functions
186 
187  //- Read the wallShearStress data
188  virtual bool read(const dictionary&);
189 
190  //- Calculate the wall shear-stress
191  virtual bool execute();
192 
193  //- Report min/max and log to file,
194  //- write the wall shear-stress volume field.
195  virtual bool write();
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace functionObjects
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:85
virtual bool read(const dictionary &)
Read the wallShearStress data.
virtual ~wallShearStress()=default
Destructor.
Forwards and collection of common volume field types.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
engineTime & runTime
wallShearStress(const word &name, const Time &runTime, const dictionary &)
Construct from Time and dictionary.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:82
const word & name() const noexcept
Return the name of this functionObject.
virtual bool execute()
Calculate the wall shear-stress.
void calcShearStress(const volSymmTensorField &Reff, volVectorField &shearStress)
Calculate the shear-stress.
virtual void writeFileHeader(Ostream &os) const
File header information.
labelList patchIDs_
Wall patches to process (optionally filtered by name)
void operator=(const wallShearStress &)=delete
No copy assignment.
OBJstream os(runTime.globalPath()/outputName)
virtual bool write()
Report min/max and log to file, write the wall shear-stress volume field.
List< label > labelList
A List of labels.
Definition: List.H:62
TypeName("wallShearStress")
Runtime type information.
Namespace for OpenFOAM.