v0.13.2
Loading...
Searching...
No Matches
VolumeElementForcesAndSourcesCoreOnSide.cpp
Go to the documentation of this file.
1/** \file VolumeElementForcesAndSourcesCoreOnSide.cpp
2
3\brief Implementation of volume element on side
4
5*/
6
7
8
9namespace MoFEM {
10
12 return -1;
13};
14
18
19 if (!sidePtrFE)
20 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Side element not set");
21
22 const auto type = numeredEntFiniteElementPtr->getEntType();
23 const auto nb_nodes_on_ele = CN::VerticesPerEntity(type);
24
25 auto face_ptr_fe =
27
28 const auto face_entity = sidePtrFE->numeredEntFiniteElementPtr->getEnt();
29 auto &side_table = const_cast<SideNumber_multiIndex &>(
30 numeredEntFiniteElementPtr->getSideNumberTable());
31 auto sit = side_table.get<0>().find(face_entity);
32 if (sit == side_table.get<0>().end())
33 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
34 "Face can not be found on volume element");
35
36 const auto nb_nodes_on_face = CN::VerticesPerEntity((*sit)->getEntType());
37
38 faceSense = (*sit)->sense;
39 faceSideNumber = (*sit)->side_number;
40 fill(&tetConnMap[0], &tetConnMap[nb_nodes_on_ele], -1);
41 for (int nn = 0; nn != nb_nodes_on_face; ++nn) {
42 faceConnMap[nn] = std::distance(
43 conn, find(conn, &conn[nb_nodes_on_ele], face_ptr_fe->conn[nn]));
44 tetConnMap[faceConnMap[nn]] = nn;
45 if (faceConnMap[nn] >= nb_nodes_on_ele)
46 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
47 "No common node on face and element can not be found");
48 }
49
50 oppositeNode = std::distance(
51 &tetConnMap[0], find(&tetConnMap[0], &tetConnMap[nb_nodes_on_ele], -1));
52
53 const int nb_gauss_pts = face_ptr_fe->gaussPts.size2();
54 gaussPts.resize(4, nb_gauss_pts, false);
55 gaussPts.clear();
56
57 constexpr double tet_coords[12] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1};
58 constexpr double hex_coords[24] = {0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0,
59 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1};
60
61 auto set_gauss = [&](auto &coords) {
64 auto &data = *face_ptr_fe->dataOnElement[H1];
65 auto t_base = data.dataOnEntities[MBVERTEX][0].getFTensor0N(NOBASE);
67 &gaussPts(0, 0), &gaussPts(1, 0), &gaussPts(2, 0)};
68 for (int gg = 0; gg != nb_gauss_pts; ++gg) {
69 for (int bb = 0; bb != nb_nodes_on_face; ++bb) {
70 const int shift = 3 * faceConnMap[bb];
72 coords[shift + 0], coords[shift + 1], coords[shift + 2]};
73 t_gauss_coords(i) += t_base * t_coords(i);
74 ++t_base;
75 }
76 ++t_gauss_coords;
77 gaussPts(3, gg) = face_ptr_fe->gaussPts(2, gg);
78 }
80 };
81
82 switch (type) {
83 case MBTET:
84 CHKERR set_gauss(tet_coords);
85 break;
86 case MBHEX:
87 CHKERR set_gauss(hex_coords);
88 break;
89 default:
90 SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
91 "Element type not implemented: %d", type);
92 }
93
95}
96
98VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::setPtrFE(
101 if (!(ptrFE =
102 dynamic_cast<VolumeElementForcesAndSourcesCoreOnSide *>(ptr)))
103 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
104 "User operator and finite element do not work together");
106}
107
108} // 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
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.
FTensor::Index< 'i', SPACE_DIM > i
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
structure to get information form mofem into EntitiesFieldData
ForcesAndSourcesCore * sidePtrFE
Element to integrate on the sides.
MatrixDouble gaussPts
Matrix of integration points.
Base volume element used to integrate on skeleton.