sampledInterface.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) 2020 DLR
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::sampledInterface
29
30Description
31 A sampledSurface that calculates the PLIC interface in VoF simulations
32 Only works in combination with isoAdvector and a reconstruction scheme
33
34 This is often embedded as part of a sampled surfaces function object.
35
36Usage
37 Example of function object partial specification:
38 \verbatim
39 surfaces
40 {
41 freeSurf
42 {
43 type interface;
44 interpolate false;
45 }
46 }
47 \endverbatim
48
49 Where the sub-entries comprise:
50 \table
51 Property | Description | Required | Default
52 type | interface | yes |
53 \endtable
54
55 Original code supplied by Henning Scheufler, DLR (2019)
56
57SourceFiles
58 sampledInterface.C
59
60\*---------------------------------------------------------------------------*/
61
62#ifndef sampledInterface_H
63#define sampledInterface_H
64
65#include "sampledSurface.H"
66#include "ZoneIDs.H"
67#include "fvMeshSubset.H"
69
70// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71
72namespace Foam
73{
74
75/*---------------------------------------------------------------------------*\
76 Class sampledInterface Declaration
77\*---------------------------------------------------------------------------*/
78
79class sampledInterface
80:
81 public sampledSurface
82{
83 // Private Data
84
85 //- Restrict to given cell zones
86 wordRes zoneNames_;
87
88 //- For zones: patch to put exposed faces into
89 mutable word exposedPatchName_;
90
92
93
94 // Recreated for every interface
95
96 //- Time at last call, also track if surface needs an update
97 mutable label prevTimeIndex_;
98
99 //- Cached submesh
100 mutable autoPtr<fvMeshSubset> subMeshPtr_;
101
102
103 // Private Member Functions
104
105 //- Create iso surface (if time has changed)
106 // Do nothing (and return false) if no update was needed
107 bool updateGeometry() const;
108
109 //- Sample volume field onto surface faces
110 template<class Type>
111 tmp<Field<Type>> sampleOnFaces
112 (
113 const interpolation<Type>& sampler
114 ) const;
115
116 //- Interpolate volume field onto surface points
117 template<class Type>
118 tmp<Field<Type>> sampleOnPoints
119 (
120 const interpolation<Type>& interpolator
121 ) const;
122
123
124public:
125
126 //- Runtime type information
127 TypeName("sampledInterface");
128
129
130 // Constructors
131
132 //- Construct from dictionary
134 (
135 const word& name,
137 const dictionary& dict
138 );
139
140
141 //- Destructor
142 virtual ~sampledInterface() = default;
143
144
145 // Member Functions
146
148 {
149 return surfPtr_();
150 }
152 //- Does the surface need an update?
153 virtual bool needsUpdate() const;
154
155 //- Mark the surface as needing an update.
156 // May also free up unneeded data.
157 // Return false if surface was already marked as expired.
158 virtual bool expire();
159
160 //- Update the surface as required.
161 // Do nothing (and return false) if no update was needed
162 virtual bool update();
163
164
165 //- Points of surface
166 virtual const pointField& points() const
167 {
168 return surface().points();
169 }
170
171 //- Faces of surface
172 virtual const faceList& faces() const
173 {
174 return surface().surfFaces();
176
177 //- Const access to per-face zone/region information
178 virtual const labelList& zoneIds() const
179 {
180 return labelList::null();
182
183 //- Face area magnitudes
184 virtual const vectorField& Sf() const
185 {
186 return surface().Sf();
188
189 //- Face area magnitudes
190 virtual const scalarField& magSf() const
191 {
192 return surface().magSf();
194
195 //- Face centres
196 virtual const vectorField& Cf() const
197 {
198 return surface().Cf();
200
201
202 // Sample
203
204 //- Sample volume field onto surface faces
206 (
207 const interpolation<scalar>& sampler
208 ) const;
209
210 //- Sample volume field onto surface faces
212 (
213 const interpolation<vector>& sampler
214 ) const;
215
216 //- Sample volume field onto surface faces
218 (
219 const interpolation<sphericalTensor>& sampler
220 ) const;
221
222 //- Sample volume field onto surface faces
224 (
225 const interpolation<symmTensor>& sampler
226 ) const;
227
228 //- Sample volume field onto surface faces
230 (
231 const interpolation<tensor>& sampler
232 ) const;
233
234
235 // Interpolate
236
237 //- Interpolate volume field onto surface points
239 (
240 const interpolation<scalar>& interpolator
241 ) const;
242
243 //- Interpolate volume field onto surface points
245 (
246 const interpolation<vector>& interpolator
247 ) const;
248
249 //- Interpolate volume field onto surface points
251 (
252 const interpolation<sphericalTensor>& interpolator
253 ) const;
254
255 //- Interpolate volume field onto surface points
257 (
258 const interpolation<symmTensor>& interpolator
259 ) const;
260
261 //- Interpolate volume field onto surface points
263 (
264 const interpolation<tensor>& interpolator
265 ) const;
266
267
268 // Output
269
270 //- Print information
271 virtual void print(Ostream& os, int level=0) const;
272};
273
274
275// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276
277} // End namespace Foam
278
279// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280
281#ifdef NoRepository
283#endif
284
285// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286
287#endif
288
289// ************************************************************************* //
Minimal example by using system/controlDict.functions:
static const List< label > & null()
Return a null List.
Definition: ListI.H:109
const vectorField & Sf() const
Face area vectors (normals)
const scalarField & magSf() const
Face area magnitudes.
const vectorField & Cf() const
Face centres.
const List< Face > & surfFaces() const
Return const access to the faces.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
const Field< point_type > & points() const noexcept
Return reference to global points.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Abstract base class for volume field interpolation.
Definition: interpolation.H:60
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A sampledSurface that calculates the PLIC interface in VoF simulations Only works in combination with...
virtual const pointField & points() const
Points of surface.
virtual void print(Ostream &os, int level=0) const
Print information.
const reconstructionSchemes::interface & surface() const
virtual const faceList & faces() const
Faces of surface.
virtual const vectorField & Cf() const
Face centres.
virtual const labelList & zoneIds() const
Const access to per-face zone/region information.
virtual const scalarField & magSf() const
Face area magnitudes.
virtual bool expire()
Mark the surface as needing an update.
virtual bool needsUpdate() const
Does the surface need an update?
virtual bool update()
Update the surface as required.
virtual const vectorField & Sf() const
Face area magnitudes.
TypeName("sampledInterface")
Runtime type information.
virtual ~sampledInterface()=default
Destructor.
An abstract class for surfaces with sampling.
const word & name() const noexcept
Name of surface.
const polyMesh & mesh() const noexcept
Access to the underlying mesh.
bool interpolate() const noexcept
Same as isPointData()
A class for managing temporary objects.
Definition: tmp.H:65
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73