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