Loading...
Searching...
No Matches
interfaceHeight.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) 2017-2019 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::functionObjects::interfaceHeight
29
30Description
31 This function object reports the height of the interface above a set of
32 locations.
33
34 For each location, it writes the vertical distance of the
35 interface above both the location and the lowest boundary. It also writes
36 the point on the interface from which these heights are computed. It uses
37 an integral approach, so if there are multiple interfaces above or below a
38 location then this method will generate average values.
39
40 Operands:
41 \table
42 Operand | Type | Location
43 input | - | -
44 output file 1 | dat | postProcessing/<FO>/<time>/height
45 output file 2 | dat | postProcessing/<FO>/<time>/position
46 output field | - | -
47 \endtable
48
49Usage
50 Minimal example by using \c system/controlDict.functions:
51 \verbatim
52 interfaceHeightFO
53 {
54 // Mandatory entries
55 type interfaceHeight;
56 libs (fieldFunctionObjects);
57 locations (<vectorList>); // ((0 0 0) (10 0 0) (20 0 0));
58
59 // Optional entries
60 alpha <word>; // alpha.water;
61 liquid <bool>;
62 direction <vector>;
63 interpolationScheme <word>;
64
65 // Inherited entries
66 ...
67 }
68 \endverbatim
69
70 where the entries mean:
71 \table
72 Property | Description | Type | Reqd | Deflt
73 type | Type name: interfaceHeight | word | yes | -
74 libs | Library name: fieldFunctionObjects | word | yes | -
75 locations | Locations to report the height at | vectorList | yes | -
76 alpha | Name of alpha field | word | no | alpha
77 liquid | Flag if the alpha field that of the liquid | bool | no | true
78 direction | Direction of interface | vector | no | g
79 interpolationScheme | Interpolation scheme | word | no | cellPoint
80 \endtable
81
82 The inherited entries are elaborated in:
83 - \link functionObject.H \endlink
84 - \link logFiles.H \endlink
85
86SourceFiles
87 interfaceHeight.C
88
89\*---------------------------------------------------------------------------*/
90
91#ifndef Foam_functionObjects_interfaceHeight_H
92#define Foam_functionObjects_interfaceHeight_H
93
95#include "logFiles.H"
96#include "point.H"
97
98// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99
100namespace Foam
101{
102namespace functionObjects
103{
104
105/*---------------------------------------------------------------------------*\
106 Class interfaceHeight Declaration
107\*---------------------------------------------------------------------------*/
108
109class interfaceHeight
110:
112 public logFiles
113{
114 // Private Data
115
116 //- Is the alpha field that of the liquid under the wave?
117 bool liquid_;
118
119 //- Name of the alpha field
120 word alphaName_;
121
122 //- Interpolation scheme
123 word interpolationScheme_;
124
125 //- Direction of interface motion
126 vector direction_;
127
128 //- List of locations to report the height at
129 List<point> locations_;
130
131
132 // Private Member Functions
133
134 //- Output positions
135 void writePositions();
136
137
138 // Private Enumerations
139
140 //- File enumeration
141 enum class fileID
142 {
143 heightFile = 0,
144 positionFile = 1
145 };
146
147
148protected:
149
150 // Protected Member Functions
151
152 //- Output file header information
153 virtual void writeFileHeader(const fileID fid);
154
155
156public:
157
158 //- Runtime type information
159 TypeName("interfaceHeight");
160
161
162 // Constructors
163
164 //- Construct from name, Time and dictionary
166 (
167 const word& name,
168 const Time& runTime,
169 const dictionary& dict
170 );
171
172 //- No copy construct
173 interfaceHeight(const interfaceHeight&) = delete;
174
175 //- No copy assignment
176 void operator=(const interfaceHeight&) = delete;
177
178
179 //- Destructor
180 virtual ~interfaceHeight() = default;
181
182
183 // Member Functions
184
185 //- Inherit logFiles methods
186 using logFiles::files;
187
188 //- Return file corresponding to enumeration
189 OFstream& files(const fileID fid)
190 {
191 return logFiles::files(label(fid));
192 }
193
194
195 // I-O
196
197 //- Read the function-object dictionary
198 virtual bool read(const dictionary& dict);
199
200 //- Execute the function-object operations
201 virtual bool execute();
202
203 //- Write the function-object results
204 virtual bool write();
205
206 //- Execute at the final time-loop
207 virtual bool end();
208};
209
210
211// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212
213} // End namespace functionObjects
214} // End namespace Foam
215
216// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218#endif
219
220// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Definition OFstream.H:75
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
This function object reports the height of the interface above a set of locations.
interfaceHeight(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
PtrList< OFstream > & files()
Inherit logFiles methods.
Definition logFiles.C:109
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
TypeName("interfaceHeight")
Runtime type information.
virtual void writeFileHeader(const fileID fid)
Output file header information.
virtual bool execute()
Execute the function-object operations.
OFstream & files(const fileID fid)
Return file corresponding to enumeration.
void operator=(const interfaceHeight &)=delete
No copy assignment.
virtual ~interfaceHeight()=default
Destructor.
interfaceHeight(const interfaceHeight &)=delete
No copy construct.
virtual bool write()
Write the function-object results.
virtual bool end()
Execute at the final time-loop.
functionObject base class for creating, maintaining and writing log files e.g. integrated or averaged...
Definition logFiles.H:58
PtrList< OFstream > & files()
Return access to the files.
Definition logFiles.C:109
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
Vector< scalar > vector
Definition vector.H:57
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68