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-2018 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 fileID
108  {
109  HEIGHT_FILE = 0,
110  POSITION_FILE = 1
111  };
112 
113 
114 protected:
115 
116  // Protected Member Functions
117 
118  //- Output file header information
119  virtual void writeFileHeader(const label i = 0);
120 
121 
122 public:
123 
124  //- Runtime type information
125  TypeName("interfaceHeight");
126 
127 
128  // Constructors
129 
130  //- Construct from Time and dictionary
132  (
133  const word& name,
134  const Time& runTime,
135  const dictionary& dict
136  );
137 
138 
139  //- Destructor
140  virtual ~interfaceHeight();
141 
142 
143  // Member Functions
144 
145  //- Read
146  virtual bool read(const dictionary&);
147 
148  //- Execute
149  virtual bool execute();
150 
151  //- Execute at the final time-loop
152  virtual bool end();
153 
154  //- Write
155  virtual bool write();
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace functionObjects
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
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:137
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.
virtual bool end()
Execute at the final time-loop.
virtual bool read(const dictionary &)
Read.
Namespace for OpenFOAM.