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

Evaluate stress at integration points. More...

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

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

Public Member Functions

 OpMWLSStressAndErrorsAtGaussPts (boost::shared_ptr< MWLSApprox > mwls_approx, const std::string stress_tag_name, MoFEM::Interface &m_field)
 
- 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

std::string stressTagName
 
boost::shared_ptr< MWLSApproxmwlsApproxPtr
 
MoFEM::InterfacemField
 
- 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...
 

Protected Member Functions

MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 
- Protected Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 

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 Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Evaluate stress at integration points.

Definition at line 454 of file MWLS.hpp.

Constructor & Destructor Documentation

◆ OpMWLSStressAndErrorsAtGaussPts()

FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::OpMWLSStressAndErrorsAtGaussPts ( boost::shared_ptr< MWLSApprox mwls_approx,
const std::string  stress_tag_name,
MoFEM::Interface m_field 
)
inline

Definition at line 460 of file MWLS.hpp.

464  "SPATIAL_POSITION", UserDataOperator::OPROW),
465  mwlsApproxPtr(mwls_approx), stressTagName(stress_tag_name),
466  mField(m_field) {}

Member Function Documentation

◆ doWork()

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

Definition at line 1685 of file MWLS.cpp.

1686  {
1688 
1689  if (type != MBVERTEX)
1691 
1694 
1695  auto &mwls_approx = *mwlsApproxPtr;
1696  if (mwls_approx.tetsInBlock.find(getFEEntityHandle()) ==
1697  mwls_approx.tetsInBlock.end()) {
1699  }
1700 
1701  const int nb_gauss_pts = data.getN().size1();
1702  // SIXX 0 (00) SIYY 1 (11) SIZZ 2 (22) SIXY 3 (01) SIXZ 4 (02) SIYZ 5 (12)
1703  // T* d00, T* d01, T* d02, T* d11, T* d12, T* d22
1704  MatrixDouble &stress = mwlsApproxPtr->stressAtGaussPts;
1706  &stress(0, 0), &stress(3, 0), &stress(4, 0), &stress(1, 0), &stress(5, 0),
1707  &stress(2, 0));
1708 
1709  auto get_symm_tensor = [](auto &m) {
1711 
1712  &m[0], &m[3], &m[4],
1713 
1714  &m[1], &m[5],
1715 
1716  &m[2]
1717 
1718  );
1719  return t;
1720  };
1721 
1722  auto get_stress_nrm2 = [i, j](auto &t_s) { return t_s(i, j) * t_s(i, j); };
1723 
1724  VectorDouble val_at_nearest_influence_node;
1725  val_at_nearest_influence_node.resize(9, false);
1726  val_at_nearest_influence_node.clear();
1727 
1728  Tag th;
1729  CHKERR mwls_approx.mwlsMoab.tag_get_handle(stressTagName.c_str(), th);
1730 
1731  // This is nasty pice of code, but good for tests. It test value in the
1732  // nearest mode. We should use base functions to evaluate stress at
1733  // arbitrary point. However this is good enough when projected mesh and
1734  // approximated mesh is the same. That is used for tests.
1735  CHKERR mwls_approx.mwlsMoab.tag_get_data(
1736  th, &mwls_approx.nearestInfluenceNode, 1,
1737  &*val_at_nearest_influence_node.data().begin());
1738  auto t_stress_at_nearset_node =
1739  get_symm_tensor(val_at_nearest_influence_node);
1740 
1741  auto t_w = getFTensor0IntegrationWeight();
1742  auto vol = getVolume();
1743 
1744  double int_stress = vol * get_stress_nrm2(t_stress_at_nearset_node);
1745  double stress_error = 0;
1746  double hydrostatic_error = 0;
1747  double deviatoric_error = 0;
1748 
1749  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
1750  const double a = t_w * vol;
1751 
1753  t_diff_stress(i, j) = t_stress(i, j) - t_stress_at_nearset_node(i, j);
1754  stress_error += a * get_stress_nrm2(t_diff_stress);
1755 
1756  constexpr auto t_kd = FTensor::Kronecker_Delta_symmetric<int>();
1757  // calculate error of the hydro static part of the stress
1758  const double hydrostatic_error_at_gg =
1759  (t_kd(i, j) * t_diff_stress(i, j)) / 3.;
1760  hydrostatic_error += a * hydrostatic_error_at_gg * hydrostatic_error_at_gg;
1761 
1762  // calculate error of the deviator part of the stress
1763  auto t_dev_error = FTensor::Tensor2_symmetric<double, 3>();
1764  t_dev_error(i, j) = t_diff_stress(i, j) - hydrostatic_error * t_kd(i, j);
1765  deviatoric_error += a * get_stress_nrm2(t_dev_error);
1766 
1767  ++t_w;
1768  ++t_stress;
1769  }
1770 
1771  auto create_tag = [&](auto name) {
1772  constexpr double zero = 0;
1773  Tag tag;
1774  CHKERR mField.get_moab().tag_get_handle(
1775  name, 1, MB_TYPE_DOUBLE, tag, MB_TAG_CREAT | MB_TAG_SPARSE, &zero);
1776  return tag;
1777  };
1778 
1779  auto save_val = [&](auto &&tag, auto &val) {
1781  auto const fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1782  CHKERR mField.get_moab().tag_set_data(tag, &fe_ent, 1, &val);
1784  };
1785 
1786  stress_error /= int_stress;
1787  hydrostatic_error /= int_stress;
1788  deviatoric_error /= int_stress;
1789  stress_error = sqrt(stress_error);
1790  hydrostatic_error = sqrt(hydrostatic_error);
1791  deviatoric_error = sqrt(deviatoric_error);
1792 
1793  CHKERR save_val(create_tag("INT_STRESS_ERROR"), stress_error);
1794  CHKERR save_val(create_tag("INT_HYDROSTATIC_ERROR"), hydrostatic_error);
1795  CHKERR save_val(create_tag("INT_DEVIATORIC_ERROR"), deviatoric_error);
1796 
1798 }

Member Data Documentation

◆ mField

MoFEM::Interface& FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::mField

Definition at line 458 of file MWLS.hpp.

◆ mwlsApproxPtr

boost::shared_ptr<MWLSApprox> FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::mwlsApproxPtr

Definition at line 457 of file MWLS.hpp.

◆ stressTagName

std::string FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::stressTagName

Definition at line 456 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
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator::getVolume
double getVolume() const
element volume (linear geometry)
Definition: VolumeElementForcesAndSourcesCore.hpp:161
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::stressTagName
std::string stressTagName
Definition: MWLS.hpp:456
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFTensor0IntegrationWeight
auto getFTensor0IntegrationWeight()
Get integration weights.
Definition: ForcesAndSourcesCore.hpp:1240
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
a
constexpr double a
Definition: approx_sphere.cpp:30
FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::mwlsApproxPtr
boost::shared_ptr< MWLSApprox > mwlsApproxPtr
Definition: MWLS.hpp:457
convert.type
type
Definition: convert.py:64
MoFEM::ForcesAndSourcesCore::UserDataOperator::getNumeredEntFiniteElementPtr
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
Definition: ForcesAndSourcesCore.hpp:1000
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
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::getFEEntityHandle
EntityHandle getFEEntityHandle() const
Return finite element entity handle.
Definition: ForcesAndSourcesCore.hpp:1004
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
FTensor::Kronecker_Delta_symmetric
Kronecker Delta class symmetric.
Definition: Kronecker_Delta.hpp:49
FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::mField
MoFEM::Interface & mField
Definition: MWLS.hpp:458
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
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROW
@ OPROW
operator doWork function is executed on FE rows
Definition: ForcesAndSourcesCore.hpp:567