https://mooseframework.inl.gov
FaceInfo.C
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 #include "FaceInfo.h"
11 #include "MooseTypes.h"
12 
13 #include "libmesh/elem.h"
14 #include "libmesh/node.h"
15 #include "libmesh/fe_base.h"
16 #include "libmesh/quadrature_gauss.h"
17 #include "libmesh/remote_elem.h"
18 
19 FaceInfo::FaceInfo(const ElemInfo * elem_info,
20  unsigned int side,
21  const dof_id_type id,
22  libMesh::ElemSideBuilder & side_builder)
23  : _elem_info(elem_info),
24  _neighbor_info(nullptr),
25  _id(id),
26  _processor_id(_elem_info->elem()->processor_id()),
27  _elem_side_id(side),
28  _neighbor_side_id(libMesh::invalid_uint),
29  _gc(0.5)
30 {
31  // Compute face-related quantities
32  auto & face = side_builder(*_elem_info->elem(), side);
33  _face_area = face.volume();
34  _face_centroid = face.vertex_average();
35  _normal = _elem_info->elem()->side_vertex_average_normal(side);
36 }
37 
38 void
39 FaceInfo::computeInternalCoefficients(const ElemInfo * const neighbor_info)
40 {
41  mooseAssert(neighbor_info,
42  "We need a neighbor if we want to compute interpolation coefficients!");
43  _neighbor_info = neighbor_info;
44  _neighbor_side_id = _neighbor_info->elem()->which_neighbor_am_i(_elem_info->elem());
45 
46  // Setup quantities used for the approximation of the spatial derivatives
48  _d_cn_mag = _d_cn.norm();
49  _e_cn = _d_cn / _d_cn_mag;
50 
51  Point r_intersection =
52  _elem_info->centroid() +
54 
55  // For interpolation coefficients
56  _gc = (_neighbor_info->centroid() - r_intersection).norm() / _d_cn_mag;
57 }
58 
59 void
61 {
62  mooseAssert(!_neighbor_info, "This functions shall only be called on a boundary!");
63 
64  // Setup quantities used for the approximation of the spatial derivatives
66  _d_cn_mag = _d_cn.norm();
67  _e_cn = _d_cn / _d_cn_mag;
68 
69  // For interpolation coefficients
70  _gc = 1.0;
71 }
72 
73 Point
75 {
76  const Point r_intersection =
77  _elem_info->centroid() +
79 
80  return _face_centroid - r_intersection;
81 }
const ElemInfo * _neighbor_info
Definition: FaceInfo.h:181
Point _e_cn
Definition: FaceInfo.h:199
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 unsigned int invalid_uint
Point skewnessCorrectionVector() const
Returns the skewness-correction vector (vector between the approximate and real face centroids)...
Definition: FaceInfo.C:74
const Elem * elem() const
Definition: ElemInfo.h:34
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Real _d_cn_mag
the distance norm between neighbor and element centroids
Definition: FaceInfo.h:202
FaceInfo(const ElemInfo *elem_info, unsigned int side, const dof_id_type id, libMesh::ElemSideBuilder &side_builder)
Definition: FaceInfo.C:19
const Point & centroid() const
Definition: ElemInfo.h:36
Real _gc
Geometric weighting factor for face value interpolation.
Definition: FaceInfo.h:205
processor_id_type _processor_id
void computeBoundaryCoefficients()
Computes the interpolation weights and similar quantities with the assumption that the face is on a b...
Definition: FaceInfo.C:60
unsigned int _neighbor_side_id
Definition: FaceInfo.h:192
auto norm(const T &a)
const ElemInfo *const _elem_info
the elem and neighbor elems
Definition: FaceInfo.h:180
Point _d_cn
the distance vector between neighbor and element centroids
Definition: FaceInfo.h:198
Point _face_centroid
Definition: FaceInfo.h:195
Class used for caching additional information for elements such as the volume and centroid...
Definition: ElemInfo.h:25
Point _normal
Definition: FaceInfo.h:186
uint8_t dof_id_type
Real _face_area
Definition: FaceInfo.h:194