The open source CFD toolbox
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-------------------------------------------------------------------------------
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
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 | $FOAM_CASE/postProcessing/<FO>/<time>/height 45 output file 2 | dat |$FOAM_CASE/postProcessing/<FO>/<time>/position
46 output field | - | -
47 \endtable
48
49Usage
50 Minimal example by using \c system/controlDict.functions:
51 \verbatim
52 interfaceHeight1
53 {
54 // Mandatory entries (unmodifiable)
55 type interfaceHeight;
56 libs (fieldFunctionObjects);
57
58 // Mandatory entries (runtime modifiable)
59 locations ((0 0 0) (10 0 0) (20 0 0));
60
61 // Optional entries (runtime modifiable)
62 alpha alpha.water;
63 liquid true;
64 direction (1 0 0);
65 interpolationScheme cellPoint;
66
67 // Optional (inherited) entries
68 ...
69 }
70 \endverbatim
71
72 where the entries mean:
73 \table
74 Property | Description | Type | Req'd | Dflt
75 type | Type name: interfaceHeight | word | yes | -
76 libs | Library name: fieldFunctionObjects | word | yes | -
77 locations | Locations to report the height at | vectorList | yes | -
78 alpha | Name of alpha field | word | no | alpha
79 liquid | Flag if the alpha field that of the liquid | bool | no | true
80 direction | Direction of interface | vector | no | g
81 interpolationScheme | Interpolation scheme | word | no | cellPoint
82 \endtable
83
84 The inherited entries are elaborated in:
87
88 Usage by the \c postProcess utility is not available.
89
91 - Foam::functionObject
92 - Foam::functionObjects::fvMeshFunctionObject
93 - Foam::functionObjects::writeFile
94 - Foam::functionObjects::logFile
95 - ExtendedCodeGuide::functionObjects::field::interfaceHeight
96
97SourceFiles
98 interfaceHeight.C
99
100\*---------------------------------------------------------------------------*/
101
102#ifndef interfaceHeight_H
103#define interfaceHeight_H
104
105#include "fvMeshFunctionObject.H"
106#include "logFiles.H"
107#include "point.H"
108
109// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110
111namespace Foam
112{
113namespace functionObjects
114{
115
116/*---------------------------------------------------------------------------*\
117 Class interfaceHeight Declaration
118\*---------------------------------------------------------------------------*/
119
120class interfaceHeight
121:
122 public fvMeshFunctionObject,
123 public logFiles
124{
125 // Private Data
126
127 //- Is the alpha field that of the liquid under the wave?
128 bool liquid_;
129
130 //- Name of the alpha field
131 word alphaName_;
132
133 //- Interpolation scheme
134 word interpolationScheme_;
135
136 //- Direction of interface motion
137 vector direction_;
138
139 //- List of locations to report the height at
140 List<point> locations_;
141
142
143 // Private Member Functions
144
145 //- Output positions
146 void writePositions();
147
148
149 // Private Enumerations
150
151 //- File enumeration
152 enum class fileID
153 {
154 heightFile = 0,
155 positionFile = 1
156 };
157
158
159protected:
160
161 // Protected Member Functions
162
163 //- Output file header information
164 virtual void writeFileHeader(const fileID fid);
165
166
167public:
168
169 //- Runtime type information
170 TypeName("interfaceHeight");
171
172
173 // Constructors
174
175 //- Construct from Time and dictionary
177 (
178 const word& name,
179 const Time& runTime,
180 const dictionary& dict
181 );
182
183 //- No copy construct
184 interfaceHeight(const interfaceHeight&) = delete;
185
186 //- No copy assignment
187 void operator=(const interfaceHeight&) = delete;
188
189
190 //- Destructor
191 virtual ~interfaceHeight() = default;
192
193
194 // Member Functions
195
196 //- Inherit logFiles methods
197 using logFiles::files;
198
199 //- Return file corresponding to enumeration
200 OFstream& files(const fileID fid)
201 {
202 return logFiles::files(label(fid));
203 }
204
205
208
209 //- Execute
210 virtual bool execute();
211
212 //- Execute at the final time-loop
213 virtual bool end();
214
215 //- Write
216 virtual bool write();
217};
218
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222} // End namespace functionObjects
223} // End namespace Foam
224
225// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226
227#endif
228
229// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
Output to file stream, using an OSstream.
Definition: OFstream.H:57
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
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...
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 Time and dictionary.
PtrList< OFstream > & files()
Inherit logFiles methods.
Definition: logFiles.C:116
TypeName("interfaceHeight")
Runtime type information.
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 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:62
PtrList< OFstream > & files()