v0.13.2
Loading...
Searching...
No Matches
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
9namespace 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
105FaceElementForcesAndSourcesCoreOnSide::UserDataOperator::setPtrFE(
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
@ NOBASE
Definition: definitions.h:59
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
@ H1
continuous field
Definition: definitions.h:85
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
static const double face_coords[4][9]
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.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
data structure for finite element entity
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
Base face element used to integrate on skeleton.
structure to get information form mofem into EntitiesFieldData
ForcesAndSourcesCore * sidePtrFE
Element to integrate on the sides.
MatrixDouble gaussPts
Matrix of integration points.