interfaceTrackingFvMesh.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) 2019 Zeljko Tukovic, FSB Zagreb.
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::interfaceTrackingFvMesh
29
30Description
31 The interfaceTrackingFvMesh
32
33SourceFiles
34 interfaceTrackingFvMesh.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef interfaceTrackingFvMesh_H
39#define interfaceTrackingFvMesh_H
40
42#include "regIOobject.H"
43#include "faCFD.H"
44#include "volFields.H"
45#include "surfaceFields.H"
48#include "demandDrivenData.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class interfaceTrackingFvMesh Declaration
57\*---------------------------------------------------------------------------*/
60:
62{
63 // Private Data
64
65 //- Finite area mesh
66 autoPtr<faMesh> aMeshPtr_;
67
68 //- Free surface patch index
69 label fsPatchIndex_;
70
71 //- Free surface faPatch-es which do not move
72 wordList fixedFreeSurfacePatches_;
73
74 //- Free surface faPatch-es where wave shuld not reflect
75 wordList nonReflectingFreeSurfacePatches_;
76
77 //- Free surface patches for which point normals must be corrected
78 wordList pointNormalsCorrectionPatches_;
79
80 //- Is it free-surface points displacement direction
81 // parallel with free-surface point normals
82 Switch normalMotionDir_;
83
84 //- Free-surface points displacement direction
85 // if not normal motion direction
86 vector motionDir_;
87
88 //- Interface smoothing at the beginning of time step
89 Switch smoothing_;
90
91 //- Pure free-surface
92 Switch pureFreeSurface_;
93
94 //- Rigid free-surface
95 Switch rigidFreeSurface_;
96
97 //- Correct contact line point normals
98 Switch correctContactLineNormals_;
99
100 //- Surface tension coefficient of pure free-surface
101 dimensionedScalar sigma0_;
102
103 //- Fluid density
105
106 //- Current interface tracking time index
107 label timeIndex_;
108
109 //- Free-surface velocity field
110 mutable areaVectorField* UsPtr_;
111
112 //- Points which are attached to the free-surface A side faces
113 // and which defines the free-surface shape
114 mutable vectorIOField* controlPointsPtr_;
115
116 //- Field which additionally determines
117 // the motion of free-surface points
118 mutable labelList* motionPointsMaskPtr_;
119
120 //- Displacement direction of free-surface points
121 mutable vectorField* pointsDisplacementDirPtr_;
122
123 //- Displacement direction of free-surface control points
124 mutable vectorField* facesDisplacementDirPtr_;
125
126 //- Free-surface net flux
127 mutable areaScalarField* fsNetPhiPtr_;
128
129 //- Free-surface flux
130 mutable edgeScalarField* phisPtr_;
131
132 //- Free-surface surfactant concetration
133 mutable areaScalarField* surfactConcPtr_;
134
135 //- Volume surfactant concetration
136 mutable volScalarField* bulkSurfactConcPtr_;
137
138 //- Surface tension field
139 mutable areaScalarField* surfaceTensionPtr_;
140
141 //- Surfactant properties
142 mutable surfactantProperties* surfactantPtr_;
143
144 //- Contact angle
145 mutable areaScalarField* contactAnglePtr_;
146
147 // Private Member Functions
148
149 // Make demand-driven data
150
151 //- Create free surface velocity field
152 void makeUs() const;
153
154 //- Create control points
155 void makeControlPoints();
156
157 //- Create motion points mask
158 void makeMotionPointsMask();
159
160 //- Create points and control point motion direction
161 void makeDirections();
162
163 //- Create free surface net flux
164 void makeFsNetPhi() const;
165
166 //- Create free-surface flux
167 void makePhis();
168
169 //- Create surfactant volume concentration field
170 void makeBulkSurfactConc() const;
171
172 //- Create surfactant concentration field
173 void makeSurfactConc() const;
174
175 //- Create surface tension field
176 void makeSurfaceTension() const;
177
178 //- Create surfactant properties
179 void makeSurfactant() const;
180
181 //- Create contact angle
182 void makeContactAngle();
183
184 //- No copy construct
186
187 //- No copy assignment
188 void operator=(const interfaceTrackingFvMesh&) = delete;
189
190 //- Initialize data
191 void initializeData();
192
193 //- Update control points end displacement directions
194 void updateDisplacementDirections();
195
196 //- Initialize control points position
197 void initializeControlPointsPosition();
198
199 //- Calculate free surface points displacement
200 // for given new control points position
201 tmp<vectorField> pointDisplacement();
202
203 //- Calc least sqare plane point and normal
204 tmp<vectorField> lsPlanePointAndNormal
205 (
206 const vectorField& points,
207 const vector& origin,
208 const vector& axis
209 ) const;
210
211 //- Smooth free-surface mesh
212 void smoothFreeSurfaceMesh();
213
214 //- Update free-surface flux
215 void updateSurfaceFlux();
216
217 //- Update free-surface surfactant concentration
218 void updateSurfactantConcentration();
219
220 //- Calculate total pressure force
221 vector totalPressureForce() const;
222
223 //- Calculate total viscous force
224 vector totalViscousForce() const;
225
226 //- Calculate total surface tension force
227 vector totalSurfaceTensionForce() const;
228
229 //- Maximal surface tension based Courant number
230 scalar maxCourantNumber();
231
232 //- Update properties
233 void updateProperties();
234
235 //- Correct free surface point normals at contact line
236 void correctContactLinePointNormals();
237
238 //- Correct free surface point displacement next to fixed contact line
239 void correctPointDisplacement
240 (
241 const scalarField& sweptVolCorr,
242 vectorField& displacement
243 );
244
245public:
246
247 //- Runtime type information
248 TypeName("interfaceTrackingFvMesh");
249
250
251 // Constructors
252
253 //- Construct from IOobject
254 interfaceTrackingFvMesh(const IOobject& io, const bool doInit=true);
255/*
256 //- Construct from components without boundary.
257 // Boundary is added using addFvPatches() member function
258 interfaceTrackingFvMesh
259 (
260 const IOobject& io,
261 pointField&& points,
262 faceList&& faces,
263 labelList&& allOwner,
264 labelList&& allNeighbour,
265 const bool syncPar = true
266 );
267*/
268
269 //- Destructor
271
272
273 // Member Functions
274
275 //- Initialise all non-demand-driven data
276 virtual bool init(const bool doInit);
278 fvMesh& mesh()
279 {
280 return *this;
281 }
283 const fvMesh& mesh() const
284 {
285 return *this;
286 }
287
288 //- Return reference to finite area mesh
289 faMesh& aMesh()
290 {
291 return aMeshPtr_();
292 }
293
294 //- Return reference to finite area mesh
295 const faMesh& aMesh() const
296 {
297 return aMeshPtr_();
298 }
300 const label& fsPatchIndex() const
301 {
302 return fsPatchIndex_;
303 }
304
305 //- Pure free-surface
306 const Switch& pureFreeSurface() const
307 {
308 return pureFreeSurface_;
309 }
310
311 //- Rigid free-surface
312 const Switch& rigidFreeSurface() const
313 {
314 return rigidFreeSurface_;
315 }
316
317 //- Rigid free-surface
319 {
320 return rigidFreeSurface_;
321 }
322
323 //- Correct contact line point normals
324 const Switch& correctContactLineNormals() const
325 {
326 return correctContactLineNormals_;
327 }
328
329 //- Correct contact line point normals
331 {
332 return correctContactLineNormals_;
333 }
334
335 //- Surface tension coefficient of pure free-surface
336 const dimensionedScalar& sigma() const
337 {
338 return sigma0_;
339 }
340
341 //- Return free-surface velocity field
343
344 //- Return free-surface velocity field
345 const areaVectorField& Us() const;
346
347 //- Return free-surface net flux
348 const areaScalarField& fsNetPhi() const;
349
350 //- Return free-surface net flux
352
353 //- Correct surface velocity boundary conditions
355
356 //- Update free-surface velocity field
357 void updateUs();
358
359 //- Return constant reference to velocity field
360 const volVectorField& U() const;
361
362 //- Return constant reference to pressure field
363 const volScalarField& p() const;
364
365 //- Return constant reference to velocity field
366 const surfaceScalarField& phi() const;
367
368 //- Return free surface normal derivative of velocity
370
371 //- Return free surface normal derivative of normal velocity comp
373
374 //- Return free surface pressure jump
376
377 //- Return control points
379
380 //- Return reference to motion points mask field
382
383 //- Return reference to point displacement direction field
385
386 //- Return reference to control points displacement direction field
388
389 //- Motion direction swithc
390 bool normalMotionDir() const
391 {
392 return normalMotionDir_;
393 }
394
395 //- Return free-surface fluid flux field
397
398 //- Return free-surface surfactant concentration field
400
401 //- Return free-surface surfactant concentration field
403
404 //- Return volume surfactant concentration field
406
407 //- Return volume surfactant concentration field
409
410 //- Return surface tension field
412
413 //- Return surface tension field
414 const areaScalarField& surfaceTension() const;
415
416 //- Return surface tension gradient
418
419 //- Return surfactant properties
420 const surfactantProperties& surfactant() const;
421
422 //- Update the mesh for both mesh motion and topology change
423 virtual bool update();
424
425 //- Clear control points
426 void clearControlPoints()
427 {
428 deleteDemandDrivenData(controlPointsPtr_);
429 }
430
431 //- Write VTK freeSurface mesh
432 void writeVTK() const;
433
434 //- Write VTK freeSurface control points
436};
437
438
439// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
440
441} // End namespace Foam
442
443// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
444
445#endif
446
447// ************************************************************************* //
A primitive field of type <T> with automated input and output.
Definition: IOField.H:58
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:78
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
The dynamicMotionSolverFvMesh.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:100
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
The interfaceTrackingFvMesh.
vectorField & controlPoints()
Return control points.
const Switch & pureFreeSurface() const
Pure free-surface.
void correctUsBoundaryConditions()
Correct surface velocity boundary conditions.
areaVectorField & Us()
Return free-surface velocity field.
TypeName("interfaceTrackingFvMesh")
Runtime type information.
const areaScalarField & fsNetPhi() const
Return free-surface net flux.
const surfaceScalarField & phi() const
Return constant reference to velocity field.
tmp< scalarField > freeSurfaceSnGradUn()
Return free surface normal derivative of normal velocity comp.
vectorField & pointsDisplacementDir()
Return reference to point displacement direction field.
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
const volVectorField & U() const
Return constant reference to velocity field.
void writeVTK() const
Write VTK freeSurface mesh.
const Switch & correctContactLineNormals() const
Correct contact line point normals.
void updateUs()
Update free-surface velocity field.
areaScalarField & surfaceTension()
Return surface tension field.
vectorField & facesDisplacementDir()
Return reference to control points displacement direction field.
void writeVTKControlPoints()
Write VTK freeSurface control points.
faMesh & aMesh()
Return reference to finite area mesh.
virtual bool update()
Update the mesh for both mesh motion and topology change.
Switch & rigidFreeSurface()
Rigid free-surface.
const dimensionedScalar & sigma() const
Surface tension coefficient of pure free-surface.
Switch & correctContactLineNormals()
Correct contact line point normals.
tmp< areaVectorField > surfaceTensionGrad()
Return surface tension gradient.
labelList & motionPointsMask()
Return reference to motion points mask field.
volScalarField & bulkSurfactantConcentration()
Return volume surfactant concentration field.
bool normalMotionDir() const
Motion direction swithc.
const volScalarField & p() const
Return constant reference to pressure field.
const Switch & rigidFreeSurface() const
Rigid free-surface.
const surfactantProperties & surfactant() const
Return surfactant properties.
areaScalarField & surfactantConcentration()
Return free-surface surfactant concentration field.
edgeScalarField & Phis()
Return free-surface fluid flux field.
tmp< scalarField > freeSurfacePressureJump()
Return free surface pressure jump.
tmp< vectorField > freeSurfaceSnGradU()
Return free surface normal derivative of velocity.
const faMesh & aMesh() const
Return reference to finite area mesh.
void clearControlPoints()
Clear control points.
A class for managing temporary objects.
Definition: tmp.H:65
Template functions to aid in the implementation of demand driven data.
const pointField & points
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
void deleteDemandDrivenData(DataPtr &dataPtr)
Foam::surfaceFields.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73