17 ublas::vector<MatrixDouble>
R;
73 double def_damaged = 0;
76 MB_TAG_CREAT | MB_TAG_SPARSE, &def_damaged);
77 const int def_len = 0;
79 "_KAPPA", def_len, MB_TYPE_DOUBLE,
thKappa,
80 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN,
nullptr);
94 double calcG(
int gg, MatrixDouble gap_loc) {
95 return sqrt(pow(gap_loc(gg, 0), 2) +
96 beta * (pow(gap_loc(gg, 1), 2) + pow(gap_loc(gg, 2), 2)));
106 EntityHandle ent = fe_method->numeredEntFiniteElementPtr->getEnt();
110 if (rval != MB_SUCCESS ||
kappaSize != nb_gauss_pts) {
112 kappa.resize(nb_gauss_pts);
115 tag_size[0] = nb_gauss_pts;
116 void const *tag_data[] = {&
kappa[0]};
166 }
else if (
kappa > 0) {
177 const VectorDouble &gap_loc,
188 Dloc(0, 0) = (1 -
omega) *
E0 - domega *
E0 * gap_loc[0] * gap_loc[0] /
g;
189 Dloc(0, 1) = -domega *
E0 * gap_loc[0] *
beta * gap_loc[1] /
g;
190 Dloc(0, 2) = -domega *
E0 * gap_loc[0] *
beta * gap_loc[2] /
g;
192 Dloc(1, 0) = -domega *
E0 * gap_loc[1] * gap_loc[0] /
g;
194 (1 -
omega) *
E0 - domega *
E0 * gap_loc[1] *
beta * gap_loc[1] /
g;
195 Dloc(1, 2) = -domega *
E0 * gap_loc[1] *
beta * gap_loc[2] /
g;
197 Dloc(2, 0) = -domega *
E0 * gap_loc[2] * gap_loc[0] /
g;
198 Dloc(2, 1) = -domega *
E0 * gap_loc[2] *
beta * gap_loc[1] /
g;
200 (1 -
omega) *
E0 - domega *
E0 * gap_loc[2] *
beta * gap_loc[2] /
g;
231 ublas::matrix_row<MatrixDouble> gap_glob(common_data.
gapGlob, gg);
232 noalias(traction) = prod(
Dglob, gap_glob);
238 virtual MoFEMErrorCode
257 CHKERR SNESGetIterationNumber(fe_method->snes, &iter);
261 ublas::matrix_row<MatrixDouble> g_loc(common_data.
gapLoc, gg);
264 tangent_matrix.resize(3, 3);
265 noalias(tangent_matrix) =
Dglob;
266 }
catch (
const std::exception &ex) {
267 std::ostringstream ss;
268 ss <<
"throw in method: " << ex.what() << std::endl;
269 SETERRQ(PETSC_COMM_SELF, 1, ss.str().c_str());
285 bool all_gauss_pts_damaged =
true;
286 for (
unsigned int gg = 0; gg < common_data.
gapGlob.size1(); gg++) {
293 all_gauss_pts_damaged =
false;
296 if (all_gauss_pts_damaged) {
297 EntityHandle ent = fe_method->numeredEntFiniteElementPtr->getEnt();
298 int set_prism_as_demaged = 1;
300 &set_prism_as_demaged);
309 :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
316 EntitiesFieldData::EntData &data) {
318 if (data.getN().size1() == 0)
320 if (data.getN().size2() == 0)
324 for (
unsigned int gg = 0; gg < data.getN().size1(); gg++) {
325 for (
int nn = 3; nn < 6; nn++) {
326 data.getN()(gg, nn) *= -1;
341 SETERRQ(PETSC_COMM_SELF, 1,
"data inconsitency");
350 :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
359 EntitiesFieldData::EntData &data) {
362 int nb_dofs = data.getIndices().size();
365 int nb_gauss_pts = data.getN().size1();
366 if (
type == MBVERTEX) {
368 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
370 double nrm2_normal = 0;
371 double nrm2_tangent1 = 0;
372 double nrm2_tangent2 = 0;
373 for (
int dd = 0; dd < 3; dd++) {
374 nrm2_normal += pow(getNormalsAtGaussPtsF3()(gg, dd), 2);
375 nrm2_tangent1 += pow(getTangent1AtGaussPtF3()(gg, dd), 2);
376 nrm2_tangent2 += pow(getTangent2AtGaussPtF3()(gg, dd), 2);
378 nrm2_normal = sqrt(nrm2_normal);
379 nrm2_tangent1 = sqrt(nrm2_tangent1);
380 nrm2_tangent2 = sqrt(nrm2_tangent2);
381 for (
int dd = 0; dd < 3; dd++) {
383 getNormalsAtGaussPtsF3()(gg, dd) / nrm2_normal;
385 getTangent1AtGaussPtF3()(gg, dd) / nrm2_tangent1;
387 getTangent2AtGaussPtF3()(gg, dd) / nrm2_tangent2;
391 if (
type == MBVERTEX) {
395 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
396 for (
int dd = 0; dd < 3; dd++) {
398 nb_dofs / 3, &data.getN(gg)[0], 1, &data.getFieldData()[dd], 3);
401 }
catch (
const std::exception &ex) {
402 std::ostringstream ss;
403 ss <<
"throw in method: " << ex.what() << std::endl;
404 SETERRQ(PETSC_COMM_SELF, 1, ss.str().c_str());
413 :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
422 EntitiesFieldData::EntData &data) {
425 if (
type == MBVERTEX) {
426 int nb_gauss_pts = data.getN().size1();
428 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
434 }
catch (
const std::exception &ex) {
435 std::ostringstream ss;
436 ss <<
"throw in method: " << ex.what() << std::endl;
437 SETERRQ(PETSC_COMM_SELF, 1, ss.str().c_str());
445 struct OpRhs :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
457 EntitiesFieldData::EntData &data) {
461 int nb_dofs = data.getIndices().size();
465 getNumeredEntFiniteElementPtr()->getEnt()) ==
471 int nb_gauss_pts = data.getN().size1();
472 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
475 double w = getGaussPts()(2, gg) *
476 cblas_dnrm2(3, &getNormalsAtGaussPtsF3()(gg, 0), 1) * 0.5;
477 for (
int nn = 0; nn < nb_dofs / 3; nn++) {
478 for (
int dd = 0; dd < 3; dd++) {
479 Nf[3 * nn + dd] += w * data.getN(gg)[nn] *
traction[dd];
483 CHKERR VecSetValues(getFEMethod()->snes_f, data.getIndices().size(),
484 &data.getIndices()[0], &
Nf[0], ADD_VALUES);
485 }
catch (
const std::exception &ex) {
486 std::ostringstream ss;
487 ss <<
"throw in method: " << ex.what() << std::endl;
488 SETERRQ(PETSC_COMM_SELF, 1, ss.str().c_str());
496 struct OpLhs :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
509 MoFEMErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
511 EntitiesFieldData::EntData &row_data,
512 EntitiesFieldData::EntData &col_data) {
516 int nb_row = row_data.getIndices().size();
519 int nb_col = col_data.getIndices().size();
523 getNumeredEntFiniteElementPtr()->getEnt()) ==
527 ND.resize(nb_row, 3);
528 K.resize(nb_row, nb_col);
530 int nb_gauss_pts = row_data.getN().size1();
531 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
534 double w = getGaussPts()(2, gg) *
535 cblas_dnrm2(3, &getNormalsAtGaussPtsF3()(gg, 0), 1) * 0.5;
537 for (
int nn = 0; nn < nb_row / 3; nn++) {
538 for (
int dd = 0; dd < 3; dd++) {
539 for (
int DD = 0; DD < 3; DD++) {
540 ND(3 * nn + dd, DD) += row_data.getN(gg)[nn] *
D(dd, DD);
544 for (
int nn = 0; nn < nb_row / 3; nn++) {
545 for (
int dd = 0; dd < 3; dd++) {
546 for (
int NN = 0; NN < nb_col / 3; NN++) {
547 for (
int DD = 0; DD < 3; DD++) {
548 K(3 * nn + dd, 3 * NN + DD) +=
549 w *
ND(3 * nn + dd, DD) * col_data.getN(gg)[NN];
555 CHKERR MatSetValues(getFEMethod()->snes_B, nb_row,
556 &row_data.getIndices()[0], nb_col,
557 &col_data.getIndices()[0], &
K(0, 0), ADD_VALUES);
558 }
catch (
const std::exception &ex) {
559 std::ostringstream ss;
560 ss <<
"throw in method: " << ex.what() << std::endl;
561 SETERRQ(PETSC_COMM_SELF, 1, ss.str().c_str());
570 :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
581 EntitiesFieldData::EntData &data) {
584 if (
type != MBVERTEX)
587 getNumeredEntFiniteElementPtr()->getEnt()) ==
600 boost::ptr_vector<CohesiveInterfaceElement::PhysicalEquation>
625 boost::ptr_vector<CohesiveInterfaceElement::PhysicalEquation>::iterator pit;
626 for (pit = interfaces.begin(); pit != interfaces.end(); pit++) {
ForcesAndSourcesCore::UserDataOperator UserDataOperator
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
constexpr double omega
Save field DOFS on vertices/tags.
implementation of Data Operators for Forces and Sources
constexpr auto field_name
ublas::vector< MatrixDouble > R
MyPrism(MoFEM::Interface &m_field)
Operator calculate gap, normal vector and rotation matrix.
OpCalculateGapGlobal(const std::string field_name, CommonData &common_data)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator calculate gap in local coordinate system.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
OpCalculateGapLocal(const std::string field_name, CommonData &common_data)
Operator update history variables.
PhysicalEquation & physicalEqations
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
OpHistory(const std::string field_name, CommonData &common_data, PhysicalEquation &physical_eqations)
Operator calculate element stiffens matrix.
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
OpLhs(const std::string field_name, CommonData &common_data, PhysicalEquation &physical_eqations)
PhysicalEquation & physicalEqations
Operator calculate right hand side vector.
OpRhs(const std::string field_name, CommonData &common_data, PhysicalEquation &physical_eqations)
PhysicalEquation & physicalEqations
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Set negative sign to shape functions on face 4.
OpSetSignToShapeFunctions(const std::string field_name)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Constitutive (physical) equation for interface.
MoFEM::Interface & mField
double calcG(int gg, MatrixDouble gap_loc)
Calculate gap opening.
virtual MoFEMErrorCode calculateTangentStiffeness(MatrixDouble &tangent_matrix, int gg, CommonData &common_data, const FEMethod *fe_method)
Calculate tangent stiffness.
MoFEMErrorCode iNitailise(const FEMethod *fe_method)
Initialize history variable data.
PhysicalEquation(MoFEM::Interface &m_field)
virtual ~PhysicalEquation()
MoFEMErrorCode calcOmega(const double kappa, double &omega)
Calculate damage.
MoFEMErrorCode calcTangetDglob(const double omega, double g, const VectorDouble &gap_loc, MatrixDouble &R)
Calculate tangent material stiffness.
MoFEMErrorCode calcDglob(const double omega, MatrixDouble &R)
Calculate stiffness material matrix.
virtual MoFEMErrorCode updateHistory(CommonData &common_data, const FEMethod *fe_method)
Update history variables when converged.
MoFEMErrorCode getKappa(int nb_gauss_pts, const FEMethod *fe_method)
Get pointer from the mesh to histoy variables .
virtual MoFEMErrorCode calculateTraction(VectorDouble &traction, int gg, CommonData &common_data, const FEMethod *fe_method)
Calculate tractions.
Cohesive element implementation.
virtual ~CohesiveInterfaceElement()
MoFEMErrorCode addOps(const std::string field_name, boost::ptr_vector< CohesiveInterfaceElement::PhysicalEquation > &interfaces)
Driver function settting all operators needed for interface element.
CohesiveInterfaceElement(MoFEM::Interface &m_field)
virtual moab::Interface & get_moab()=0
Deprecated interface functions.
FlatPrism finite element.
FlatPrismElementForcesAndSourcesCore(Interface &m_field)
std::string meshPositionsFieldName
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.