15#ifndef ESHELBIANINTERFACE_HPP
16 #define ESHELBIANINTERFACE_HPP
22 boost::shared_ptr<Range> ents_ptr)
27 auto fe_handle = getFEEntityHandle();
28 if (
entsPtr->contains(fe_handle) ==
false) {
31 auto nb_gauss_pts = getGaussPts().size2();
33 auto &moab = m_field.getMoab();
34 const void *tag_data[] = {
nullptr};
35 const void tag_sizes[] = {0};
36 CHKERR moab.tag_get_by_ptr(
tagHandle, &fe_handle, 1, tag_data, tag_sizes);
37 if (tag_sizes[0] % nb_gauss_pts != 0) {
39 "Tag length not compatible with number of gauss pts");
41 data_ptr->resize(tag_sizes[0] / nb_gauss_pts, nb_gauss_pts,
false);
42 std::copy(
static_cast<const double *
>(tag_data[0]),
43 static_cast<const double *
>(tag_data[0]) + tag_sizes[0],
44 data_ptr->data().begin());
56 boost::shared_ptr<Range> ents_ptr)
61 auto fe_handle = getFEEntityHandle();
62 if (
entsPtr->contains(fe_handle) ==
false) {
66 auto &moab = m_field.getMoab();
67 int tag_length = data_ptr->data().size();
69 data_ptr->data().data(), tag_length);
80 virtual MatrixDouble &
81 getGapAtPts(boost::shared_ptr<DataAtIntegrationPts> data_ptr, ,
82 MatrixDouble &normalsAtGaussPts,
int sense) = 0;
83 virtual MatrixDouble &
85 MatrixDouble &normalsAtGaussPts,
int sense) = 0;
90 MatrixDouble &
getGapAtPts(boost::shared_ptr<DataAtIntegrationPts> data_ptr,
91 MatrixDouble &normalsAtGaussPts,
int sense) {
98 auto nb_gauss_pts = data_ptr->approxPAtPts.size2();
99 auto t_approx_P = getFTensor2FromMat<3, 3>(data_ptr->approxPAtPts);
100 double *ptr = normalsAtGaussPts().data().data();
103 gapAtPts.resize(3, nb_gauss_pts,
false);
104 auto t_delta_gap = getFTensor2FromMat<3, 3>(
gapAtPts);
105 for (
size_t gp = 0; gp < nb_gauss_pts; ++gp) {
106 auto nrm2 = t_normal.
l2();
107 t_traction(
i) = t_approx_P(
i,
J) * (sense * t_normal(
J) / nrm2);
108 t_gap(
i) = t_traction(
i) * (
h /
E);
124 MatrixDouble &normalsAtGaussPts,
int sense) {
127 auto nb_gauss_pts = data_ptr->approxPAtPts.size2();
128 double *ptr = normalsAtGaussPts().data().data();
133 for (
size_t gp = 0; gp < nb_gauss_pts; ++gp) {
153 using OP =
typename FormsIntegrators<FaceUserDataOperator>::Assembly<
157 boost::shared_ptr<std::vector<BrokenBaseSideData>> broken_base_side_data,
158 std::string row_field, boost::shared_ptr<DataAtIntegrationPts> data_ptr,
159 boost::shared_ptr<CrackInterface> release_data_ptr,
160 boost::shared_ptr<Range> ents_ptr =
nullptr)
161 :
OP(broken_base_side_data, ents_ptr),
dataAtPts(data_ptr),
164 MoFEMErrorCode
doWork(
int row_side, EntityType row_type,
165 EntitiesFieldData::EntData &row_data) {
170 if (OP::entsPtr->find(this->getFEEntityHandle()) == OP::entsPtr->end())
175 if (!brokenBaseSideData) {
180 auto do_work_rhs = [
this](
int row_side, EntityType row_type,
181 EntitiesFieldData::EntData &row_data,
int sense) {
184 OP::nbRows = row_data.getIndices().size();
188 OP::nbIntegrationPts = OP::getGaussPts().size2();
190 OP::nbRowBaseFunctions = OP::getNbOfBaseFunctions(row_data);
192 OP::locF.resize(OP::nbRows,
false);
198 CHKERR this->aSsemble(row_data);
202 switch (OP::opType) {
205 "LHS not implemented for OpEvalExponentialGriffithReleaseRhs");
208 for (
auto &bd : *brokenBaseSideData) {
209 CHKERR do_work_rhs(bd.getSide(), bd.getType(), bd.getData(),
215 (std::string(
"wrong op type ") +
216 OpBaseDerivativesBase::OpTypeNames[OP::opType])
230 auto nb_gauss_pts = getGaussPts().size2();
232 OP::locF.resize(nb_dofs,
false);
237 t_delta_gap = getFTensor1FromMat<3>(gap_map);
239 auto area = OP::getMeasure();
240 auto t_w = OP::getFTensor0IntegrationWeight();
241 auto t_normal = getFTensor1NormalsAtGaussPts();
243 auto sense = bd.getSense();
245 for (
auto gp = 0; gp < nb_gauss_pts; ++gp) {
246 double alpha = t_w / 2.;
248 auto t_rhs = getFTensor1FromPtr<3>(OP::locF.data().data());
249 for (; bb != nb_dofs /
SPACE_DIM; ++bb) {
251 alpha * (t_row_base(
J) * (
rowSense * t_normal(
J))) * t_delta_gap(
i);
271 using OP =
typename FormsIntegrators<FaceUserDataOperator>::Assembly<
275 boost::shared_ptr<std::vector<BrokenBaseSideData>> broken_base_side_data,
276 std::string row_field, std::string col_field,
277 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
278 boost::shared_ptr<CrackInteface> release_data_ptr,
279 boost::shared_ptr<Range> ents_ptr =
nullptr)
280 :
OP(broken_base_side_data, ents_ptr),
dataAtPts(data_ptr),
283 MoFEMErrorCode
doWork(
int row_side, EntityType row_type,
284 EntitiesFieldData::EntData &row_data) {
288 if (OP::entsPtr->find(this->getFEEntityHandle()) == OP::entsPtr->end())
293 if (!brokenBaseSideData) {
298 auto do_work_lhs = [
this](
int row_side,
int col_side, EntityType row_type,
300 EntitiesFieldData::EntData &row_data,
301 EntitiesFieldData::EntData &col_data,
302 int row_sense,
int col_sense) {
305 auto check_if_assemble_transpose = [&] {
307 if (OP::rowSide != OP::colSide || OP::rowType != OP::colType)
311 }
else if (OP::assembleTranspose) {
317 OP::rowSide = row_side;
318 OP::rowType = row_type;
319 OP::colSide = col_side;
320 OP::colType = col_type;
321 OP::nbCols = col_data.getIndices().size();
322 OP::locMat.resize(OP::nbRows, OP::nbCols,
false);
327 CHKERR this->aSsemble(row_data, col_data, check_if_assemble_transpose());
331 switch (OP::opType) {
334 for (
auto &bd : *brokenBaseSideData) {
337 if (bd.getData().getSpace() !=
HDIV &&
338 bd.getData().getSpace() !=
HCURL) {
340 (std::string(
"Expect Hdiv or Hcurl space but received ") +
344 if (!bd.getData().getNSharedPtr(bd.getData().getBase())) {
346 "base functions not set");
355 bd.getSide(), bd.getSide(),
358 bd.getType(), bd.getType(),
361 bd.getData(), bd.getData(),
375 "Op LHS is done by OP space");
379 (std::string(
"wrong op type ") +
380 OpBaseDerivativesBase::OpTypeNames[OP::opType])
395 auto nb_gauss_pts = getGaussPts().size2();
396 int nb_row_dofs = row_data.
getIndices().size();
397 int nb_col_dofs = col_data.
getIndices().size();
398 OP::locMat.resize(nb_row_dofs, nb_col_dofs,
false);
403 t_inv_D = getFTensor2FromMat<3, 3>(stiffens_map);
405 auto t_w = OP::getFTensor0IntegrationWeight();
407 for (
auto gp = 0; gp < nb_gauss_pts; ++gp) {
408 double alpha = t_w / 2.;
409 auto nrm2 = t_normal.l2();
411 for (; rr != nb_dofs /
SPACE_DIM; ++rr) {
412 auto t_row = t_row_base(
J) * (
rowSense * t_normal(
J));
414 auto t_mat = getFTensor2FromMat<3, 3, 3>(OP::locMat(rr * 3, 0));
415 for (
int cc = 0; cc != nb_dofs /
SPACE_DIM; ++cc) {
416 auto t_col = t_col_base(
J) * ((
colSense * t_normal(
J)) / nrm2);
417 t_mat(
i,
j) += (alpha * (t_row * t_col)) * t_inv_D(
i,
j);
#define FTENSOR_INDEX(DIM, I)
constexpr int SPACE_DIM
[Define dimension]
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ HCURL
field with continuous tangents
@ HDIV
field with continuous normal traction
static const char *const FieldSpaceNames[]
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
FTensor::Index< 'j', 3 > j
virtual MatrixDouble & getInvStiffnessAtPts(boost::shared_ptr< DataAtIntegrationPts > data_ptr, MatrixDouble &normalsAtGaussPts, int sense)=0
virtual MatrixDouble & getGapAtPts(boost::shared_ptr< DataAtIntegrationPts > data_ptr,, MatrixDouble &normalsAtGaussPts, int sense)=0
MatrixDouble & getGapAtPts(boost::shared_ptr< DataAtIntegrationPts > data_ptr, MatrixDouble &normalsAtGaussPts, int sense)
MatrixDouble invStiffnessAtPts
MatrixDouble & getInvStiffnessAtPts(boost::shared_ptr< DataAtIntegrationPts > data_ptr, MatrixDouble &normalsAtGaussPts, int sense)
OpGetTagData(boost::shared_ptr< DataAtIntegrationPts > data_ptr, Tag th, boost::shared_ptr< Range > ents_ptr)
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
boost::shared_ptr< Range > entsPtr
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
MoFEMErrorCode doWork(int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
boost::shared_ptr< CrackInterface > releaseDataPtr
MoFEMErrorCode iNtegrate(EntData &row_data, EntData &col_data)
OpInterfaceLhs(boost::shared_ptr< std::vector< BrokenBaseSideData > > broken_base_side_data, std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< CrackInteface > release_data_ptr, boost::shared_ptr< Range > ents_ptr=nullptr)
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode doWork(int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
OpInterfaceRhs(boost::shared_ptr< std::vector< BrokenBaseSideData > > broken_base_side_data, std::string row_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< CrackInterface > release_data_ptr, boost::shared_ptr< Range > ents_ptr=nullptr)
boost::shared_ptr< CrackInterface > releaseDataPtr
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
boost::shared_ptr< Range > entsPtr
OpSetTagData(boost::shared_ptr< DataAtIntegrationPts > data_ptr, Tag th, boost::shared_ptr< Range > ents_ptr)
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Data on single entity (This is passed as argument to DataOperator::doWork)
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.