surfaceIteratorPLIC.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-2020 DLR
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::surfaceIteratorPLIC
28 
29 Description
30  Finds the cutValue that matches the volume fraction
31 
32  Reference:
33  \verbatim
34  Henning Scheufler, Johan Roenby,
35  Accurate and efficient surface reconstruction from volume
36  fraction data on general meshes,
37  Journal of Computational Physics, 2019,
38  doi 10.1016/j.jcp.2019.01.009
39  \endverbatim
40 
41 Author
42  Johan Roenby, DHI, all rights reserved.
43  Modified Henning Scheufler, DLR
44 
45 SourceFiles
46  surfaceIteratorPLIC.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef surfaceIteratorPLIC_H
51 #define surfaceIteratorPLIC_H
52 
53 #include "fvMesh.H"
54 #include "volFields.H"
55 #include "surfaceFields.H"
56 #include "cutCellPLIC.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class surfaceIteratorPLIC Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 {
69  // Private Data
70 
71  //- Mesh whose cells and faces to cut at their intersection with an
72  //- isosurface.
73  const fvMesh& mesh_;
74 
75  //- Cuts the cell and returns volume centre and normal
76  cutCellPLIC cutCell_;
77 
78  //- Tolerance for marking of surface cells:
79  // Those with surfCellTol_ < alpha1 < 1 - surfCellTol_
80  scalar surfCellTol_;
81 
82 
83 public:
84 
85  // Constructors
86 
87  //- Construct from fvMesh and a scalarField
88  // Length of scalarField should equal number of mesh points
89  surfaceIteratorPLIC(const fvMesh& mesh, const scalar tol);
90 
91 
92  // Member Functions
93 
94  //- Determine if a cell is a surface cell
95  bool isASurfaceCell(const scalar alpha1) const
96  {
97  return
98  (
99  surfCellTol_ < alpha1
100  && alpha1 < 1 - surfCellTol_
101  );
102  }
103 
104  //- Finds matching cutValue for the given value fraction
105  // \return the cellStatus
106  label vofCutCell
107  (
108  const label celli,
109  const scalar alpha1,
110  const scalar tol,
111  const label maxIter,
112  vector normal
113  );
114 
115  //- The centre point of cutted volume
116  const point& subCellCentre() const
117  {
118  return cutCell_.subCellCentre();
119  }
120 
121  //- The volume of cutted volume
122  scalar subCellVolume() const
123  {
124  return cutCell_.subCellVolume();
125  }
126 
127  //- The centre of cutting isosurface
128  const point& surfaceCentre() const
129  {
130  return cutCell_.faceCentre();
131  }
132 
133  //- The area vector of cutting isosurface
134  const vector& surfaceArea() const
135  {
136  return cutCell_.faceArea();
137  }
138 
139  //- Volume of Fluid for cellI (subCellVolume_/mesh_.V()[cellI])
140  scalar VolumeOfFluid() const
141  {
142  return cutCell_.VolumeOfFluid();
143  }
144 
145  //- The cutValue
146  scalar cutValue() const
147  {
148  return cutCell_.cutValue();
149  }
150 
151  //- The cellStatus
152  label cellStatus()
153  {
154  return cutCell_.cellStatus();
155  }
156 
157  //- The points of the cutting isosurface in sorted order
159  {
160  return cutCell_.facePoints();
161  }
162 };
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
Foam::cutCellPLIC::faceCentre
const point & faceCentre() const noexcept
Returns the centre of the cutting PLICface.
Definition: cutCellPLIC.H:164
volFields.H
Foam::cutCellPLIC::cutValue
scalar cutValue() const noexcept
Returns cutValue.
Definition: cutCellPLIC.H:188
Foam::surfaceIteratorPLIC::surfaceCentre
const point & surfaceCentre() const
The centre of cutting isosurface.
Definition: surfaceIteratorPLIC.H:127
Foam::DynamicList< point >
Foam::cutCellPLIC
Class for cutting a cell, cellI, of an fvMesh, mesh_, at its intersection with an surface defined by ...
Definition: cutCellPLIC.H:71
surfaceFields.H
Foam::surfaceFields.
alpha1
const volScalarField & alpha1
Definition: setRegionFluidFields.H:8
Foam::cutCellPLIC::cellStatus
label cellStatus() const noexcept
Returns cellStatus.
Definition: cutCellPLIC.H:176
Foam::surfaceIteratorPLIC::vofCutCell
label vofCutCell(const label celli, const scalar alpha1, const scalar tol, const label maxIter, vector normal)
Finds matching cutValue for the given value fraction.
Definition: surfaceIteratorPLIC.C:48
Foam::surfaceIteratorPLIC::cutValue
scalar cutValue() const
The cutValue.
Definition: surfaceIteratorPLIC.H:145
Foam::cutCellPLIC::subCellCentre
const point & subCellCentre() const noexcept
Returns subCellCentre.
Definition: cutCellPLIC.H:149
Foam::cutCellPLIC::VolumeOfFluid
scalar VolumeOfFluid() const noexcept
Returns volume of fluid value.
Definition: cutCellPLIC.H:182
Foam::cutCellPLIC::faceArea
const vector & faceArea() const noexcept
Returns the area normal vector of the cutting PLICface.
Definition: cutCellPLIC.H:170
Foam::cutCellPLIC::subCellVolume
scalar subCellVolume() const noexcept
Returns subCellVolume.
Definition: cutCellPLIC.H:155
Foam::surfaceIteratorPLIC::isASurfaceCell
bool isASurfaceCell(const scalar alpha1) const
Determine if a cell is a surface cell.
Definition: surfaceIteratorPLIC.H:94
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cutCellPLIC::facePoints
const DynamicList< point > & facePoints()
Returns the points of the cutting PLICface.
Definition: cutCellPLIC.C:175
Foam::Vector< scalar >
cutCellPLIC.H
Foam::surfaceIteratorPLIC::subCellVolume
scalar subCellVolume() const
The volume of cutted volume.
Definition: surfaceIteratorPLIC.H:121
Foam::surfaceIteratorPLIC::cellStatus
label cellStatus()
The cellStatus.
Definition: surfaceIteratorPLIC.H:151
Foam::surfaceIteratorPLIC::surfaceIteratorPLIC
surfaceIteratorPLIC(const fvMesh &mesh, const scalar tol)
Construct from fvMesh and a scalarField.
Definition: surfaceIteratorPLIC.C:34
Foam::surfaceIteratorPLIC::facePoints
const DynamicList< point > & facePoints()
The points of the cutting isosurface in sorted order.
Definition: surfaceIteratorPLIC.H:157
Foam::surfaceIteratorPLIC::VolumeOfFluid
scalar VolumeOfFluid() const
Volume of Fluid for cellI (subCellVolume_/mesh_.V()[cellI])
Definition: surfaceIteratorPLIC.H:139
Foam::surfaceIteratorPLIC::subCellCentre
const point & subCellCentre() const
The centre point of cutted volume.
Definition: surfaceIteratorPLIC.H:115
Foam::surfaceIteratorPLIC::surfaceArea
const vector & surfaceArea() const
The area vector of cutting isosurface.
Definition: surfaceIteratorPLIC.H:133
Foam::surfaceIteratorPLIC
Finds the cutValue that matches the volume fraction.
Definition: surfaceIteratorPLIC.H:66