cutCellPLIC.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) 2016-2017 DHI
9 Copyright (C) 2018-2019 Johan Roenby
10 Copyright (C) 2019-2020 DLR
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28Class
29 Foam::cutCellPLIC
30
31Description
32 Class for cutting a cell, cellI, of an fvMesh, mesh_, at its intersection
33 with an surface defined by a normal and cutValue_ (defined as distance to
34 the cell centre).
35
36 Reference:
37 \verbatim
38 Henning Scheufler, Johan Roenby,
39 Accurate and efficient surface reconstruction from volume
40 fraction data on general meshes,
41 Journal of Computational Physics, 2019,
42 doi 10.1016/j.jcp.2019.01.009
43
44 \endverbatim
45
46
47 Original code supplied by Henning Scheufler, DLR (2019)
48
49SourceFiles
50 cutCellPLIC.C
51
52\*---------------------------------------------------------------------------*/
53
54#ifndef cutCellPLIC_H
55#define cutCellPLIC_H
56
57#include "cutCell.H"
58#include "cutFacePLIC.H"
59#include "fvMesh.H"
60#include "surfaceFields.H"
61#include "volFields.H"
62
63// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64
65namespace Foam
66{
67
68/*---------------------------------------------------------------------------*\
69 Class cutCellPLIC Declaration
70\*---------------------------------------------------------------------------*/
72class cutCellPLIC
73:
74 public cutCell
75{
76 // Private Data
77
78 //- Mesh whose cells and faces to cut at their intersection with an
79 // isosurface.
80 const fvMesh& mesh_;
81
82 //- Cell to cut
83 label cellI_;
84
85 //- Normal of the cutting plane
86 vector normal_;
87
88 //- Cutvalue used to cut cell
89 scalar cutValue_;
90
91 //- An cutFacePLIC object to get access to its face cutting functionality
92 cutFacePLIC cutFace_;
93
94 //- List of face centres for CutFaces
95 DynamicList<point> cutFaceCentres_;
96
97 //- List of face area vectors for PLICCutFaces
98 DynamicList<vector> cutFaceAreas_;
99
100 //- Storage for subFace edges belonging to PLICFace
101 DynamicList<DynamicList<point>> plicFaceEdges_;
102
103 //- Points constituting the cell-PLICsurface intersection (isoface)
104 DynamicList<point> facePoints_;
105
106 //- Face centre of the cutFace
107 point faceCentre_;
108
109 //- Face normal of the PLICface by convention pointing from high to low
110 // values (i.e. opposite of the gradient vector).
111 vector faceArea_;
112
113 //- Cell centre of the subcell of celli which is "fully submerged", i.e.
114 // where the function value is higher than the isoValue_
115 point subCellCentre_;
116
117 //- Volume of fully submerged subcell
118 scalar subCellVolume_;
119
120 //- Volume of Fluid for cellI (subCellVolume_/mesh_.V()[cellI])
121 scalar VOF_;
122
123 //- A cell status label taking one of the values:
124 //
125 // -1: cell is fully below the PLICsurface
126 // 0: cell is cut
127 // +1: cell is fully above the PLICsurface
128 label cellStatus_;
129
130
131 public:
132
133 // Constructors
134
135 //- Construct from fvMesh
136 explicit cutCellPLIC(const fvMesh& mesh);
137
138
139 // Member Functions
140
141 //- Sets internal values and returns face status
142 label calcSubCell
143 (
144 const label celli,
145 const scalar cutValue,
146 const vector& normal
147 );
148
149 //- Returns subCellCentre
150 const point& subCellCentre() const noexcept
151 {
152 return subCellCentre_;
153 }
154
155 //- Returns subCellVolume
156 scalar subCellVolume() const noexcept
157 {
158 return subCellVolume_;
159 }
160
161 //- Returns the points of the cutting PLICface
163
164 //- Returns the centre of the cutting PLICface
165 const point& faceCentre() const noexcept
166 {
167 return faceCentre_;
168 }
169
170 //- Returns the area normal vector of the cutting PLICface
171 const vector& faceArea() const noexcept
172 {
173 return faceArea_;
174 }
175
176 //- Returns cellStatus
177 label cellStatus() const noexcept
178 {
179 return cellStatus_;
180 }
181
182 //- Returns volume of fluid value
183 scalar VolumeOfFluid() const noexcept
184 {
185 return VOF_;
186 }
187
188 //- Returns cutValue
189 scalar cutValue() const noexcept
190 {
191 return cutValue_;
192 }
193
194 //- Resets internal values
195 void clearStorage();
196};
197
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201} // End namespace Foam
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205#endif
206
207// ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
Class for cutting a cell, cellI, of an fvMesh, mesh_, at its intersection with an surface defined by ...
Definition: cutCellPLIC.H:74
const point & faceCentre() const noexcept
Returns the centre of the cutting PLICface.
Definition: cutCellPLIC.H:164
const vector & faceArea() const noexcept
Returns the area normal vector of the cutting PLICface.
Definition: cutCellPLIC.H:170
label calcSubCell(const label celli, const scalar cutValue, const vector &normal)
Sets internal values and returns face status.
Definition: cutCellPLIC.C:60
scalar cutValue() const noexcept
Returns cutValue.
Definition: cutCellPLIC.H:188
const DynamicList< point > & facePoints()
Returns the points of the cutting PLICface.
Definition: cutCellPLIC.C:175
void clearStorage()
Resets internal values.
Definition: cutCellPLIC.C:193
scalar VolumeOfFluid() const noexcept
Returns volume of fluid value.
Definition: cutCellPLIC.H:182
label cellStatus() const noexcept
Returns cellStatus.
Definition: cutCellPLIC.H:176
scalar subCellVolume() const noexcept
Returns subCellVolume.
Definition: cutCellPLIC.H:155
const point & subCellCentre() const noexcept
Returns subCellCentre.
Definition: cutCellPLIC.H:149
Service routines for cutting a cell, celli, of an fvMesh, mesh_, at its intersection with a surface.
Definition: cutCell.H:60
Class for cutting a face, faceI, of an fvMesh, mesh_, at its intersection with an plane defined by no...
Definition: cutFacePLIC.H:73
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
dynamicFvMesh & mesh
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
Foam::surfaceFields.