cutFaceIso.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 -------------------------------------------------------------------------------
12 License
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 
28 Class
29  Foam::cutFaceIso
30 
31 Description
32  Class for cutting a face, faceI, of an fvMesh, mesh_, at its intersection
33  with an isosurface defined by the mesh point values f_ and the isovalue,
34  cutValue.
35 
36  Reference:
37  \verbatim
38  Roenby, J., Bredmose, H. and Jasak, H. (2016).
39  A computational method for sharp interface advection
40  Royal Society Open Science, 3
41  doi 10.1098/rsos.160405
42 
43  \endverbatim
44 
45  Original code supplied by Johan Roenby, DHI (2016)
46 
47 SourceFiles
48  cutFaceIso.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef cutFaceIso_H
53 #define cutFaceIso_H
54 
55 #include "fvMesh.H"
56 #include "volFields.H"
57 #include "surfaceFields.H"
58 #include "cutFace.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class cutFaceIso Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class cutFaceIso
70 :
71  public cutFace
72 {
73  // Private Data
74 
75  //- Mesh whose cells and faces to cut at their intersection with an
76  //- isoface
77  const fvMesh& mesh_;
78 
79  //- Isofunction values at mesh points. f_size() = mesh_.nPoints().
80  scalarField& f_;
81 
82  //- Storage for centre of subface
83  point subFaceCentre_;
84 
85  //- Storage for area vector of subface
86  vector subFaceArea_;
87 
88  //- Storage for subFacePoints
89  DynamicList<point> subFacePoints_;
90 
91  //- Storage for subFacePoints
92  DynamicList<point> surfacePoints_;
93 
94  //- Storage for pointStatus_ cuts the cell at 0
95  DynamicList<scalar> pointStatus_;
96 
97  //- Storage of the edge weight
98  DynamicList<scalar> weight_;
99 
100  //- A face status label taking one of the values:
101  //
102  // -1: face is fully below the isosurface
103  // 0: face is cut, i.e. has values larger and smaller than isoValue_
104  // +1: face is fully above the isosurface
105  label faceStatus_;
106 
107 
108 public:
109 
110  // Constructors
111 
112  //- Construct from fvMesh and a scalarField
113  // length of scalarField should equal number of mesh points
114  cutFaceIso(const fvMesh& mesh, scalarField& f);
115 
116 
117  // Member Functions
118 
119  //- Calculate cut points along edges of faceI
120  label calcSubFace
121  (
122  const label faceI,
123  const scalar cutValue
124  );
125 
126  //- Returns centre of cutted face
127  const point& subFaceCentre() const noexcept
128  {
129  return subFaceCentre_;
130  }
131 
132  //- Returns area vector of cutted face
133  const vector& subFaceArea() const noexcept
134  {
135  return subFaceArea_;
136  }
137 
138  //- Returns the cut edge of the cutted face
139  const DynamicList<point>& subFacePoints() const noexcept
140  {
141  return subFacePoints_;
142  }
143 
144  //- Returns point of the face in sorted of cutted face
145  const DynamicList<point>& surfacePoints() const noexcept
146  {
147  return surfacePoints_;
148  }
149 
150  //- Resets internal variables
151  void clearStorage();
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
volFields.H
Foam::DynamicList< point >
Foam::cutFaceIso::subFaceCentre
const point & subFaceCentre() const noexcept
Returns centre of cutted face.
Definition: cutFaceIso.H:126
surfaceFields.H
Foam::surfaceFields.
Foam::cutFaceIso::clearStorage
void clearStorage()
Resets internal variables.
Definition: cutFaceIso.C:114
Foam::cutFaceIso::subFaceArea
const vector & subFaceArea() const noexcept
Returns area vector of cutted face.
Definition: cutFaceIso.H:132
Foam::Field< scalar >
Foam::cutFaceIso::calcSubFace
label calcSubFace(const label faceI, const scalar cutValue)
Calculate cut points along edges of faceI.
Definition: cutFaceIso.C:54
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::cutFace
Base class for cutting a face, faceI, of an fvMesh, mesh_, at its intersections.
Definition: cutFace.H:59
cutFace.H
f
labelList f(nPoints)
Foam::Vector< scalar >
Foam::cutFaceIso::cutFaceIso
cutFaceIso(const fvMesh &mesh, scalarField &f)
Construct from fvMesh and a scalarField.
Definition: cutFaceIso.C:34
Foam::cutFaceIso::surfacePoints
const DynamicList< point > & surfacePoints() const noexcept
Returns point of the face in sorted of cutted face.
Definition: cutFaceIso.H:144
Foam::cutFaceIso
Class for cutting a face, faceI, of an fvMesh, mesh_, at its intersection with an isosurface defined ...
Definition: cutFaceIso.H:68
Foam::cutFaceIso::subFacePoints
const DynamicList< point > & subFacePoints() const noexcept
Returns the cut edge of the cutted face.
Definition: cutFaceIso.H:138