interfaceHeight.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) 2017-2019 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::interfaceHeight
26 
27 Description
28  This function object reports the height of the interface above a set of
29  locations. For each location, it writes the vertical distance of the
30  interface above both the location and the lowest boundary. It also writes
31  the point on the interface from which these heights are computed. It uses
32  an integral approach, so if there are multiple interfaces above or below a
33  location then this method will generate average values.
34 
35  Example of function object specification:
36  \verbatim
37  interfaceHeight1
38  {
39  type interfaceHeight;
40  libs ("libfieldFunctionObjects.so");
41  alpha alpha.water;
42  locations ((0 0 0) (10 0 0) (20 0 0));
43  }
44  \endverbatim
45 
46 Usage
47  \table
48  Property | Description | Required | Default value
49  type | type name | yes |
50  alpha | name of the alpha field | no | alpha
51  locations | list of locations to report the height at | yes |
52  liquid | is the alpha field that of the liquid | no | true
53  \endtable
54 
55 SourceFiles
56  interfaceHeight.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef interfaceHeight_H
61 #define interfaceHeight_H
62 
63 #include "fvMeshFunctionObject.H"
64 #include "logFiles.H"
65 #include "point.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace functionObjects
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class interfaceHeight Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class interfaceHeight
79 :
80  public fvMeshFunctionObject,
81  public logFiles
82 {
83  // Private Data
84 
85  //- Name of the alpha field
86  word alphaName_;
87 
88  //- Is the alpha field that of the liquid under the wave?
89  bool liquid_;
90 
91  //- List of locations to report the height at
92  List<point> locations_;
93 
94  //- Interpolation scheme
95  word interpolationScheme_;
96 
97 
98  // Private Member Functions
99 
100  //- Output positions
101  void writePositions();
103 
104  // Private Enumerations
105 
106  //- File enumeration
107  enum class fileID
108  {
109  heightFile = 0,
110  positionFile = 1
111  };
112 
113  using logFiles::file;
114 
115  Ostream& file(const fileID fid)
116  {
117  return logFiles::file(label(fid));
118  }
119 
120 
121 protected:
122 
123  // Protected Member Functions
124 
125  //- Output file header information
126  virtual void writeFileHeader(const label i = 0);
127 
128 
129 public:
130 
131  //- Runtime type information
132  TypeName("interfaceHeight");
133 
134 
135  // Constructors
136 
137  //- Construct from Time and dictionary
139  (
140  const word& name,
141  const Time& runTime,
142  const dictionary& dict
143  );
144 
145 
146  //- Destructor
147  virtual ~interfaceHeight();
148 
149 
150  // Member Functions
151 
152  //- Read
153  virtual bool read(const dictionary&);
154 
155  //- Execute
156  virtual bool execute();
157 
158  //- Execute at the final time-loop
159  virtual bool end();
160 
161  //- Write
162  virtual bool write();
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace functionObjects
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
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:158
TypeName("interfaceHeight")
Runtime type information.
engineTime & runTime
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
virtual void writeFileHeader(const label i=0)
Output file header information.
A class for handling words, derived from string.
Definition: word.H:59
interfaceHeight(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual bool end()
Execute at the final time-loop.
virtual bool read(const dictionary &)
Read.
OFstream & file()
Return access to the file (if only 1)
Definition: logFiles.C:120
Namespace for OpenFOAM.