https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FaceInfo.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "MooseTypes.h"
13#include "ElemInfo.h"
14#include "MooseError.h"
15
16#include "libmesh/vector_value.h"
17#include "libmesh/remote_elem.h"
18#include "libmesh/elem_side_builder.h"
19
20#include <map>
21#include <set>
22#include <memory>
23
24class MooseMesh;
25namespace libMesh
26{
27class Elem;
28class Node;
29}
30
38{
39public:
40 FaceInfo(const ElemInfo * elem_info,
41 unsigned int side,
42 const dof_id_type id,
43 libMesh::ElemSideBuilder & side_builder);
44
53 {
54 BOTH,
55 NEITHER,
56 ELEM,
58 };
59
61 dof_id_type id() const { return _id; }
62
64 Real faceArea() const { return _face_area; }
65
68 Real & faceCoord() { return _face_coord; }
69 Real faceCoord() const { return _face_coord; }
70
72 const Point & normal() const { return _normal; }
73
75 const Point & faceCentroid() const { return _face_centroid; }
76
79 Point skewnessCorrectionVector() const;
80
85 const Elem & elem() const { return *(_elem_info->elem()); }
86 const Elem * elemPtr() const { return _elem_info->elem(); }
87 const Elem & neighbor() const;
88 const Elem * neighborPtr() const { return _neighbor_info ? _neighbor_info->elem() : nullptr; }
89 const ElemInfo * elemInfo() const { return _elem_info; }
90 const ElemInfo * neighborInfo() const { return _neighbor_info; }
92
99 const Point & elemCentroid() const { return _elem_info->centroid(); }
100 const Point & neighborCentroid() const;
102
109
113 unsigned int elemSideID() const { return _elem_side_id; }
114 unsigned int neighborSideID() const { return _neighbor_side_id; }
116
118 VarFaceNeighbors faceType(const std::pair<unsigned int, unsigned int> & var_sys) const;
121 VarFaceNeighbors & faceType(const std::pair<unsigned int, unsigned int> & var_sys);
122
124 const std::set<BoundaryID> & boundaryIDs() const { return _boundary_ids; }
125
127 std::set<BoundaryID> & boundaryIDs() { return _boundary_ids; }
128
130 Real elemVolume() const { return _elem_info->volume(); }
131
133 Real neighborVolume() const;
134
136 Real gC() const { return _gc; }
137
142 const Point & dCN() const { return _d_cn; }
143
148 Real dCNMag() const { return _d_cn_mag; }
149
155 const Point & eCN() const { return _e_cn; }
156
160 processor_id_type processor_id() const { return _processor_id; }
161
166 void computeInternalCoefficients(const ElemInfo * const neighbor_info);
167
173
174private:
177 std::vector<std::vector<VarFaceNeighbors>> & faceType() { return _face_types_by_var; }
178
180 const ElemInfo * const _elem_info;
182
183 const dof_id_type _id;
184
185 Real _face_coord = 0;
186 Point _normal;
187
188 const processor_id_type _processor_id;
189
191 const unsigned int _elem_side_id;
192 unsigned int _neighbor_side_id;
193
196
198 Point _d_cn;
199 Point _e_cn;
200
203
205 Real _gc;
206
210 std::vector<std::vector<VarFaceNeighbors>> _face_types_by_var;
211
213 std::set<BoundaryID> _boundary_ids;
214
216 friend MooseMesh;
217};
218
219inline const Elem &
221{
222 mooseAssert(_neighbor_info,
223 "FaceInfo object 'const Elem & neighbor()' is called but neighbor element pointer "
224 "is null. This occurs for faces at the domain boundary");
225 return *(_neighbor_info->elem());
226}
227
229FaceInfo::faceType(const std::pair<unsigned int, unsigned int> & var_sys) const
230{
231 mooseAssert(var_sys.second < _face_types_by_var.size(), "System number out of bounds!");
232 mooseAssert(var_sys.first < _face_types_by_var[var_sys.second].size(),
233 "Variable number out of bounds!");
234 return _face_types_by_var[var_sys.second][var_sys.first];
235}
236
238FaceInfo::faceType(const std::pair<unsigned int, unsigned int> & var_sys)
239{
240 mooseAssert(var_sys.second < _face_types_by_var.size(), "System number out of bounds!");
241 mooseAssert(var_sys.first < _face_types_by_var[var_sys.second].size(),
242 "Variable number out of bounds!");
243 return _face_types_by_var[var_sys.second][var_sys.first];
244}
245
246inline const Point &
248{
249 mooseAssert(_neighbor_info,
250 "The neighbor is not defined on this faceInfo! A possible explanation is that the "
251 "face is a (physical/processor) boundary face.");
252 return _neighbor_info->centroid();
253}
254
255inline SubdomainID
260
261inline Real
263{
264 mooseAssert(_neighbor_info,
265 "The neighbor is not defined on this faceInfo! A possible explanation is that the "
266 "face is a (physical/processor) boundary face.");
267 return _neighbor_info->volume();
268}
Class used for caching additional information for elements such as the volume and centroid.
Definition ElemInfo.h:26
Real volume() const
Definition ElemInfo.h:35
SubdomainID subdomain_id() const
We return the subdomain ID of the corresponding libmesh element.
Definition ElemInfo.h:43
const Elem * elem() const
Definition ElemInfo.h:34
const Point & centroid() const
Definition ElemInfo.h:36
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
const processor_id_type _processor_id
Definition FaceInfo.h:188
SubdomainID neighborSubdomainID() const
Definition FaceInfo.h:256
Real neighborVolume() const
Return the neighbor volume.
Definition FaceInfo.h:262
void computeBoundaryCoefficients()
Computes the interpolation weights and similar quantities with the assumption that the face is on a b...
Definition FaceInfo.C:60
std::set< BoundaryID > _boundary_ids
the set of boundary ids that this face is associated with
Definition FaceInfo.h:213
Real faceCoord() const
Definition FaceInfo.h:69
Point skewnessCorrectionVector() const
Returns the skewness-correction vector (vector between the approximate and real face centroids).
Definition FaceInfo.C:74
const Point & normal() const
Returns the unit normal vector for the face oriented outward from the face's elem element.
Definition FaceInfo.h:72
unsigned int neighborSideID() const
Definition FaceInfo.h:114
const dof_id_type _id
Definition FaceInfo.h:183
Real elemVolume() const
Return the element volume.
Definition FaceInfo.h:130
const Point & eCN() const
Definition FaceInfo.h:155
processor_id_type processor_id() const
Definition FaceInfo.h:160
const unsigned int _elem_side_id
the elem local side id
Definition FaceInfo.h:191
Real _face_area
Definition FaceInfo.h:194
Point _normal
Definition FaceInfo.h:186
const ElemInfo *const _elem_info
the elem and neighbor elems
Definition FaceInfo.h:180
const std::set< BoundaryID > & boundaryIDs() const
Const getter for every associated boundary ID.
Definition FaceInfo.h:124
const Elem & elem() const
Definition FaceInfo.h:85
const Elem * neighborPtr() const
Definition FaceInfo.h:88
void computeInternalCoefficients(const ElemInfo *const neighbor_info)
Takes the ElemInfo of the neighbor cell and computes interpolation weights together with other quanti...
Definition FaceInfo.C:39
const ElemInfo * elemInfo() const
Definition FaceInfo.h:89
Real dCNMag() const
Definition FaceInfo.h:148
Real _d_cn_mag
the distance norm between neighbor and element centroids
Definition FaceInfo.h:202
unsigned int elemSideID() const
Definition FaceInfo.h:113
friend MooseMesh
Allows access to private members from moose mesh only.
Definition FaceInfo.h:216
const ElemInfo * neighborInfo() const
Definition FaceInfo.h:90
std::vector< std::vector< VarFaceNeighbors > > & faceType()
Getter for the face type for every stored variable.
Definition FaceInfo.h:177
Real faceArea() const
Returns the face area of face id.
Definition FaceInfo.h:64
Real _face_coord
Definition FaceInfo.h:185
Point _e_cn
Definition FaceInfo.h:199
SubdomainID elemSubdomainID() const
Definition FaceInfo.h:106
std::set< BoundaryID > & boundaryIDs()
Returns the set of boundary ids for all boundaries that include this face.
Definition FaceInfo.h:127
dof_id_type id() const
Return the ID of the face.
Definition FaceInfo.h:61
VarFaceNeighbors
This enum is used to indicate which side(s) of a face a particular variable is defined on.
Definition FaceInfo.h:53
Real & faceCoord()
Sets/gets the coordinate transformation factor (for e.g.
Definition FaceInfo.h:68
Point _d_cn
the distance vector between neighbor and element centroids
Definition FaceInfo.h:198
Point _face_centroid
Definition FaceInfo.h:195
const Elem * elemPtr() const
Definition FaceInfo.h:86
const Point & neighborCentroid() const
Definition FaceInfo.h:247
const ElemInfo * _neighbor_info
Definition FaceInfo.h:181
const Point & dCN() const
Definition FaceInfo.h:142
const Point & elemCentroid() const
Returns the element centroids of the elements on the elem and neighbor sides of the face.
Definition FaceInfo.h:99
Real _gc
Geometric weighting factor for face value interpolation.
Definition FaceInfo.h:205
Real gC() const
Return the geometric weighting factor.
Definition FaceInfo.h:136
std::vector< std::vector< VarFaceNeighbors > > _face_types_by_var
A vector that provides the information about what face type this is for each variable.
Definition FaceInfo.h:210
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Definition FaceInfo.h:75
const Elem & neighbor() const
Definition FaceInfo.h:220
unsigned int _neighbor_side_id
Definition FaceInfo.h:192
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
const SubdomainID INVALID_BLOCK_ID
Definition MooseTypes.C:20
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...