v0.14.0
Public Member Functions | Public Attributes | List of all members
FractureMechanics::ConstantArea::OpAreaC Struct Reference

#include <users_modules/fracture_mechanics/src/ConstantArea.hpp>

Inheritance diagram for FractureMechanics::ConstantArea::OpAreaC:
[legend]
Collaboration diagram for FractureMechanics::ConstantArea::OpAreaC:
[legend]

Public Member Functions

 OpAreaC (int tag, CommonData &common_data)
 
PetscErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 
- Public Member Functions inherited from FractureMechanics::ConstantArea::AuxOp
 AuxOp (int tag, CommonData &common_data)
 
PetscErrorCode setVariables (FaceElementForcesAndSourcesCore::UserDataOperator *fe_ptr, int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 

Public Attributes

MatrixDouble cMat
 
- Public Attributes inherited from FractureMechanics::ConstantArea::AuxOp
int tAg
 
CommonDatacommonData
 
ublas::vector< int > rowIndices
 
VectorDouble activeVariables
 

Detailed Description

Definition at line 506 of file ConstantArea.hpp.

Constructor & Destructor Documentation

◆ OpAreaC()

FractureMechanics::ConstantArea::OpAreaC::OpAreaC ( int  tag,
CommonData common_data 
)
inline

Definition at line 509 of file ConstantArea.hpp.

511  "LAMBDA_CRACKFRONT_AREA", "MESH_NODE_POSITIONS",
513  AuxOp(tag, common_data) {
514  sYmm = false;
515  }

Member Function Documentation

◆ doWork()

PetscErrorCode FractureMechanics::ConstantArea::OpAreaC::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)
inline

Definition at line 519 of file ConstantArea.hpp.

522  {
524 
525  if (row_type != MBVERTEX) {
527  }
528  VectorInt &row_indices = row_data.getIndices();
529  const int nb_rows = row_indices.size();
530  if (!nb_rows)
532  VectorInt &col_indices = col_data.getIndices();
533  const int nb_cols = col_indices.size();
534  if (!nb_cols)
536 
537  const EntityHandle *conn = getConn();
538  for (int nn = 0; nn != 3; ++nn) {
539  if (row_indices[nn] != -1) {
540  if (row_data.getFieldDofs()[nn]->getEnt() != conn[nn]) {
541  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
542  "Data inconsistency");
543  }
544  }
545  for (int dd = 0; dd != 3; ++dd) {
546  if (col_indices[3 * nn + dd] != -1) {
547  if (col_data.getFieldDofs()[3 * nn + dd]->getEnt() != conn[nn]) {
548  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
549  "Data inconsistency");
550  }
551  }
552  }
553  }
554 
555  auto row_dofs = getFEMethod()->getRowDofsPtr();
556  for (auto it = row_dofs->begin(); it != row_dofs->end(); ++it) {
557  int side = it->get()->getSideNumber();
558  if (conn[side] != it->get()->getEnt()) {
559  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
560  "Data inconsistency");
561  }
562  }
563 
564  auto col_dofs = getFEMethod()->getColDofsPtr();
565  for (auto it = col_dofs->begin(); it != col_dofs->end(); ++it) {
566  int side = it->get()->getSideNumber();
567  if (conn[side] != it->get()->getEnt()) {
568  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
569  "Data inconsistency");
570  }
571  }
572 
573  cMat.resize(3, 9, false);
574  cMat.clear();
575 
576  CHKERR setVariables(this, col_side, col_type, col_data);
577 
578  int nb_dofs = col_data.getFieldData().size();
579  commonData.crackAreaIncrement.resize(nb_dofs, false);
580  int r;
581  // play recorder for values
582  r = ::function(tAg, nb_dofs, 18, &activeVariables[0],
584  if (r < 3) {
585  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
586  "ADOL-C function evaluation with error r = %d", r);
587  }
588 
589  auto check_isnormal = [](double v) {
591  if (v != 0 && !std::isnormal(v)) {
592  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
593  "Not a number %3.4e", v);
594  }
596  };
597 
598  for (int rr = 0; rr != nb_rows; rr++) {
599  if (row_indices[rr] != -1) {
600  CHKERR check_isnormal(commonData.crackAreaIncrement[3 * rr + 0]);
601  CHKERR check_isnormal(commonData.crackAreaIncrement[3 * rr + 1]);
602  CHKERR check_isnormal(commonData.crackAreaIncrement[3 * rr + 2]);
603  cMat(rr, 3 * rr + 0) = commonData.crackAreaIncrement[3 * rr + 0];
604  cMat(rr, 3 * rr + 1) = commonData.crackAreaIncrement[3 * rr + 1];
605  cMat(rr, 3 * rr + 2) = commonData.crackAreaIncrement[3 * rr + 2];
606  }
607  }
608 
609  if (!commonData.setMapV) {
610  CHKERR MatSetValues(getFEMethod()->snes_B, nb_rows, &row_indices[0],
611  nb_cols, &col_indices[0], &cMat(0, 0), ADD_VALUES);
612  } else {
613  for (int rr = 0; rr != nb_rows; ++rr) {
614  if (row_indices[rr] != -1) {
615  if (commonData.mapV.find(row_indices[rr]) ==
616  commonData.mapV.end()) {
617  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
618  "Vector for given DOF in map not found");
619  }
620  for (int cc = 0; cc != nb_cols; ++cc) {
621  if (col_indices[cc] != -1) {
622  CHKERR check_isnormal(cMat(rr, cc));
623  }
624  }
625  CHKERR VecSetValues(commonData.mapV[row_indices[rr]], nb_cols,
626  &col_indices[0], &cMat(rr, 0), ADD_VALUES);
627  }
628  }
629  }
630 
632  }

Member Data Documentation

◆ cMat

MatrixDouble FractureMechanics::ConstantArea::OpAreaC::cMat

Definition at line 517 of file ConstantArea.hpp.


The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
FractureMechanics::ConstantArea::CommonData::setMapV
bool setMapV
Definition: ConstantArea.hpp:46
FractureMechanics::ConstantArea::CommonData::crackAreaIncrement
VectorDouble crackAreaIncrement
Definition: ConstantArea.hpp:37
MoFEM::MatSetValues
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
Definition: EntitiesFieldData.hpp:1631
EntityHandle
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROWCOL
@ OPROWCOL
operator doWork is executed on FE rows &columns
Definition: ForcesAndSourcesCore.hpp:569
MoFEM::VecSetValues
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
Definition: EntitiesFieldData.hpp:1576
sdf.r
int r
Definition: sdf.py:8
FractureMechanics::ConstantArea::CommonData::mapV
map< int, Vec > mapV
Definition: ConstantArea.hpp:45
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
FractureMechanics::ConstantArea::AuxOp::tAg
int tAg
Definition: ConstantArea.hpp:481
FractureMechanics::ConstantArea::AuxOp::AuxOp
AuxOp(int tag, CommonData &common_data)
Definition: ConstantArea.hpp:483
MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34
FractureMechanics::ConstantArea::AuxOp::activeVariables
VectorDouble activeVariables
Definition: ConstantArea.hpp:487
FractureMechanics::ConstantArea::AuxOp::commonData
CommonData & commonData
Definition: ConstantArea.hpp:482
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
FTensor::dd
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
FractureMechanics::ConstantArea::AuxOp::setVariables
PetscErrorCode setVariables(FaceElementForcesAndSourcesCore::UserDataOperator *fe_ptr, int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: ConstantArea.hpp:490
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
MoFEM::Types::VectorInt
UBlasVector< int > VectorInt
Definition: Types.hpp:67
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
FractureMechanics::ConstantArea::OpAreaC::cMat
MatrixDouble cMat
Definition: ConstantArea.hpp:517
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346