Loading...
Searching...
No Matches
ITHACAforces.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3 ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4 ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5 ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6 ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7 ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9 * In real Time Highly Advanced Computational Applications for Finite Volumes
10 * Copyright (C) 2017 by the ITHACA-FV authors
11-------------------------------------------------------------------------------
12License
13 This file is part of ITHACA-FV
14 ITHACA-FV is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Lesser 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 ITHACA-FV is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
24\*---------------------------------------------------------------------------*/
25
26#ifndef functionObjects_ITHACAforces_H
27#define functionObjects_ITHACAforces_H
28
29#include "fvMeshFunctionObject.H"
30#include "logFiles.H"
31#include "coordinateSystem.H"
32#include "volFieldsFwd.H"
33#include "HashSet.H"
34
35// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36
37namespace Foam
38{
39namespace functionObjects
40{
41
42/*---------------------------------------------------------------------------*\
43 Class forces Declaration
44\*---------------------------------------------------------------------------*/
45
46class ITHACAforces
47 :
48 public fvMeshFunctionObject,
49 public logFiles
50{
51
52 protected:
53
54 // Protected data
55
56 //- Enumeration for ensuring the right file is accessed
57 enum fileID
58 {
60 BINS_FILE = 1
61 };
62
63 //- Pressure, viscous and porous force per bin
64 List<Field<vector>> force_;
65
66 //- Pressure, viscous and porous moment per bin
67 List<Field<vector>> moment_;
68
69
70 // Read from dictionary
71
72 //- Patches to integrate forces over
73 labelHashSet patchSet_;
74
75 //- Name of pressure field
76 word pName_;
77
78 //- Name of velocity field
79 word UName_;
80
81 //- Name of density field (optional)
83
84 //- Is the force density being supplied directly?
86
87 //- The name of the force density (fD) field
88 word fDName_;
89
90 //- Reference density needed for incompressible calculations
91 scalar rhoRef_;
92
93 //- Reference pressure
94 scalar pRef_;
95
96 //- Coordinate system used when evaluting forces/moments
97 coordinateSystem coordSys_;
98
99 //- Flag to indicate whether we are using a local co-ordinate sys
101
102 //- Flag to include porosity effects
104
105
106 // Bin information
107
108 //- Number of bins
109 label nBin_;
110
111 //- Direction used to determine bin orientation
112 vector binDir_;
113
114 //- Distance between bin divisions
115 scalar binDx_;
116
117 //- Minimum bin bounds
118 scalar binMin_;
119
120 //- Bin positions along binDir
121 List<point> binPoints_;
122
123 //- Should bin data be cumulative?
125
126
127 //- Initialised flag
129
130
131 // Protected Member Functions
132
133 //- Create file names for forces and bins
134 wordList createFileNames(const dictionary& dict) const;
135
136 //- Output file header information
137 virtual void writeFileHeader(const label i);
138
139 //- Initialise the fields
140 void initialise();
141
142 //- Return the effective viscous stress (laminar + turbulent).
143 tmp<volSymmTensorField> devRhoReff() const;
144
145 //- Dynamic viscosity field
146 tmp<volScalarField> mu() const;
147
148 //- Return rho if specified otherwise rhoRef
149 tmp<volScalarField> rho() const;
150
151 //- Return rhoRef if the pressure field is dynamic, i.e. p/rho
152 // otherwise return 1
153 scalar rho(const volScalarField& p) const;
154
155 //- Accumulate bin data
156 void applyBins
157 (
158 const vectorField& Md,
159 const vectorField& fN,
160 const vectorField& fT,
161 const vectorField& fP,
162 const vectorField& d
163 );
164
165 //- Helper function to write force data
166 void writeForces();
167
168 //- Helper function to write bin data
169 void writeBins();
170
171 //- Disallow default bitwise copy construct
173
174 //- Disallow default bitwise assignment
176
177
178 public:
179
180 //- Runtime type information
181 TypeName("ITHACAforces");
182
183
184 // Constructors
185
186 //- Construct from Time and dictionary
188 (
189 const word& name,
190 const Time& runTime,
191 const dictionary& dict
192 );
193
194 //- Construct from objectRegistry and dictionary
196 (
197 const word& name,
198 const objectRegistry& obr,
199 const dictionary&
200 );
201
202
203 //- Destructor
204 virtual ~ITHACAforces();
205
206
207 // Member Functions
208
209 //- Read the forces data
210 virtual bool read(const dictionary&);
211
212 //- Calculate the forces and moments
213 virtual void calcForcesMoment();
214
215 //- Return the total force
216 virtual vector forceEff() const;
217
218 //- Return the total moment
219 virtual vector momentEff() const;
220
221 //- Return the viscous forces
222 virtual vector forceTau() const;
223
224 //- Return the pressure forces
225 virtual vector forcePressure() const;
226
227 //- Return the porous forces
228 virtual vector forcePorous() const;
229
230 //- Execute, currently does nothing
231 virtual bool execute();
232
233 //- Write the forces
234 virtual bool write();
235};
236
237
238// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239
240} // End namespace functionObjects
241} // End namespace Foam
242
243// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244
245#endif
246
247// ************************************************************************* //
Foam::Time & runTime
Definition createTime.H:33
turbulence read()
List< Field< vector > > moment_
virtual vector forcePressure() const
virtual void writeFileHeader(const label i)
virtual vector forcePorous() const
tmp< volScalarField > rho() const
tmp< volScalarField > mu() const
void applyBins(const vectorField &Md, const vectorField &fN, const vectorField &fT, const vectorField &fP, const vectorField &d)
wordList createFileNames(const dictionary &dict) const
List< Field< vector > > force_
tmp< volSymmTensorField > devRhoReff() const
void operator=(const ITHACAforces &)
ITHACAforces(const ITHACAforces &)
volScalarField & p
label i
Definition pEqn.H:46