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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::interfaceTrackingFvMesh
28 
29 Description
30  The interfaceTrackingFvMesh
31 
32 SourceFiles
33  interfaceTrackingFvMesh.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef interfaceTrackingFvMesh_H
38 #define interfaceTrackingFvMesh_H
39 
41 #include "regIOobject.H"
42 #include "faCFD.H"
43 #include "volFields.H"
44 #include "surfaceFields.H"
45 #include "surfactantProperties.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class interfaceTrackingFvMesh Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
60 {
61  // Private Data
62 
63  //- Finite area mesh
64  autoPtr<faMesh> aMeshPtr_;
65 
66  //- Free surface patch index
67  label fsPatchIndex_;
68 
69  //- Free surface faPatch-es which do not move
70  wordList fixedFreeSurfacePatches_;
71 
72  //- Free surface faPatch-es where wave shuld not reflect
73  wordList nonReflectingFreeSurfacePatches_;
74 
75  //- Free surface patches for which point normals must be corrected
76  wordList pointNormalsCorrectionPatches_;
77 
78  //- Is it free-surface points displacement direction
79  // parallel with free-surface point normals
80  Switch normalMotionDir_;
81 
82  //- Free-surface points displacement direction
83  // if not normal motion direction
84  vector motionDir_;
85 
86  //- Interface smoothing at the begining of time step
87  Switch smoothing_;
88 
89  //- Pure free-surface
90  Switch pureFreeSurface_;
91 
92  //- Rigid free-surface
93  Switch rigidFreeSurface_;
94 
95  //- Correct contact line point normals
96  Switch correctContactLineNormals_;
97 
98  //- Surface tension coefficient of pure free-surface
99  dimensionedScalar sigma0_;
100 
101  //- Fluid density
102  dimensionedScalar rho_;
103 
104  //- Current interface tracking time index
105  label timeIndex_;
106 
107  //- Free-surface velocity field
108  mutable areaVectorField* UsPtr_;
109 
110  //- Points which are attached to the free-surface A side faces
111  // and which defines the free-surface shape
112  mutable vectorIOField* controlPointsPtr_;
113 
114  //- Field which additionally determines
115  // the motion of free-surface points
116  mutable labelList* motionPointsMaskPtr_;
117 
118  //- Displacement direction of free-surface points
119  mutable vectorField* pointsDisplacementDirPtr_;
120 
121  //- Displacement direction of free-surface control points
122  mutable vectorField* facesDisplacementDirPtr_;
123 
124  //- Free-surface net flux
125  mutable areaScalarField* fsNetPhiPtr_;
126 
127  //- Free-surface flux
128  mutable edgeScalarField* phisPtr_;
129 
130  //- Free-surface surfactant concetration
131  mutable areaScalarField* surfactConcPtr_;
132 
133  //- Volume surfactant concetration
134  mutable volScalarField* bulkSurfactConcPtr_;
135 
136  //- Surface tension field
137  mutable areaScalarField* surfaceTensionPtr_;
138 
139  //- Surfactant properties
140  mutable surfactantProperties* surfactantPtr_;
141 
142  //- Contact angle
143  mutable areaScalarField* contactAnglePtr_;
144 
145  // Private Member Functions
146 
147  // Make demand-driven data
148 
149  //- Create free surface velocity field
150  void makeUs() const;
151 
152  //- Create control points
153  void makeControlPoints();
154 
155  //- Create motion points mask
156  void makeMotionPointsMask();
157 
158  //- Create points and control point motion direction
159  void makeDirections();
160 
161  //- Create free surface net flux
162  void makeFsNetPhi() const;
163 
164  //- Create free-surface flux
165  void makePhis();
166 
167  //- Create surfactant volume concentration field
168  void makeBulkSurfactConc() const;
169 
170  //- Create surfactant concentration field
171  void makeSurfactConc() const;
172 
173  //- Create surface tension field
174  void makeSurfaceTension() const;
175 
176  //- Create surfactant properties
177  void makeSurfactant() const;
178 
179  //- Create contact angle
180  void makeContactAngle();
181 
182  //- No copy construct
184 
185  //- No copy assignment
186  void operator=(const interfaceTrackingFvMesh&) = delete;
187 
188  //- Initialize data
189  void initializeData();
190 
191  //- Update control points end displacement directions
192  void updateDisplacementDirections();
193 
194  //- Initialize control points position
195  void initializeControlPointsPosition();
196 
197  //- Calculate free surface points displacement
198  // for given new control points position
199  tmp<vectorField> pointDisplacement();
200 
201  //- Calc least sqare plane point and normal
202  tmp<vectorField> lsPlanePointAndNormal
203  (
204  const vectorField& points,
205  const vector& origin,
206  const vector& axis
207  ) const;
208 
209  //- Smooth free-surface mesh
210  void smoothFreeSurfaceMesh();
211 
212  //- Update free-surface flux
213  void updateSurfaceFlux();
214 
215  //- Update free-surface surfactant concentration
216  void updateSurfactantConcentration();
217 
218  //- Calculate total pressure force
219  vector totalPressureForce() const;
220 
221  //- Calculate total viscous force
222  vector totalViscousForce() const;
223 
224  //- Calculate total surface tension force
225  vector totalSurfaceTensionForce() const;
226 
227  //- Maximal surface tension based Courant number
228  scalar maxCourantNumber();
229 
230  //- Update properties
231  void updateProperties();
232 
233  //- Correct free surface point normals at contact line
234  void correctContactLinePointNormals();
235 
236  //- Correct free surface point displacement next to fixed contact line
237  void correctPointDisplacement
238  (
239  const scalarField& sweptVolCorr,
240  vectorField& displacement
241  );
242 
243 public:
244 
245  //- Runtime type information
246  TypeName("interfaceTrackingFvMesh");
247 
248 
249  // Constructors
250 
251  //- Construct from IOobject
253 
254  //- Construct from components without boundary.
255  // Boundary is added using addFvPatches() member function
257  (
258  const IOobject& io,
259  pointField&& points,
260  faceList&& faces,
261  labelList&& allOwner,
262  labelList&& allNeighbour,
263  const bool syncPar = true
264  );
265 
266 
267  //- Destructor
269 
270 
271  // Member Functions
272 
273  fvMesh& mesh()
274  {
275  return *this;
276  }
277 
278  const fvMesh& mesh() const
279  {
280  return *this;
281  }
282 
283  //- Return reference to finite area mesh
284  faMesh& aMesh()
285  {
286  return aMeshPtr_();
287  }
288 
289  //- Return reference to finite area mesh
290  const faMesh& aMesh() const
291  {
292  return aMeshPtr_();
293  }
294 
295  const label& fsPatchIndex() const
296  {
297  return fsPatchIndex_;
298  }
299 
300  //- Pure free-surface
301  const Switch& pureFreeSurface() const
302  {
303  return pureFreeSurface_;
304  }
305 
306  //- Rigid free-surface
307  const Switch& rigidFreeSurface() const
308  {
309  return rigidFreeSurface_;
310  }
311 
312  //- Rigid free-surface
314  {
315  return rigidFreeSurface_;
316  }
317 
318  //- Correct contact line point normals
319  const Switch& correctContactLineNormals() const
320  {
321  return correctContactLineNormals_;
322  }
323 
324  //- Correct contact line point normals
326  {
327  return correctContactLineNormals_;
328  }
329 
330  //- Surface tension coefficient of pure free-surface
331  const dimensionedScalar& sigma() const
332  {
333  return sigma0_;
334  }
335 
336  //- Return free-surface velocity field
337  areaVectorField& Us();
338 
339  //- Return free-surface velocity field
340  const areaVectorField& Us() const;
341 
342  //- Return free-surface net flux
343  const areaScalarField& fsNetPhi() const;
344 
345  //- Return free-surface net flux
347 
348  //- Correct surface velocity boundary conditions
350 
351  //- Update free-surface velocity field
352  void updateUs();
353 
354  //- Return constant reference to velocity field
355  const volVectorField& U() const;
356 
357  //- Return constant reference to pressure field
358  const volScalarField& p() const;
359 
360  //- Return constant reference to velocity field
361  const surfaceScalarField& phi() const;
362 
363  //- Return free surface normal derivative of velocity
365 
366  //- Return free surface normal derivative of normal velocity comp
368 
369  //- Return free surface pressure jump
371 
372  //- Return control points
374 
375  //- Return reference to motion points mask field
377 
378  //- Return reference to point displacement direction field
380 
381  //- Return reference to control points displacement direction field
383 
384  //- Motion direction swithc
385  bool normalMotionDir() const
386  {
387  return normalMotionDir_;
388  }
389 
390  //- Return free-surface fluid flux field
392 
393  //- Return free-surface surfactant concentration field
395 
396  //- Return free-surface surfactant concentration field
398 
399  //- Return volume surfactant concentration field
401 
402  //- Return volume surfactant concentration field
404 
405  //- Return surface tension field
407 
408  //- Return surface tension field
409  const areaScalarField& surfaceTension() const;
410 
411  //- Return surface tension gradient
413 
414  //- Return surfactant properties
415  const surfactantProperties& surfactant() const;
416 
417  //- Update the mesh for both mesh motion and topology change
418  virtual bool update();
419 
420  //- Clear control points
421  void clearControlPoints()
422  {
423  deleteDemandDrivenData(controlPointsPtr_);
424  }
425 
426  //- Write VTK freeSurface mesh
427  void writeVTK() const;
428 
429  //- Write VTK freeSurface control points
430  void writeVTKControlPoints();
431 };
432 
433 
434 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
435 
436 } // End namespace Foam
437 
438 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
439 
440 #endif
441 
442 // ************************************************************************* //
regIOobject.H
volFields.H
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1038
Foam::interfaceTrackingFvMesh::aMesh
const faMesh & aMesh() const
Return reference to finite area mesh.
Definition: interfaceTrackingFvMesh.H:289
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::interfaceTrackingFvMesh::aMesh
faMesh & aMesh()
Return reference to finite area mesh.
Definition: interfaceTrackingFvMesh.H:283
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:70
Foam::interfaceTrackingFvMesh::bulkSurfactantConcentration
volScalarField & bulkSurfactantConcentration()
Return volume surfactant concentration field.
Definition: interfaceTrackingFvMesh.C:1975
faCFD.H
Foam::IOField
A primitive field of type <T> with automated input and output.
Definition: foamVtkLagrangianWriter.H:61
Foam::interfaceTrackingFvMesh::surfactantConcentration
areaScalarField & surfactantConcentration()
Return free-surface surfactant concentration field.
Definition: interfaceTrackingFvMesh.C:1951
Foam::interfaceTrackingFvMesh::sigma
const dimensionedScalar & sigma() const
Surface tension coefficient of pure free-surface.
Definition: interfaceTrackingFvMesh.H:330
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
singlePhaseTransportModel.H
Foam::interfaceTrackingFvMesh::pureFreeSurface
const Switch & pureFreeSurface() const
Pure free-surface.
Definition: interfaceTrackingFvMesh.H:300
Foam::interfaceTrackingFvMesh
The interfaceTrackingFvMesh.
Definition: interfaceTrackingFvMesh.H:56
Foam::interfaceTrackingFvMesh::writeVTK
void writeVTK() const
Write VTK freeSurface mesh.
Definition: interfaceTrackingFvMesh.C:2260
Foam::interfaceTrackingFvMesh::correctContactLineNormals
const Switch & correctContactLineNormals() const
Correct contact line point normals.
Definition: interfaceTrackingFvMesh.H:318
surfaceFields.H
Foam::surfaceFields.
Foam::interfaceTrackingFvMesh::fsPatchIndex
const label & fsPatchIndex() const
Definition: interfaceTrackingFvMesh.H:294
Foam::interfaceTrackingFvMesh::freeSurfacePressureJump
tmp< scalarField > freeSurfacePressureJump()
Return free surface pressure jump.
Definition: interfaceTrackingFvMesh.C:1864
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:42
Foam::interfaceTrackingFvMesh::updateUs
void updateUs()
Update free-surface velocity field.
Definition: interfaceTrackingFvMesh.C:1768
Foam::interfaceTrackingFvMesh::mesh
fvMesh & mesh()
Definition: interfaceTrackingFvMesh.H:272
surfactantProperties.H
Foam::interfaceTrackingFvMesh::surfaceTensionGrad
tmp< areaVectorField > surfaceTensionGrad()
Return surface tension gradient.
Definition: interfaceTrackingFvMesh.C:2035
Foam::label
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:62
Foam::Field< vector >
Foam::interfaceTrackingFvMesh::p
const volScalarField & p() const
Return constant reference to pressure field.
Definition: interfaceTrackingFvMesh.C:1790
Foam::interfaceTrackingFvMesh::pointsDisplacementDir
vectorField & pointsDisplacementDir()
Return reference to point displacement direction field.
Definition: interfaceTrackingFvMesh.C:1918
Foam::interfaceTrackingFvMesh::correctContactLineNormals
Switch & correctContactLineNormals()
Correct contact line point normals.
Definition: interfaceTrackingFvMesh.H:324
Foam::interfaceTrackingFvMesh::rigidFreeSurface
const Switch & rigidFreeSurface() const
Rigid free-surface.
Definition: interfaceTrackingFvMesh.H:306
Foam::interfaceTrackingFvMesh::U
const volVectorField & U() const
Return constant reference to velocity field.
Definition: interfaceTrackingFvMesh.C:1784
Foam::interfaceTrackingFvMesh::rigidFreeSurface
Switch & rigidFreeSurface()
Rigid free-surface.
Definition: interfaceTrackingFvMesh.H:312
Foam::dimensioned< scalar >
Foam::interfaceTrackingFvMesh::fsNetPhi
const areaScalarField & fsNetPhi() const
Return free-surface net flux.
Definition: interfaceTrackingFvMesh.C:1710
Foam::interfaceTrackingFvMesh::freeSurfaceSnGradU
tmp< vectorField > freeSurfaceSnGradU()
Return free surface normal derivative of velocity.
Definition: interfaceTrackingFvMesh.C:1803
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::surfactantProperties
Definition: surfactantProperties.H:50
Foam::interfaceTrackingFvMesh::freeSurfaceSnGradUn
tmp< scalarField > freeSurfaceSnGradUn()
Return free surface normal derivative of normal velocity comp.
Definition: interfaceTrackingFvMesh.C:1846
Foam::interfaceTrackingFvMesh::surfaceTension
areaScalarField & surfaceTension()
Return surface tension field.
Definition: interfaceTrackingFvMesh.C:1999
Foam::interfaceTrackingFvMesh::normalMotionDir
bool normalMotionDir() const
Motion direction swithc.
Definition: interfaceTrackingFvMesh.H:384
Foam::interfaceTrackingFvMesh::motionPointsMask
labelList & motionPointsMask()
Return reference to motion points mask field.
Definition: interfaceTrackingFvMesh.C:1907
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1063
Foam::interfaceTrackingFvMesh::TypeName
TypeName("interfaceTrackingFvMesh")
Runtime type information.
dynamicMotionSolverFvMesh.H
Foam::Vector< scalar >
Foam::List< word >
Foam::interfaceTrackingFvMesh::writeVTKControlPoints
void writeVTKControlPoints()
Write VTK freeSurface control points.
Definition: interfaceTrackingFvMesh.C:2340
Foam::interfaceTrackingFvMesh::facesDisplacementDir
vectorField & facesDisplacementDir()
Return reference to control points displacement direction field.
Definition: interfaceTrackingFvMesh.C:1929
Foam::interfaceTrackingFvMesh::clearControlPoints
void clearControlPoints()
Clear control points.
Definition: interfaceTrackingFvMesh.H:420
Foam::interfaceTrackingFvMesh::correctUsBoundaryConditions
void correctUsBoundaryConditions()
Correct surface velocity boundary conditions.
Definition: interfaceTrackingFvMesh.C:1721
Foam::interfaceTrackingFvMesh::phi
const surfaceScalarField & phi() const
Return constant reference to velocity field.
Definition: interfaceTrackingFvMesh.C:1796
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:77
Foam::interfaceTrackingFvMesh::controlPoints
vectorField & controlPoints()
Return control points.
Definition: interfaceTrackingFvMesh.C:1896
Foam::interfaceTrackingFvMesh::update
virtual bool update()
Update the mesh for both mesh motion and topology change.
Definition: interfaceTrackingFvMesh.C:2064
Foam::interfaceTrackingFvMesh::surfactant
const surfactantProperties & surfactant() const
Return surfactant properties.
Definition: interfaceTrackingFvMesh.C:2023
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::interfaceTrackingFvMesh::mesh
const fvMesh & mesh() const
Definition: interfaceTrackingFvMesh.H:277
Foam::interfaceTrackingFvMesh::Us
areaVectorField & Us()
Return free-surface velocity field.
Definition: interfaceTrackingFvMesh.C:1677
Foam::interfaceTrackingFvMesh::Phis
edgeScalarField & Phis()
Return free-surface fluid flux field.
Definition: interfaceTrackingFvMesh.C:1940
Foam::interfaceTrackingFvMesh::~interfaceTrackingFvMesh
~interfaceTrackingFvMesh()
Destructor.
Definition: interfaceTrackingFvMesh.C:1658
Foam::dynamicMotionSolverFvMesh
The dynamicMotionSolverFvMesh.
Definition: dynamicMotionSolverFvMesh.H:52