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

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

Inheritance diagram for FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx:
[legend]
Collaboration diagram for FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx:
[legend]

Public Member Functions

 OpMWLSMaterialStressLhs_Dx (boost::shared_ptr< MatrixDouble > space_grad_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, Range *forces_only_on_entities_row=nullptr)
 
MoFEMErrorCode 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 MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
double getVolume () const
 element volume (linear geometry) More...
 
doublegetVolume ()
 element volume (linear geometry) More...
 
FTensor::Tensor2< double *, 3, 3 > & getJac ()
 get element Jacobian More...
 
FTensor::Tensor2< double *, 3, 3 > & getInvJac ()
 get element inverse Jacobian More...
 
VectorDoublegetCoords ()
 nodal coordinates More...
 
VolumeElementForcesAndSourcesCoregetVolumeFE () const
 return pointer to Generic Volume Finite Element object More...
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, const bool symm=true)
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
int getFEDim () const
 Get dimension of finite element. More...
 
EntityType getFEType () const
 Get dimension of finite element. More...
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
std::string getFEName () const
 Get name of the element. More...
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
 User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. More...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Public Attributes

boost::shared_ptr< MatrixDouble > spaceGradPosAtPtsPtr
 
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
 
boost::shared_ptr< MWLSApproxmwlsApprox
 
Range forcesOnlyOnEntitiesRow
 
VectorInt iNdices
 
MatrixDouble nA
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity. More...
 
booldoVertices
 \deprectaed If false skip vertices More...
 
booldoEdges
 \deprectaed If false skip edges More...
 
booldoQuads
 \deprectaed More...
 
booldoTris
 \deprectaed More...
 
booldoTets
 \deprectaed More...
 
booldoPrisms
 \deprectaed More...
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType {
  OPROW = 1 << 0, OPCOL = 1 << 1, OPROWCOL = 1 << 2, OPSPACE = 1 << 3,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
using AdjCache = std::map< EntityHandle, std::vector< boost::weak_ptr< NumeredEntFiniteElement > >>
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
- Protected Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Definition at line 543 of file MWLS.hpp.

Constructor & Destructor Documentation

◆ OpMWLSMaterialStressLhs_Dx()

FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::OpMWLSMaterialStressLhs_Dx ( boost::shared_ptr< MatrixDouble >  space_grad_pos_at_pts_ptr,
boost::shared_ptr< MatrixDouble >  mat_grad_pos_at_pts_ptr,
boost::shared_ptr< MWLSApprox mwls_approx,
Range forces_only_on_entities_row = nullptr 
)
inline

Definition at line 550 of file MWLS.hpp.

556  "MESH_NODE_POSITIONS", "SPATIAL_POSITION",
558  spaceGradPosAtPtsPtr(space_grad_pos_at_pts_ptr),
559  matGradPosAtPtsPtr(mat_grad_pos_at_pts_ptr), mwlsApprox(mwls_approx) {
560  sYmm = false;
561  if (forces_only_on_entities_row)
562  forcesOnlyOnEntitiesRow = *forces_only_on_entities_row;
563  }

Member Function Documentation

◆ doWork()

MoFEMErrorCode FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)

Definition at line 2065 of file MWLS.cpp.

2068  {
2070  if (mwlsApprox->tetsInBlock.find(getFEEntityHandle()) ==
2071  mwlsApprox->tetsInBlock.end()) {
2073  }
2074  const int row_nb_dofs = row_data.getIndices().size();
2075  if (!row_nb_dofs) {
2077  }
2078  const int col_nb_dofs = col_data.getIndices().size();
2079  if (!col_nb_dofs) {
2081  }
2082  nA.resize(row_nb_dofs, col_nb_dofs, false);
2083  nA.clear();
2084  MatrixDouble &stress = mwlsApprox->stressAtGaussPts;
2086  &stress(0, 0), &stress(3, 0), &stress(4, 0), &stress(1, 0), &stress(5, 0),
2087  &stress(2, 0));
2088 
2089  auto t_row_diff_n = row_data.getFTensor1DiffN<3>();
2090  const int nb_row_base = row_data.getN().size2();
2091  const int nb_gauss_pts = row_data.getN().size1();
2092  auto t_H = getFTensor2FromMat<3, 3>(*matGradPosAtPtsPtr);
2093  auto t_h = getFTensor2FromMat<3, 3>(*spaceGradPosAtPtsPtr);
2094 
2101 
2102  double lambda = 1;
2103  if (auto arc_dof = mwlsApprox->arcLengthDof.lock()) {
2104  lambda = arc_dof->getFieldData();
2105  }
2106 
2107  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
2108 
2109  double det;
2110  CHKERR determinantTensor3by3(t_H, det);
2112  CHKERR invertTensor3by3(t_H, det, t_inv_H);
2113  double val = getVolume() * getGaussPts()(3, gg) * det;
2114 
2115  int rr = 0;
2116  for (; rr != row_nb_dofs / 3; ++rr) {
2117  auto t_col_diff_n = col_data.getFTensor1DiffN<3>(gg, 0);
2118  FTensor::Tensor1<double, 3> t_current_row_diff_n;
2119  t_current_row_diff_n(j) = t_inv_H(i, j) * t_row_diff_n(i);
2121  &nA(3 * rr + 0, 0), &nA(3 * rr + 0, 1), &nA(3 * rr + 0, 2),
2122  &nA(3 * rr + 1, 0), &nA(3 * rr + 1, 1), &nA(3 * rr + 1, 2),
2123  &nA(3 * rr + 2, 0), &nA(3 * rr + 2, 1), &nA(3 * rr + 2, 2), 3);
2125  t_a(j) = -val * lambda * t_stress(j, k) * t_current_row_diff_n(k);
2126  int cc = 0;
2127  for (; cc != col_nb_dofs / 3; cc++) {
2128  t_mat(i, j) += t_inv_H(l, i) * t_a(j) * t_col_diff_n(l);
2129  ++t_col_diff_n;
2130  ++t_mat;
2131  }
2132  ++t_row_diff_n;
2133  }
2134  for (; rr != nb_row_base; ++rr) {
2135  ++t_row_diff_n;
2136  }
2137  ++t_stress;
2138  ++t_H;
2139  // ++t_h;
2140  }
2141  int *indices_ptr = &row_data.getIndices()[0];
2142  if (!forcesOnlyOnEntitiesRow.empty()) {
2143  iNdices.resize(row_nb_dofs);
2144  noalias(iNdices) = row_data.getIndices();
2145  indices_ptr = &iNdices[0];
2146  auto &dofs = row_data.getFieldDofs();
2147  auto dit = dofs.begin();
2148  for (int ii = 0; dit != dofs.end(); dit++, ii++) {
2149  if (auto dof = (*dit)) {
2150  if (forcesOnlyOnEntitiesRow.find(dof->getEnt()) ==
2151  forcesOnlyOnEntitiesRow.end()) {
2152  iNdices[ii] = -1;
2153  }
2154  }
2155  }
2156  }
2157  CHKERR MatSetValues(getFEMethod()->snes_B, row_nb_dofs, indices_ptr,
2158  col_nb_dofs, &*col_data.getIndices().begin(),
2159  &*nA.data().begin(), ADD_VALUES);
2161 }

Member Data Documentation

◆ forcesOnlyOnEntitiesRow

Range FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::forcesOnlyOnEntitiesRow

Definition at line 548 of file MWLS.hpp.

◆ iNdices

VectorInt FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::iNdices

Definition at line 549 of file MWLS.hpp.

◆ matGradPosAtPtsPtr

boost::shared_ptr<MatrixDouble> FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::matGradPosAtPtsPtr

Definition at line 546 of file MWLS.hpp.

◆ mwlsApprox

boost::shared_ptr<MWLSApprox> FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::mwlsApprox

Definition at line 547 of file MWLS.hpp.

◆ nA

MatrixDouble FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::nA

Definition at line 564 of file MWLS.hpp.

◆ spaceGradPosAtPtsPtr

boost::shared_ptr<MatrixDouble> FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::spaceGradPosAtPtsPtr

Definition at line 545 of file MWLS.hpp.


The documentation for this struct was generated from the following files:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
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
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::spaceGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > spaceGradPosAtPtsPtr
Definition: MWLS.hpp:545
FTensor::Tensor1< double, 3 >
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: MWLS.hpp:547
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator::getVolume
double getVolume() const
element volume (linear geometry)
Definition: VolumeElementForcesAndSourcesCore.hpp:161
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROWCOL
@ OPROWCOL
operator doWork is executed on FE rows &columns
Definition: ForcesAndSourcesCore.hpp:569
FTensor::Tensor2< double, 3, 3 >
MoFEM::invertTensor3by3
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
Definition: Templates.hpp:1559
MoFEM::ForcesAndSourcesCore::UserDataOperator::getGaussPts
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
Definition: ForcesAndSourcesCore.hpp:1235
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:546
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
friend class UserDataOperator
Definition: VolumeElementForcesAndSourcesCore.hpp:105
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 3 >
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEMethod
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
Definition: ForcesAndSourcesCore.hpp:1041
convert.n
n
Definition: convert.py:82
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::iNdices
VectorInt iNdices
Definition: MWLS.hpp:549
MoFEM::determinantTensor3by3
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:1511
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEEntityHandle
EntityHandle getFEEntityHandle() const
Return finite element entity handle.
Definition: ForcesAndSourcesCore.hpp:1003
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
lambda
static double lambda
Definition: incompressible_elasticity.cpp:199
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::forcesOnlyOnEntitiesRow
Range forcesOnlyOnEntitiesRow
Definition: MWLS.hpp:548
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
MoFEM::DataOperator::sYmm
bool sYmm
If true assume that matrix is symmetric structure.
Definition: DataOperators.hpp:82
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
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::nA
MatrixDouble nA
Definition: MWLS.hpp:564