v0.10.0
Classes | Public Member Functions | Public Attributes | List of all members
SkeletonFE Struct Reference
Inheritance diagram for SkeletonFE:
[legend]
Collaboration diagram for SkeletonFE:
[legend]

Classes

struct  OpFaceSide
 

Public Member Functions

 SkeletonFE (MoFEM::Interface &m_field, CommonData &elem_data)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 
 SkeletonFE (MoFEM::Interface &m_field, CommonData &elem_data)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 
 SkeletonFE (MoFEM::Interface &m_field, CommonData &elem_data)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 

Public Attributes

CommonDataelemData
 
FaceEleOnSide faceSideFe
 
MatrixDouble jac
 

Detailed Description

Examples
continuity_check_on_skeleton_3d.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, and continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp.

Definition at line 46 of file continuity_check_on_skeleton_with_simple_2d_for_h1.cpp.

Constructor & Destructor Documentation

◆ SkeletonFE() [1/3]

SkeletonFE::SkeletonFE ( MoFEM::Interface m_field,
CommonData elem_data 
)

Definition at line 103 of file continuity_check_on_skeleton_with_simple_2d_for_h1.cpp.

104  : EdgeEle::UserDataOperator("FIELD", UserDataOperator::OPROW),
105  faceSideFe(m_field), elemData(elem_data) {
106  faceSideFe.getOpPtrVector().push_back(new SkeletonFE::OpFaceSide(elemData));
107  }

◆ SkeletonFE() [2/3]

SkeletonFE::SkeletonFE ( MoFEM::Interface m_field,
CommonData elem_data 
)

Definition at line 95 of file continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp.

96  : EdgeEle::UserDataOperator("FIELD", UserDataOperator::OPROW),
97  faceSideFe(m_field), elemData(elem_data) {
98  faceSideFe.getOpPtrVector().push_back(new SkeletonFE::OpFaceSide(elemData));
99  }

◆ SkeletonFE() [3/3]

SkeletonFE::SkeletonFE ( MoFEM::Interface m_field,
CommonData elem_data 
)

Definition at line 98 of file continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp.

99  : EdgeEle::UserDataOperator("FIELD", UserDataOperator::OPROW),
100  faceSideFe(m_field), elemData(elem_data) {
101 
102  faceSideFe.getOpPtrVector().push_back(new OpCalculateJacForFace(jac));
103  faceSideFe.getOpPtrVector().push_back(new OpMakeHdivFromHcurl());
104  faceSideFe.getOpPtrVector().push_back(
106  faceSideFe.getOpPtrVector().push_back(
108 
109  }

Member Function Documentation

◆ doWork() [1/3]

MoFEMErrorCode SkeletonFE::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)

Definition at line 109 of file continuity_check_on_skeleton_with_simple_2d_for_h1.cpp.

110  {
111 
113  if (type == MBEDGE) {
114 
115  const size_t nb_dofs = data.getN().size2();
116  const size_t nb_integration_pts = data.getN().size1();
117 
118  MOFEM_LOG("ATOM", Sev::noisy)
119  << "Cords at integration points" << getCoordsAtGaussPts();
120 
121  auto t_base = data.getFTensor0N();
122  elemData.dotEdge.resize(nb_integration_pts, nb_dofs, false);
123  elemData.dotEleLeft.resize(nb_integration_pts, 0, false);
124  elemData.dotEleRight.resize(nb_integration_pts, 0, false);
125 
126  for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
127  for (size_t bb = 0; bb != nb_dofs; ++bb) {
128  elemData.dotEdge(gg, bb) = t_base;
129  ++t_base;
130  }
131  }
132 
133  CHKERR loopSideFaces("dFE", faceSideFe);
134 
135  auto check_continuity_of_base = [&](auto &vol_dot_data) {
137 
138  if (vol_dot_data.size1() != elemData.dotEdge.size1())
139  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
140  "Inconsistent number of integration points");
141 
142  if (vol_dot_data.size2() != elemData.dotEdge.size2())
143  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
144  "Inconsistent number of base functions");
145  const double eps = 1e-12;
146  for (size_t gg = 0; gg != vol_dot_data.size1(); ++gg)
147  for (size_t bb = 0; bb != vol_dot_data.size2(); ++bb) {
148  const double error =
149  std::abs(vol_dot_data(gg, bb) - elemData.dotEdge(gg, bb));
150  if (error > eps)
151  SETERRQ4(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
152  "Inconsistency (%d, %d) %3.4e != %3.4e", gg, bb,
153  vol_dot_data(gg, bb), elemData.dotEdge(gg, bb));
154  else
155  MOFEM_LOG("ATOM", Sev::noisy) << "Ok";
156  }
158  };
159 
160  if (elemData.dotEleLeft.size2() != 0)
161  CHKERR check_continuity_of_base(elemData.dotEleLeft);
162  else if (elemData.dotEleRight.size2() != 0)
163  CHKERR check_continuity_of_base(elemData.dotEleRight);
164  }
166  }

◆ doWork() [2/3]

MoFEMErrorCode SkeletonFE::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)

Definition at line 101 of file continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp.

102  {
103 
105  if (type == MBEDGE) {
106 
107  const size_t nb_dofs = data.getN().size2() / 3;
108  const size_t nb_integration_pts = data.getN().size1();
109 
110  auto t_tangent = getFTensor1Direction();
111  auto t_hcurl_base = data.getFTensor1N<3>();
113  elemData.dotEdge.resize(nb_integration_pts, nb_dofs, false);
114  elemData.dotEleLeft.resize(nb_integration_pts, 0, false);
115  elemData.dotEleRight.resize(nb_integration_pts, 0, false);
116 
117  for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
118  for (size_t bb = 0; bb != nb_dofs; ++bb) {
119  elemData.dotEdge(gg, bb) = t_tangent(i) * t_hcurl_base(i);
120  ++t_hcurl_base;
121  }
122  }
123 
124  CHKERR loopSideFaces("dFE", faceSideFe);
125 
126  auto check_continuity_of_base = [&](auto &vol_dot_data) {
128 
129  if (vol_dot_data.size1() != elemData.dotEdge.size1())
130  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
131  "Inconsistent number of integration points");
132 
133  if (vol_dot_data.size2() != elemData.dotEdge.size2())
134  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
135  "Inconsistent number of base functions");
136  const double eps = 1e-12;
137  for (size_t gg = 0; gg != vol_dot_data.size1(); ++gg)
138  for (size_t bb = 0; bb != vol_dot_data.size2(); ++bb) {
139  const double error =
140  std::abs(vol_dot_data(gg, bb) - elemData.dotEdge(gg, bb));
141  if (error > eps)
142  SETERRQ4(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
143  "Inconsistency (%d, %d) %3.4e != %3.4e", gg, bb,
144  vol_dot_data(gg, bb), elemData.dotEdge(gg, bb));
145  else
146  MOFEM_LOG("ATOM", Sev::noisy) << "Ok";
147 
148  }
150  };
151 
152  if (elemData.dotEleLeft.size2() != 0)
153  CHKERR check_continuity_of_base(elemData.dotEleLeft);
154  else if (elemData.dotEleRight.size2() != 0)
155  CHKERR check_continuity_of_base(elemData.dotEleRight);
156 
157  }
159  }

◆ doWork() [3/3]

MoFEMErrorCode SkeletonFE::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)

Definition at line 111 of file continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp.

112  {
113 
115  if (type == MBEDGE) {
116 
117  const size_t nb_dofs = data.getN().size2() / 3;
118  const size_t nb_integration_pts = data.getN().size1();
119 
120  auto &dir = getDirection();
121  FTensor::Tensor1<double, 2> t_normal{-dir(1), dir(0)};
122  auto t_hdiv_base = data.getFTensor1N<3>();
124  elemData.dotEdge.resize(nb_integration_pts, nb_dofs, false);
125  elemData.dotEleLeft.resize(nb_integration_pts, 0, false);
126  elemData.dotEleRight.resize(nb_integration_pts, 0, false);
127 
128  for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
129  for (size_t bb = 0; bb != nb_dofs; ++bb) {
130  elemData.dotEdge(gg, bb) = t_normal(i) * t_hdiv_base(i);
131  ++t_hdiv_base;
132  }
133  }
134 
135  CHKERR loopSideFaces("dFE", faceSideFe);
136 
137  auto check_continuity_of_base = [&](auto &vol_dot_data) {
139 
140  if (vol_dot_data.size1() != elemData.dotEdge.size1())
141  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
142  "Inconsistent number of integration points");
143 
144  if (vol_dot_data.size2() != elemData.dotEdge.size2())
145  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
146  "Inconsistent number of base functions");
147  const double eps = 1e-12;
148  for (size_t gg = 0; gg != vol_dot_data.size1(); ++gg)
149  for (size_t bb = 0; bb != vol_dot_data.size2(); ++bb) {
150  const double error =
151  std::abs(vol_dot_data(gg, bb) - elemData.dotEdge(gg, bb));
152  if (error > eps)
153  SETERRQ4(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
154  "Inconsistency (%d, %d) %3.4e != %3.4e", gg, bb,
155  vol_dot_data(gg, bb), elemData.dotEdge(gg, bb));
156  }
158  };
159 
160  if (elemData.dotEleLeft.size2() != 0)
161  CHKERR check_continuity_of_base(elemData.dotEleLeft);
162  else if (elemData.dotEleRight.size2() != 0)
163  CHKERR check_continuity_of_base(elemData.dotEleRight);
164 
165  }
167  }

Member Data Documentation

◆ elemData

CommonData & SkeletonFE::elemData

◆ faceSideFe

FaceEleOnSide SkeletonFE::faceSideFe

◆ jac

MatrixDouble SkeletonFE::jac

The documentation for this struct was generated from the following files:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
MoFEM::OpCalculateJacForFace
Calculate jacobian for face element.
Definition: UserDataOperators.hpp:1865
FTensor::Tensor1
Definition: Tensor1_value.hpp:9
eps
constexpr double eps
Definition: forces_and_sources_getting_mult_H1_H1_atom_test.cpp:30
MoFEM::OpSetContravariantPiolaTransformFace
Apply contravariant (Piola) transfer to Hdiv space on face.
Definition: UserDataOperators.hpp:1991
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:604
MoFEM::DataForcesAndSourcesCore::EntData::getFTensor1N
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
Definition: DataStructures.cpp:587
SkeletonFE::faceSideFe
FaceEleOnSide faceSideFe
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:101
convert.type
type
Definition: convert.py:66
FTensor::Index< 'i', 3 >
MoFEM::OpMakeHdivFromHcurl
Make Hdiv space from Hcurl space in 2d.
Definition: UserDataOperators.hpp:1958
SkeletonFE::elemData
CommonData & elemData
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:100
MoFEM::DataForcesAndSourcesCore::EntData::getFTensor0N
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
Definition: DataStructures.hpp:1459
CommonData::dotEdge
MatrixDouble dotEdge
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:41
CommonData::dotEleRight
MatrixDouble dotEleRight
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:43
SkeletonFE::OpFaceSide
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:48
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:312
CommonData::dotEleLeft
MatrixDouble dotEleLeft
Definition: continuity_check_on_skeleton_with_simple_2d_for_h1.cpp:42
MoFEM::DataForcesAndSourcesCore::EntData::getN
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
Definition: DataStructures.hpp:1288
SkeletonFE::jac
MatrixDouble jac
Definition: continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp:96
MOFEM_ATOM_TEST_INVALID
@ MOFEM_ATOM_TEST_INVALID
Definition: definitions.h:132
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
MoFEM::ForcesAndSourcesCore::UserDataOperator
friend class UserDataOperator
Definition: ForcesAndSourcesCore.hpp:818
i
FTensor::Index< 'i', 3 > i
Definition: matrix_function.cpp:18
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415