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

Integrate force vector. More...

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

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

Public Member Functions

 OpMWLSMaterialStressRhs (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=NULL)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &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
 
Vec & F_lambda
 
VectorDouble nF
 
- 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

Integrate force vector.

Definition at line 496 of file MWLS.hpp.

Constructor & Destructor Documentation

◆ OpMWLSMaterialStressRhs()

FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::OpMWLSMaterialStressRhs ( 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 = NULL 
)
inline

Definition at line 504 of file MWLS.hpp.

510  "MESH_NODE_POSITIONS", UserDataOperator::OPROW),
511  spaceGradPosAtPtsPtr(space_grad_pos_at_pts_ptr),
512  matGradPosAtPtsPtr(mat_grad_pos_at_pts_ptr), mwlsApprox(mwls_approx),
513  F_lambda(mwls_approx->F_lambda) {
514  if (forces_only_on_entities_row)
515  forcesOnlyOnEntitiesRow = *forces_only_on_entities_row;
516  }

Member Function Documentation

◆ doWork()

MoFEMErrorCode FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)

Definition at line 1864 of file MWLS.cpp.

1865  {
1867  if (mwlsApprox->tetsInBlock.find(getFEEntityHandle()) ==
1868  mwlsApprox->tetsInBlock.end()) {
1870  }
1871  const int nb_dofs = data.getIndices().size();
1872  if (!nb_dofs) {
1874  }
1875  auto t_diff_n = data.getFTensor1DiffN<3>();
1876  // SIXX 0 (00) SIYY 1 (11) SIZZ 2 (22) SIXY 3 (01) SIXZ 4 (02) SIYZ 5 (12)
1877  // T* d00, T* d01, T* d02, T* d11, T* d12, T* d22
1878  MatrixDouble &stress = mwlsApprox->stressAtGaussPts;
1880  &stress(0, 0), &stress(3, 0), &stress(4, 0), &stress(1, 0), &stress(5, 0),
1881  &stress(2, 0));
1885 
1886  nF.resize(nb_dofs, false);
1887  nF.clear();
1888  const int nb_gauss_pts = data.getN().size1();
1889  auto t_h = getFTensor2FromMat<3, 3>(*spaceGradPosAtPtsPtr);
1890  auto t_H = getFTensor2FromMat<3, 3>(*matGradPosAtPtsPtr);
1891  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
1892  double det;
1893  CHKERR determinantTensor3by3(t_H, det);
1895  CHKERR invertTensor3by3(t_H, det, t_inv_H);
1896  double val = getVolume() * getGaussPts()(3, gg) * det;
1897 
1899  // Calculate gradient of deformation
1900  t_F(i, k) = t_h(i, j) * t_inv_H(j, k);
1901 
1902  constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
1903  FTensor::Tensor2<double, 3, 3> t_eshelby_stress;
1904  t_eshelby_stress(i, k) = -t_F(j, i) * t_stress(j, k);
1905  int bb = 0;
1906  FTensor::Tensor1<double *, 3> rhs(&nF[0], &nF[1], &nF[2], 3);
1907  for (; bb != nb_dofs / 3; ++bb) {
1908  FTensor::Tensor1<double, 3> t_current_diff_n;
1909  t_current_diff_n(j) = t_inv_H(i, j) * t_diff_n(i);
1910  rhs(i) += val * t_eshelby_stress(i, j) * t_current_diff_n(j);
1911  ++t_diff_n;
1912  ++rhs;
1913  }
1914  for (; bb != data.getN().size2(); ++bb) {
1915  ++t_diff_n;
1916  }
1917  ++t_stress;
1918  ++t_H;
1919  ++t_h;
1920  }
1921  int *indices_ptr = &data.getIndices()[0];
1922  if (!forcesOnlyOnEntitiesRow.empty()) {
1923  iNdices.resize(nb_dofs);
1924  noalias(iNdices) = data.getIndices();
1925  indices_ptr = &iNdices[0];
1926  auto &dofs = data.getFieldDofs();
1927  auto dit = dofs.begin();
1928  for (int ii = 0; dit != dofs.end(); dit++, ii++) {
1929  if (auto dof = (*dit)) {
1930  if (forcesOnlyOnEntitiesRow.find(dof->getEnt()) ==
1931  forcesOnlyOnEntitiesRow.end()) {
1932  iNdices[ii] = -1;
1933  }
1934  }
1935  }
1936  }
1937  Vec f = F_lambda != PETSC_NULL ? F_lambda : getFEMethod()->snes_f;
1938  if (mwlsApprox->F_lambda == PETSC_NULL) {
1939  if (auto arc_dof = mwlsApprox->arcLengthDof.lock()) {
1940  nF *= arc_dof->getFieldData();
1941  }
1942  }
1943  CHKERR VecSetOption(f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
1944  CHKERR VecSetValues(f, nb_dofs, indices_ptr, &nF[0], ADD_VALUES);
1946 }

Member Data Documentation

◆ F_lambda

Vec& FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::F_lambda

Definition at line 503 of file MWLS.hpp.

◆ forcesOnlyOnEntitiesRow

Range FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::forcesOnlyOnEntitiesRow

Definition at line 501 of file MWLS.hpp.

◆ iNdices

VectorInt FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::iNdices

Definition at line 502 of file MWLS.hpp.

◆ matGradPosAtPtsPtr

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

Definition at line 499 of file MWLS.hpp.

◆ mwlsApprox

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

Definition at line 500 of file MWLS.hpp.

◆ nF

VectorDouble FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::nF

Definition at line 517 of file MWLS.hpp.

◆ spaceGradPosAtPtsPtr

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

Definition at line 498 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
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: MWLS.hpp:500
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::iNdices
VectorInt iNdices
Definition: MWLS.hpp:502
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::nF
VectorDouble nF
Definition: MWLS.hpp:517
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
FTensor::Kronecker_Delta
Kronecker Delta class.
Definition: Kronecker_Delta.hpp:15
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::VecSetValues
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
Definition: EntitiesFieldData.hpp:1576
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
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
friend class UserDataOperator
Definition: VolumeElementForcesAndSourcesCore.hpp:105
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::F_lambda
Vec & F_lambda
Definition: MWLS.hpp:503
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::spaceGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > spaceGradPosAtPtsPtr
Definition: MWLS.hpp:498
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::forcesOnlyOnEntitiesRow
Range forcesOnlyOnEntitiesRow
Definition: MWLS.hpp:501
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
t_kd
constexpr auto t_kd
Definition: free_surface.cpp:137
FTensor::Index< 'i', 3 >
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEMethod
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
Definition: ForcesAndSourcesCore.hpp:1041
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::SnesMethod::snes_f
Vec & snes_f
residual
Definition: LoopMethods.hpp:122
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEEntityHandle
EntityHandle getFEEntityHandle() const
Return finite element entity handle.
Definition: ForcesAndSourcesCore.hpp:1003
HenckyOps::f
auto f
Definition: HenckyOps.hpp:15
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:499
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
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
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROW
@ OPROW
operator doWork function is executed on FE rows
Definition: ForcesAndSourcesCore.hpp:567