v0.14.0
FaceElementForcesAndSourcesCoreOnSide.cpp
Go to the documentation of this file.
1 /** \file FaceElementForcesAndSourcesCoreOnSide.cpp
2 
3 \brief Implementation of face element
4 
5 */
6 
7 
8 
9 namespace MoFEM {
10 
12  return -1;
13 };
14 
18  if (sidePtrFE == nullptr)
19  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
20  "Pointer to face element is not set");
21 
22  const EntityHandle edge_entity =
24  SideNumber_multiIndex &side_table = const_cast<SideNumber_multiIndex &>(
25  numeredEntFiniteElementPtr->getSideNumberTable());
26  SideNumber_multiIndex::nth_index<0>::type::iterator sit =
27  side_table.get<0>().find(edge_entity);
28  if (sit == side_table.get<0>().end())
29  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
30  "Edge can not be found on face element");
31 
32  auto edge_ptr_fe =
34 
35  edgeSense = (*sit)->sense;
36  edgeSideNumber = (*sit)->side_number;
37  fill(faceConnMap.begin(), faceConnMap.end(), -1);
38  for (int nn = 0; nn != 2; ++nn) {
39  edgeConnMap[nn] = std::distance(
40  conn, find(conn, &conn[num_nodes], edge_ptr_fe->cOnn[nn]));
41  faceConnMap[edgeConnMap[nn]] = nn;
42  if (faceConnMap[nn] >= num_nodes)
43  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
44  "No common node on face and element can not be found");
45  }
46 
47  const int nb_gauss_pts = sidePtrFE->gaussPts.size2();
48  gaussPts.resize(3, nb_gauss_pts, false);
49  gaussPts.clear();
50  EntitiesFieldData &data_h1_on_edge = *edge_ptr_fe->dataOnElement[H1];
51  const MatrixDouble &edge_shape_funtions =
52  data_h1_on_edge.dataOnEntities[MBVERTEX][0].getN(NOBASE);
53 
54  auto set_integration_pts_for_tri = [&]() {
56  oppositeNode = std::distance(
57  faceConnMap.begin(), find(faceConnMap.begin(), faceConnMap.end(), -1));
58  constexpr double face_coords[] = {0, 0, 1, 0, 0, 1};
59  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
60  gaussPts(0, gg) =
61  edge_shape_funtions(gg, 0) * face_coords[2 * edgeConnMap[0] + 0] +
62  edge_shape_funtions(gg, 1) * face_coords[2 * edgeConnMap[1] + 0];
63  gaussPts(1, gg) =
64  edge_shape_funtions(gg, 0) * face_coords[2 * edgeConnMap[0] + 1] +
65  edge_shape_funtions(gg, 1) * face_coords[2 * edgeConnMap[1] + 1];
66  gaussPts(2, gg) = edge_ptr_fe->gaussPts(1, gg);
67  }
69  };
70 
71  auto set_integration_pts_for_quad = [&]() {
73  oppositeNode = -1;
74  constexpr double face_coords[] = {0, 0, 1, 0, 1, 1, 0, 1};
75  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
76  gaussPts(0, gg) =
77  edge_shape_funtions(gg, 0) * face_coords[2 * edgeConnMap[0] + 0] +
78  edge_shape_funtions(gg, 1) * face_coords[2 * edgeConnMap[1] + 0];
79  gaussPts(1, gg) =
80  edge_shape_funtions(gg, 0) * face_coords[2 * edgeConnMap[0] + 1] +
81  edge_shape_funtions(gg, 1) * face_coords[2 * edgeConnMap[1] + 1];
82  gaussPts(2, gg) = edge_ptr_fe->gaussPts(1, gg);
83  }
85  };
86 
87  const auto type = numeredEntFiniteElementPtr->getEntType();
88 
89  switch (type) {
90  case MBTRI:
91  CHKERR set_integration_pts_for_tri();
92  break;
93  case MBQUAD:
94  CHKERR set_integration_pts_for_quad();
95  break;
96  default:
97  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
98  "Element type not implemented: %d", type);
99  }
100 
102 }
103 
106  ForcesAndSourcesCore *ptr) {
108  if (!(ptrFE = dynamic_cast<FaceElementForcesAndSourcesCoreOnSide *>(ptr)))
109  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
110  "User operator and finite element do not work together");
112 }
113 
114 } // namespace MoFEM
UBlasMatrix< double >
MoFEM::FaceElementForcesAndSourcesCoreOnSide::edgeSense
int edgeSense
Sense of edge, could be 1 or -1.
Definition: FaceElementForcesAndSourcesCoreOnSide.hpp:82
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::EdgeElementForcesAndSourcesCore
Edge finite element.
Definition: EdgeElementForcesAndSourcesCore.hpp:30
MoFEM::FaceElementForcesAndSourcesCoreOnSide::edgeConnMap
std::array< int, 2 > edgeConnMap
Definition: FaceElementForcesAndSourcesCoreOnSide.hpp:84
H1
@ H1
continuous field
Definition: definitions.h:85
EntityHandle
NOBASE
@ NOBASE
Definition: definitions.h:59
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::ForcesAndSourcesCore::sidePtrFE
ForcesAndSourcesCore * sidePtrFE
Element to integrate on the sides.
Definition: ForcesAndSourcesCore.hpp:507
order
constexpr int order
Definition: dg_projection.cpp:18
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::FaceElementForcesAndSourcesCore::conn
const EntityHandle * conn
Definition: FaceElementForcesAndSourcesCore.hpp:78
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::FaceElementForcesAndSourcesCore::num_nodes
int num_nodes
Definition: FaceElementForcesAndSourcesCore.hpp:77
convert.type
type
Definition: convert.py:64
SideNumber_multiIndex
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< ordered_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, signed char, &SideNumber::side_number > > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
Definition: RefEntsMultiIndices.hpp:101
MoFEM::FaceElementForcesAndSourcesCoreOnSide::oppositeNode
int oppositeNode
Definition: FaceElementForcesAndSourcesCoreOnSide.hpp:86
MoFEM::FaceElementForcesAndSourcesCoreOnSide::edgeSideNumber
int edgeSideNumber
Edge side number.
Definition: FaceElementForcesAndSourcesCoreOnSide.hpp:83
MoFEM::ForcesAndSourcesCore
structure to get information form mofem into EntitiesFieldData
Definition: ForcesAndSourcesCore.hpp:22
face_coords
static const double face_coords[4][9]
Definition: forces_and_sources_h1_continuity_check.cpp:13
MoFEM::FaceElementForcesAndSourcesCoreOnSide::UserDataOperator::setPtrFE
MoFEMErrorCode setPtrFE(ForcesAndSourcesCore *ptr)
Definition: FaceElementForcesAndSourcesCoreOnSide.cpp:105
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::ForcesAndSourcesCore::gaussPts
MatrixDouble gaussPts
Matrix of integration points.
Definition: ForcesAndSourcesCore.hpp:109
MoFEM::FaceElementForcesAndSourcesCoreOnSide::faceConnMap
std::array< int, 4 > faceConnMap
Definition: FaceElementForcesAndSourcesCoreOnSide.hpp:85
MoFEM::FaceElementForcesAndSourcesCoreOnSide::getRule
int getRule(int order)
Definition: FaceElementForcesAndSourcesCoreOnSide.cpp:11
MoFEM::EntitiesFieldData::dataOnEntities
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
Definition: EntitiesFieldData.hpp:57
MoFEM::FEMethod::numeredEntFiniteElementPtr
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
Definition: LoopMethods.hpp:383
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::EntitiesFieldData
data structure for finite element entity
Definition: EntitiesFieldData.hpp:40
MoFEM::FaceElementForcesAndSourcesCoreOnSide::setGaussPts
MoFEMErrorCode setGaussPts(int order)
Definition: FaceElementForcesAndSourcesCoreOnSide.cpp:16
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEM::ForcesAndSourcesCore::UserDataOperator::ptrFE
ForcesAndSourcesCore * ptrFE
Definition: ForcesAndSourcesCore.hpp:985
MoFEM::FaceElementForcesAndSourcesCoreOnSide
Base face element used to integrate on skeleton.
Definition: FaceElementForcesAndSourcesCoreOnSide.hpp:19
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359