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

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

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

Public Member Functions

 OpMWLSSpatialStressLhs_DX (boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< MWLSApprox > mwls_approx)
 
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 > matGradPosAtPtsPtr
 
boost::shared_ptr< MWLSApproxmwlsApprox
 
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 522 of file MWLS.hpp.

Constructor & Destructor Documentation

◆ OpMWLSSpatialStressLhs_DX()

FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::OpMWLSSpatialStressLhs_DX ( boost::shared_ptr< MatrixDouble >  mat_grad_pos_at_pts_ptr,
boost::shared_ptr< MWLSApprox mwls_approx 
)
inline

Definition at line 527 of file MWLS.hpp.

531  "SPATIAL_POSITION", "MESH_NODE_POSITIONS",
533  matGradPosAtPtsPtr(mat_grad_pos_at_pts_ptr), mwlsApprox(mwls_approx) {
534  sYmm = false;
535  }

Member Function Documentation

◆ doWork()

MoFEMErrorCode FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_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 1948 of file MWLS.cpp.

1951  {
1953  if (mwlsApprox->tetsInBlock.find(getFEEntityHandle()) ==
1954  mwlsApprox->tetsInBlock.end()) {
1956  }
1957  const int row_nb_dofs = row_data.getIndices().size();
1958  if (!row_nb_dofs) {
1960  }
1961  const int col_nb_dofs = col_data.getIndices().size();
1962  if (!col_nb_dofs) {
1964  }
1965  nA.resize(row_nb_dofs, col_nb_dofs, false);
1966  nA.clear();
1967 
1968  // SIXX 0 (00) SIYY 1 (11) SIZZ 2 (22) SIXY 3 (01) SIXZ 4 (02) SIYZ 5 (12)
1969  MatrixDouble &stress = mwlsApprox->stressAtGaussPts;
1971  &stress(0, 0), &stress(3, 0), &stress(4, 0), &stress(1, 0), &stress(5, 0),
1972  &stress(2, 0));
1973  MatrixDouble &d_stress = mwlsApprox->diffStressAtGaussPts;
1974  // Note Christod is symmetric on first two indices
1976  &d_stress(0 * 6 + 0, 0), &d_stress(0 * 6 + 3, 0), &d_stress(0 * 6 + 4, 0),
1977  &d_stress(0 * 6 + 1, 0), &d_stress(0 * 6 + 5, 0), &d_stress(0 * 6 + 2, 0),
1978 
1979  &d_stress(1 * 6 + 0, 0), &d_stress(1 * 6 + 3, 0), &d_stress(1 * 6 + 4, 0),
1980  &d_stress(1 * 6 + 1, 0), &d_stress(1 * 6 + 5, 0), &d_stress(1 * 6 + 2, 0),
1981 
1982  &d_stress(2 * 6 + 0, 0), &d_stress(2 * 6 + 3, 0), &d_stress(2 * 6 + 4, 0),
1983  &d_stress(2 * 6 + 1, 0), &d_stress(2 * 6 + 5, 0), &d_stress(2 * 6 + 2, 0)
1984 
1985  );
1986 
1987  // scale stress
1988  double lambda = 1;
1989  if (auto arc_dof = mwlsApprox->arcLengthDof.lock()) {
1990  lambda = arc_dof->getFieldData();
1991  }
1992 
1993  auto t_row_diff_n = row_data.getFTensor1DiffN<3>();
1994  const int nb_row_base = row_data.getN().size2();
1995  const int nb_gauss_pts = row_data.getN().size1();
1996  auto t_initial_singular_displacement =
1997  getFTensor1FromMat<3>(mwlsApprox->singularInitialDisplacement);
1998  auto t_H = getFTensor2FromMat<3, 3>(*matGradPosAtPtsPtr);
1999 
2005 
2006  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
2007 
2008  double det;
2009  CHKERR determinantTensor3by3(t_H, det);
2011  CHKERR invertTensor3by3(t_H, det, t_inv_H);
2012 
2013  double val = getVolume() * getGaussPts()(3, gg) * det;
2014  int rr = 0;
2015  for (; rr != row_nb_dofs / 3; ++rr) {
2016  FTensor::Tensor1<double, 3> t_current_row_diff_n;
2017  t_current_row_diff_n(j) = t_inv_H(i, j) * t_row_diff_n(i);
2018  auto t_col_diff_n = col_data.getFTensor1DiffN<3>(gg, 0);
2019  auto t_col_n = col_data.getFTensor0N(gg, 0);
2021  &nA(3 * rr + 0, 0), &nA(3 * rr + 0, 1), &nA(3 * rr + 0, 2),
2022  &nA(3 * rr + 1, 0), &nA(3 * rr + 1, 1), &nA(3 * rr + 1, 2),
2023  &nA(3 * rr + 2, 0), &nA(3 * rr + 2, 1), &nA(3 * rr + 2, 2));
2025  t_a(i) = val * lambda * t_stress(i, j) * t_current_row_diff_n(j);
2027  t_b(i, j) = val * lambda * t_d_stress(i, j, k) * t_current_row_diff_n(k);
2029  t_c(i, m, n) = -val * lambda * (t_stress(i, j) * t_inv_H(n, j)) *
2030  (t_inv_H(k, m) * t_row_diff_n(k));
2031  for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
2032  t_mat(i, j) += t_a(i) * t_inv_H(k, j) * t_col_diff_n(k);
2033  t_mat(i, j) += t_b(j, i) * t_col_n;
2034  t_mat(i, j) +=
2035  t_b(j, i) * t_col_diff_n(k) * t_initial_singular_displacement(k);
2036  t_mat(i, m) += t_c(i, m, n) * t_col_diff_n(n);
2037  ++t_col_n;
2038  ++t_col_diff_n;
2039  ++t_mat;
2040  }
2041  ++t_row_diff_n;
2042  }
2043  for (; rr != nb_row_base; ++rr) {
2044  ++t_row_diff_n;
2045  }
2046 
2047  // for (int ii = 0; ii != 3; ++ii)
2048  // for (int kk = 0; kk != 3; ++kk)
2049  // for (int ll = kk + 1; ll < 3; ++ll)
2050  // if (t_d_stress(ii, kk, ll) != t_d_stress(ii, ll, kk))
2051  // SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "AAA");
2052 
2053  ++t_H;
2054  ++t_stress;
2055  ++t_d_stress;
2056  ++t_initial_singular_displacement;
2057  }
2058  CHKERR MatSetValues(getFEMethod()->snes_B, row_nb_dofs,
2059  &*row_data.getIndices().begin(), col_nb_dofs,
2060  &*col_data.getIndices().begin(), &*nA.data().begin(),
2061  ADD_VALUES);
2063 }

Member Data Documentation

◆ iNdices

VectorInt FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::iNdices

Definition at line 526 of file MWLS.hpp.

◆ matGradPosAtPtsPtr

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

Definition at line 524 of file MWLS.hpp.

◆ mwlsApprox

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

Definition at line 525 of file MWLS.hpp.

◆ nA

MatrixDouble FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::nA

Definition at line 536 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:460
FTensor::Christof
Definition: Christof_value.hpp:9
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:1644
FTensor::Tensor1< double, 3 >
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: MWLS.hpp:525
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
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:1588
MoFEM::ForcesAndSourcesCore::UserDataOperator::getGaussPts
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
Definition: ForcesAndSourcesCore.hpp:1236
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:524
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
FTensor::Tensor3
Definition: Tensor3_value.hpp:12
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:1042
convert.n
n
Definition: convert.py:82
MoFEM::determinantTensor3by3
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:1540
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::nA
MatrixDouble nA
Definition: MWLS.hpp:536
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEEntityHandle
EntityHandle getFEEntityHandle() const
Return finite element entity handle.
Definition: ForcesAndSourcesCore.hpp:1004
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
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:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359