19 ublas::vector<MatrixDouble >
R;
75 double def_damaged = 0;
77 "DAMAGED_PRISM",1,MB_TYPE_INTEGER,
thDamagedPrism,MB_TAG_CREAT|MB_TAG_SPARSE,&def_damaged
79 const int def_len = 0;
80 rval =
mField.
get_moab().tag_get_handle(
"_KAPPA",def_len,MB_TYPE_DOUBLE,
81 thKappa,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_VARLEN,NULL);
CHKERRG(rval);
95 double calcG(
int gg,MatrixDouble gap_loc) {
96 return sqrt(pow(gap_loc(gg,0),2)+
beta*(pow(gap_loc(gg,1),2)+pow(gap_loc(gg,2),2)));
106 EntityHandle ent = fe_method->numeredEntFiniteElementPtr->getEnt();
109 if(rval != MB_SUCCESS ||
kappaSize != nb_gauss_pts) {
111 kappa.resize(nb_gauss_pts);
114 tag_size[0] = nb_gauss_pts;
115 void const* tag_data[] = { &
kappa[0] };
181 Dloc(0,1) = -domega*
E0*gap_loc[0]*
beta*gap_loc[1]/
g;
182 Dloc(0,2) = -domega*
E0*gap_loc[0]*
beta*gap_loc[2]/
g;
184 Dloc(1,0) = -domega*
E0*gap_loc[1]*gap_loc[0]/
g;
186 Dloc(1,2) = -domega*
E0*gap_loc[1]*
beta*gap_loc[2]/
g;
188 Dloc(2,0) = -domega*
E0*gap_loc[2]*gap_loc[0]/
g;
189 Dloc(2,1) = -domega*
E0*gap_loc[2]*
beta*gap_loc[1]/
g;
204 VectorDouble &traction,
224 ublas::matrix_row<MatrixDouble > gap_glob(common_data.
gapGlob,gg);
225 noalias(traction) = prod(
Dglob,gap_glob);
232 MatrixDouble &tangent_matrix,
256 ublas::matrix_row<MatrixDouble > g_loc(common_data.
gapLoc,gg);
259 tangent_matrix.resize(3,3);
260 noalias(tangent_matrix) =
Dglob;
262 }
catch (
const std::exception& ex) {
263 std::ostringstream ss;
264 ss <<
"throw in method: " << ex.what() << std::endl;
265 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
283 bool all_gauss_pts_damaged =
true;
284 for(
unsigned int gg = 0;gg<common_data.
gapGlob.size1();gg++) {
291 all_gauss_pts_damaged =
false;
294 if(all_gauss_pts_damaged) {
295 EntityHandle ent = fe_method->numeredEntFiniteElementPtr->getEnt();
296 int set_prism_as_demaged = 1;
318 for(
unsigned int gg = 0;gg<data.getN().size1();gg++) {
319 for(
int nn = 3;nn<6;nn++) {
320 data.getN()(gg,nn) *= -1;
333 SETERRQ(PETSC_COMM_SELF,1,
"data inconsitency");
350 int side,
EntityType type,EntitiesFieldData::EntData &data) {
353 int nb_dofs = data.getIndices().size();
355 int nb_gauss_pts = data.getN().size1();
356 if(type == MBVERTEX) {
358 for(
int gg = 0;gg<nb_gauss_pts;gg++) {
360 double nrm2_normal = 0;
361 double nrm2_tangent1 = 0;
362 double nrm2_tangent2 = 0;
363 for(
int dd = 0;dd<3;dd++) {
364 nrm2_normal += pow(getNormalsAtGaussPtsF3()(gg,dd),2);
365 nrm2_tangent1 += pow(getTangent1AtGaussPtF3()(gg,dd),2);
366 nrm2_tangent2 += pow(getTangent2AtGaussPtF3()(gg,dd),2);
368 nrm2_normal = sqrt(nrm2_normal);
369 nrm2_tangent1 = sqrt(nrm2_tangent1);
370 nrm2_tangent2 = sqrt(nrm2_tangent2);
371 for(
int dd = 0;dd<3;dd++) {
372 commonData.
R[gg](0,dd) = getNormalsAtGaussPtsF3()(gg,dd)/nrm2_normal;
373 commonData.
R[gg](1,dd) = getTangent1AtGaussPtF3()(gg,dd)/nrm2_tangent1;
374 commonData.
R[gg](2,dd) = getTangent2AtGaussPtF3()(gg,dd)/nrm2_tangent2;
378 if(type == MBVERTEX) {
382 for(
int gg = 0;gg<nb_gauss_pts;gg++) {
383 for(
int dd = 0;dd<3;dd++) {
385 nb_dofs/3,&data.getN(gg)[0],1,&data.getFieldData()[dd],3);
388 }
catch (
const std::exception& ex) {
389 std::ostringstream ss;
390 ss <<
"throw in method: " << ex.what() << std::endl;
391 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
410 if(type == MBVERTEX) {
411 int nb_gauss_pts = data.getN().size1();
413 for(
int gg = 0;gg<nb_gauss_pts;gg++) {
419 }
catch (
const std::exception& ex) {
420 std::ostringstream ss;
421 ss <<
"throw in method: " << ex.what() << std::endl;
422 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
431 struct OpRhs:
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
444 int nb_dofs = data.getIndices().size();
451 int nb_gauss_pts = data.getN().size1();
452 for(
int gg = 0;gg<nb_gauss_pts;gg++) {
454 double w = getGaussPts()(2,gg)*cblas_dnrm2(3,&getNormalsAtGaussPtsF3()(gg,0),1)*0.5;
455 for(
int nn = 0;nn<nb_dofs/3;nn++) {
456 for(
int dd = 0;dd<3;dd++) {
457 Nf[3*nn+dd] += w*data.getN(gg)[nn]*
traction[dd];
461 ierr = VecSetValues(getFEMethod()->snes_f,
462 data.getIndices().size(),&data.getIndices()[0],&
Nf[0],ADD_VALUES);
CHKERRG(
ierr);
463 }
catch (
const std::exception& ex) {
464 std::ostringstream ss;
465 ss <<
"throw in method: " << ex.what() << std::endl;
466 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
475 struct OpLhs:
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
485 int row_side,
int col_side,
487 EntitiesFieldData::EntData &row_data,
488 EntitiesFieldData::EntData &col_data
493 int nb_row = row_data.getIndices().size();
495 int nb_col = col_data.getIndices().size();
504 K.resize(nb_row,nb_col);
506 int nb_gauss_pts = row_data.getN().size1();
507 for(
int gg = 0;gg<nb_gauss_pts;gg++) {
509 double w = getGaussPts()(2,gg)*cblas_dnrm2(3,&getNormalsAtGaussPtsF3()(gg,0),1)*0.5;
511 for(
int nn = 0; nn<nb_row/3;nn++) {
512 for(
int dd = 0;dd<3;dd++) {
513 for(
int DD = 0;DD<3;DD++) {
514 ND(3*nn+dd,DD) += row_data.getN(gg)[nn]*
D(dd,DD);
518 for(
int nn = 0; nn<nb_row/3; nn++) {
519 for(
int dd = 0;dd<3;dd++) {
520 for(
int NN = 0; NN<nb_col/3; NN++) {
521 for(
int DD = 0; DD<3;DD++) {
522 K(3*nn+dd,3*NN+DD) += w*
ND(3*nn+dd,DD)*col_data.getN(gg)[NN];
528 ierr = MatSetValues(getFEMethod()->snes_B,
529 nb_row,&row_data.getIndices()[0],
530 nb_col,&col_data.getIndices()[0],
533 }
catch (
const std::exception& ex) {
534 std::ostringstream ss;
535 ss <<
"throw in method: " << ex.what() << std::endl;
536 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
545 struct OpHistory:
public FlatPrismElementForcesAndSourcesCore::UserDataOperator {
568 MoFEMErrorCode
addOps(
const std::string
field_name,boost::ptr_vector<CohesiveInterfaceElement::PhysicalEquation> &interfaces) {
585 boost::ptr_vector<CohesiveInterfaceElement::PhysicalEquation>::iterator pit;
586 for(pit = interfaces.begin();pit!=interfaces.end();pit++) {
ForcesAndSourcesCore::UserDataOperator UserDataOperator
static PetscErrorCode ierr
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
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)
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.