v0.14.0
CalculateTraction.hpp
Go to the documentation of this file.
1 /**
2  * @file CalculateTraction.hpp
3  * @brief Calculate traction for linear problem
4  * @date 2023-03-29
5  *
6  * @copyright Copyright (c) 2023
7  *
8  */
9 
10 namespace ElasticExample {
11 
13  OpCalculateTraction(boost::shared_ptr<MatrixDouble> stress_ptr,
14  boost::shared_ptr<MatrixDouble> traction_ptr)
15  : BoundaryEleOp(NOSPACE, BoundaryEleOp::OPSPACE), stressPtr(stress_ptr),
16  tractionPtr(traction_ptr) {}
17 
18  MoFEMErrorCode doWork(int side, EntityType type, EntData &data) {
22  auto nb_int_pts = getGaussPts().size2();
23  tractionPtr->resize(SPACE_DIM, nb_int_pts, false);
24  auto t_normal = getFTensor1NormalsAtGaussPts();
25  auto t_stress = getFTensor2SymmetricFromMat<SPACE_DIM>(*stressPtr);
26  auto t_traction = getFTensor1FromMat<SPACE_DIM>(*tractionPtr);
27  for (auto gg = 0; gg != nb_int_pts; ++gg) {
28  const auto l = std::sqrt(t_normal(j) * t_normal(j));
29  t_traction(i) = (t_stress(i, j) * t_normal(j)) / l;
30  ++t_normal;
31  ++t_stress;
32  ++t_traction;
33  }
35  }
36 
37 private:
38  boost::shared_ptr<MatrixDouble> stressPtr;
39  boost::shared_ptr<MatrixDouble> tractionPtr;
40 };
41 
42 } // namespace ElasticExample
NOSPACE
@ NOSPACE
Definition: definitions.h:83
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
ElasticExample::OpCalculateTraction::tractionPtr
boost::shared_ptr< MatrixDouble > tractionPtr
Definition: CalculateTraction.hpp:39
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
SPACE_DIM
constexpr int SPACE_DIM
Definition: child_and_parent.cpp:16
BoundaryEleOp
convert.type
type
Definition: convert.py:64
ElasticExample
Definition: CalculateTraction.hpp:10
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
ElasticExample::OpCalculateTraction::OpCalculateTraction
OpCalculateTraction(boost::shared_ptr< MatrixDouble > stress_ptr, boost::shared_ptr< MatrixDouble > traction_ptr)
Definition: CalculateTraction.hpp:13
FTensor::Index< 'i', SPACE_DIM >
ElasticExample::OpCalculateTraction::stressPtr
boost::shared_ptr< MatrixDouble > stressPtr
Definition: CalculateTraction.hpp:38
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
ElasticExample::OpCalculateTraction::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Definition: CalculateTraction.hpp:18
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
ElasticExample::OpCalculateTraction
Definition: CalculateTraction.hpp:12
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21