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;
286 bool all_gauss_pts_damaged =
true;
287 for (
unsigned int gg = 0; gg < common_data.
gapGlob.size1(); gg++) {
294 all_gauss_pts_damaged =
false;
297 if (all_gauss_pts_damaged) {
298 EntityHandle ent = fe_method->numeredEntFiniteElementPtr->getEnt();
299 int set_prism_as_demaged = 1;
301 &set_prism_as_demaged);
310 :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
317 EntitiesFieldData::EntData &data) {
319 if (data.getN().size1() == 0)
321 if (data.getN().size2() == 0)
325 for (
unsigned int gg = 0; gg < data.getN().size1(); gg++) {
326 for (
int nn = 3; nn < 6; nn++) {
327 data.getN()(gg, nn) *= -1;
343 "Unexpected entity type when setting interface shape-function signs");
352 :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
361 EntitiesFieldData::EntData &data) {
364 int nb_dofs = data.getIndices().size();
367 int nb_gauss_pts = data.getN().size1();
368 if (
type == MBVERTEX) {
370 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
372 double nrm2_normal = 0;
373 double nrm2_tangent1 = 0;
374 double nrm2_tangent2 = 0;
375 for (
int dd = 0; dd < 3; dd++) {
376 nrm2_normal += pow(getNormalsAtGaussPtsF3()(gg, dd), 2);
377 nrm2_tangent1 += pow(getTangent1AtGaussPtF3()(gg, dd), 2);
378 nrm2_tangent2 += pow(getTangent2AtGaussPtF3()(gg, dd), 2);
380 nrm2_normal = sqrt(nrm2_normal);
381 nrm2_tangent1 = sqrt(nrm2_tangent1);
382 nrm2_tangent2 = sqrt(nrm2_tangent2);
383 for (
int dd = 0; dd < 3; dd++) {
385 getNormalsAtGaussPtsF3()(gg, dd) / nrm2_normal;
387 getTangent1AtGaussPtF3()(gg, dd) / nrm2_tangent1;
389 getTangent2AtGaussPtF3()(gg, dd) / nrm2_tangent2;
393 if (
type == MBVERTEX) {
397 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
398 for (
int dd = 0; dd < 3; dd++) {
400 nb_dofs / 3, &data.getN(gg)[0], 1, &data.getFieldData()[dd], 3);
403 }
catch (
const std::exception &ex) {
404 std::ostringstream ss;
405 ss <<
"throw in method: " << ex.what() << std::endl;
416 :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
425 EntitiesFieldData::EntData &data) {
428 if (
type == MBVERTEX) {
429 int nb_gauss_pts = data.getN().size1();
431 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
437 }
catch (
const std::exception &ex) {
438 std::ostringstream ss;
439 ss <<
"throw in method: " << ex.what() << std::endl;
449 struct OpRhs :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
461 EntitiesFieldData::EntData &data) {
465 int nb_dofs = data.getIndices().size();
469 getNumeredEntFiniteElementPtr()->getEnt()) ==
475 int nb_gauss_pts = data.getN().size1();
476 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
479 double w = getGaussPts()(2, gg) *
480 cblas_dnrm2(3, &getNormalsAtGaussPtsF3()(gg, 0), 1) * 0.5;
481 for (
int nn = 0; nn < nb_dofs / 3; nn++) {
482 for (
int dd = 0; dd < 3; dd++) {
483 Nf[3 * nn + dd] += w * data.getN(gg)[nn] *
traction[dd];
487 CHKERR VecSetValues(getFEMethod()->snes_f, data.getIndices().size(),
488 &data.getIndices()[0], &
Nf[0], ADD_VALUES);
489 }
catch (
const std::exception &ex) {
490 std::ostringstream ss;
491 ss <<
"throw in method: " << ex.what() << std::endl;
501 struct OpLhs :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
514 MoFEMErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
516 EntitiesFieldData::EntData &row_data,
517 EntitiesFieldData::EntData &col_data) {
521 int nb_row = row_data.getIndices().size();
524 int nb_col = col_data.getIndices().size();
528 getNumeredEntFiniteElementPtr()->getEnt()) ==
532 ND.resize(nb_row, 3);
533 K.resize(nb_row, nb_col);
535 int nb_gauss_pts = row_data.getN().size1();
536 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
539 double w = getGaussPts()(2, gg) *
540 cblas_dnrm2(3, &getNormalsAtGaussPtsF3()(gg, 0), 1) * 0.5;
542 for (
int nn = 0; nn < nb_row / 3; nn++) {
543 for (
int dd = 0; dd < 3; dd++) {
544 for (
int DD = 0; DD < 3; DD++) {
545 ND(3 * nn + dd, DD) += row_data.getN(gg)[nn] *
D(dd, DD);
549 for (
int nn = 0; nn < nb_row / 3; nn++) {
550 for (
int dd = 0; dd < 3; dd++) {
551 for (
int NN = 0; NN < nb_col / 3; NN++) {
552 for (
int DD = 0; DD < 3; DD++) {
553 K(3 * nn + dd, 3 * NN + DD) +=
554 w *
ND(3 * nn + dd, DD) * col_data.getN(gg)[NN];
560 CHKERR MatSetValues(getFEMethod()->snes_B, nb_row,
561 &row_data.getIndices()[0], nb_col,
562 &col_data.getIndices()[0], &
K(0, 0), ADD_VALUES);
563 }
catch (
const std::exception &ex) {
564 std::ostringstream ss;
565 ss <<
"throw in method: " << ex.what() << std::endl;
576 :
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
587 EntitiesFieldData::EntData &data) {
590 if (
type != MBVERTEX)
593 getNumeredEntFiniteElementPtr()->getEnt()) ==
606 boost::ptr_vector<CohesiveInterfaceElement::PhysicalEquation>
631 boost::ptr_vector<CohesiveInterfaceElement::PhysicalEquation>::iterator pit;
632 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()
@ MOFEM_STD_EXCEPTION_THROW
@ MOFEM_DATA_INCONSISTENCY
#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.