v0.14.0
Public Member Functions | Public Attributes | List of all members
EdgeSlidingConstrains::OpJacobian Struct Reference

#include <users_modules/basic_finite_elements/src/SurfaceSlidingConstrains.hpp>

Inheritance diagram for EdgeSlidingConstrains::OpJacobian:
[legend]
Collaboration diagram for EdgeSlidingConstrains::OpJacobian:
[legend]

Public Member Functions

 OpJacobian (int tag, const std::string field_name, boost::shared_ptr< VectorDouble > &active_variables_ptr, boost::shared_ptr< VectorDouble > &results_ptr, boost::shared_ptr< MatrixDouble > &jacobian_ptr, bool evaluate_jacobian, const double &alpha)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 
- Public Member Functions inherited from MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator
const EntityHandlegetConn ()
 get element connectivity More...
 
double getLength ()
 get edge length More...
 
VectorDoublegetDirection ()
 get edge direction More...
 
auto getFTensor1Normal ()
 get edge normal NOTE: it should be used only in 2D analysis More...
 
auto getFTensor1Normal (const FTensor::Tensor1< double, 3 > &vec)
 get ftensor1 edge normal More...
 
auto getFTensor1NormalsAtGaussPts (const FTensor::Tensor1< double, 3 > &vec)
 
auto getFTensor1NormalsAtGaussPts ()
 get normal at integration points More...
 
VectorDoublegetCoords ()
 get edge node coordinates More...
 
MatrixDoublegetTangentAtGaussPts ()
 get tangent vector to edge curve at integration points More...
 
DEPRECATED MatrixDoublegetTangetAtGaussPts ()
 
const EdgeElementForcesAndSourcesCoregetEdgeFE ()
 get pointer to this finite element More...
 
FTensor::Tensor1< double, 3 > getFTensor1Direction ()
 
FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, 3 > getFTensor1Coords ()
 get get coords at gauss points More...
 
DEPRECATED FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, 3 > getTensor1Coords ()
 
template<int DIM = 3>
FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, DIM > getFTensor1TangentAtGaussPts ()
 Get tangent vector at integration points. More...
 
MoFEMErrorCode loopSideFaces (const string fe_name, FaceElementForcesAndSourcesCoreOnSide &fe_side)
 
template<>
FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, 3 > getFTensor1TangentAtGaussPts ()
 
- 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

const int tAg
 
boost::shared_ptr< VectorDouble > activeVariablesPtr
 
boost::shared_ptr< VectorDouble > resultsPtr
 
boost::shared_ptr< MatrixDouble > jacobianPtr
 
bool evaluateJacobian
 
const doubleaLpha
 
- 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::EdgeElementForcesAndSourcesCore::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Definition at line 933 of file SurfaceSlidingConstrains.hpp.

Constructor & Destructor Documentation

◆ OpJacobian()

EdgeSlidingConstrains::OpJacobian::OpJacobian ( int  tag,
const std::string  field_name,
boost::shared_ptr< VectorDouble > &  active_variables_ptr,
boost::shared_ptr< VectorDouble > &  results_ptr,
boost::shared_ptr< MatrixDouble > &  jacobian_ptr,
bool  evaluate_jacobian,
const double alpha 
)
inline

Definition at line 944 of file SurfaceSlidingConstrains.hpp.

951  tAg(tag), activeVariablesPtr(active_variables_ptr),
952  resultsPtr(results_ptr), jacobianPtr(jacobian_ptr),
953  evaluateJacobian(evaluate_jacobian), aLpha(alpha) {}

Member Function Documentation

◆ doWork()

MoFEMErrorCode EdgeSlidingConstrains::OpJacobian::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
inline

Definition at line 955 of file SurfaceSlidingConstrains.hpp.

956  {
958  if (type != MBVERTEX)
960 
965 
966  Tag th0, th1, th2, th3;
968  th1, th2, th3);
969  FTensor::Tensor1<double, 3> t_edge_base0, t_edge_base1;
970  EntityHandle fe_ent = getFEEntityHandle();
971  CHKERR getEdgeFE()->mField.get_moab().tag_get_data(th0, &fe_ent, 1,
972  &t_edge_base0(0));
973  CHKERR getEdgeFE()->mField.get_moab().tag_get_data(th1, &fe_ent, 1,
974  &t_edge_base1(0));
975 
976  VectorInt &indices = data.getIndices();
977 
978  trace_on(tAg);
979 
980  ublas::vector<adouble> lambda_dofs(4);
981  for (int dd = 0; dd != 4; ++dd) {
982  lambda_dofs[dd] <<= (*activeVariablesPtr)[dd];
983  }
984  ublas::vector<adouble> position_dofs(6);
985  for (int dd = 0; dd != 6; ++dd) {
986  position_dofs[dd] <<= (*activeVariablesPtr)[4 + dd];
987  }
988 
990  &position_dofs[0], &position_dofs[1], &position_dofs[2]);
992  &position_dofs[3], &position_dofs[4], &position_dofs[5]);
993 
995  t_tangent(i) = t_node1(i) - t_node0(i);
996  adouble l = sqrt(t_tangent(i) * t_tangent(i));
997  t_tangent(i) /= l;
998 
999  adouble t_dot0, t_dot1;
1000  t_dot0 = t_edge_base0(i) * t_tangent(i);
1001  t_dot1 = t_edge_base1(i) * t_tangent(i);
1002 
1003  FTensor::Tensor1<adouble, 3> t_base0, t_base1;
1004  t_base0(i) = t_edge_base0(i) - t_dot0 * t_tangent(i);
1005  t_base1(i) = t_edge_base1(i) - t_dot1 * t_tangent(i);
1006  t_base0(i) /= sqrt(t_base0(i) * t_base0(i));
1007  t_base1(i) /= sqrt(t_base1(i) * t_base1(i));
1008 
1009  auto t_base_fun1 = data.getFTensor0N();
1010  auto t_base_fun2 = data.getFTensor0N();
1011  FTensor::Tensor1<adouble, 3> t_position;
1014  auto t_coord_ref = getFTensor1CoordsAtGaussPts();
1015 
1016  ublas::vector<adouble> c_vec(4);
1017  ublas::vector<adouble> f_vec(6);
1018  c_vec.clear();
1019  f_vec.clear();
1020 
1021  int nb_gauss_pts = data.getN().size1();
1022  int nb_base_functions = data.getN().size2();
1023  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
1024 
1025  FTensor::Tensor1<adouble *, 3> t_position_dofs(
1026  &position_dofs[0], &position_dofs[1], &position_dofs[2], 3);
1027  FTensor::Tensor1<adouble *, 2> t_lambda_dof(&lambda_dofs[0],
1028  &lambda_dofs[1], 2);
1029 
1030  t_position(i) = 0;
1031  t_lambda(j) = 0;
1032  for (int bb = 0; bb != nb_base_functions; ++bb) {
1033  t_position(i) += t_base_fun1 * t_position_dofs(i);
1034  t_lambda(j) += t_base_fun1 * t_lambda_dof(j);
1035  ++t_base_fun1;
1036  ++t_position_dofs;
1037  ++t_lambda_dof;
1038  }
1039 
1040  t_delta(i) = t_position(i) - t_coord_ref(i);
1041  adouble dot0 = t_base0(i) * t_delta(i);
1042  adouble dot1 = t_base1(i) * t_delta(i);
1043 
1044  adouble w = getGaussPts()(1, gg) * l * aLpha;
1045  adouble val, val1, val2;
1046  FTensor::Tensor1<adouble *, 2> t_c(&c_vec[0], &c_vec[1], 2);
1047  FTensor::Tensor1<adouble *, 3> t_f(&f_vec[0], &f_vec[1], &f_vec[2], 3);
1048  for (int bb = 0; bb != nb_base_functions; ++bb) {
1049  if (indices[2 * bb] != -1) {
1050  val = w * t_base_fun2;
1051  t_c(N0) += val * dot0;
1052  t_c(N1) += val * dot1;
1053  val1 = val * t_lambda(N0);
1054  val2 = val * t_lambda(N1);
1055  t_f(i) += val1 * t_base0(i) + val2 * t_base1(i);
1056  }
1057  ++t_c;
1058  ++t_f;
1059  ++t_base_fun2;
1060  }
1061 
1062  ++t_coord_ref;
1063  }
1064 
1065  for (int rr = 0; rr != 4; ++rr) {
1066  c_vec[rr] >>= (*resultsPtr)[rr];
1067  }
1068  for (int rr = 0; rr != 6; ++rr) {
1069  f_vec(rr) >>= (*resultsPtr)[4 + rr];
1070  }
1071 
1072  trace_off();
1073 
1074  if (evaluateJacobian) {
1075  double *jac_ptr[4 + 6];
1076  for (int rr = 0; rr != 4 + 6; ++rr) {
1077  jac_ptr[rr] = &(*jacobianPtr)(rr, 0);
1078  }
1079  // play recorder for jacobians
1080  int r =
1081  ::jacobian(tAg, 4 + 6, 4 + 6, &(*activeVariablesPtr)[0], jac_ptr);
1082  if (r < 0) {
1083  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1084  "ADOL-C function evaluation with error");
1085  }
1086  }
1087 
1089  }

Member Data Documentation

◆ activeVariablesPtr

boost::shared_ptr<VectorDouble> EdgeSlidingConstrains::OpJacobian::activeVariablesPtr

Definition at line 937 of file SurfaceSlidingConstrains.hpp.

◆ aLpha

const double& EdgeSlidingConstrains::OpJacobian::aLpha

Definition at line 942 of file SurfaceSlidingConstrains.hpp.

◆ evaluateJacobian

bool EdgeSlidingConstrains::OpJacobian::evaluateJacobian

Definition at line 940 of file SurfaceSlidingConstrains.hpp.

◆ jacobianPtr

boost::shared_ptr<MatrixDouble> EdgeSlidingConstrains::OpJacobian::jacobianPtr

Definition at line 939 of file SurfaceSlidingConstrains.hpp.

◆ resultsPtr

boost::shared_ptr<VectorDouble> EdgeSlidingConstrains::OpJacobian::resultsPtr

Definition at line 938 of file SurfaceSlidingConstrains.hpp.

◆ tAg

const int EdgeSlidingConstrains::OpJacobian::tAg

Definition at line 936 of file SurfaceSlidingConstrains.hpp.


The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
PlasticOps::w
double w(double eqiv, double dot_tau, double f, double sigma_y, double sigma_Y)
Definition: PlasticOpsGeneric.hpp:276
FTensor::Tensor1< double, 3 >
EntityHandle
EdgeSlidingConstrains::OpJacobian::jacobianPtr
boost::shared_ptr< MatrixDouble > jacobianPtr
Definition: SurfaceSlidingConstrains.hpp:939
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getEdgeFE
const EdgeElementForcesAndSourcesCore * getEdgeFE()
get pointer to this finite element
Definition: EdgeElementForcesAndSourcesCore.hpp:210
EdgeSlidingConstrains::mField
MoFEM::Interface & mField
Definition: SurfaceSlidingConstrains.hpp:874
sdf.r
int r
Definition: sdf.py:8
MoFEM::ForcesAndSourcesCore::UserDataOperator::getGaussPts
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
Definition: ForcesAndSourcesCore.hpp:1235
EdgeSlidingConstrains::OpJacobian::aLpha
const double & aLpha
Definition: SurfaceSlidingConstrains.hpp:942
FTensor::Number< 0 >
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
convert.type
type
Definition: convert.py:64
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPCOL
@ OPCOL
operator doWork function is executed on FE columns
Definition: ForcesAndSourcesCore.hpp:568
MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34
EdgeSlidingConstrains::OpJacobian::tAg
const int tAg
Definition: SurfaceSlidingConstrains.hpp:936
MoFEM::ForcesAndSourcesCore::UserDataOperator
friend class UserDataOperator
Definition: ForcesAndSourcesCore.hpp:482
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
EdgeSlidingConstrains::CalculateEdgeBase::createTag
static MoFEMErrorCode createTag(moab::Interface &moab, Tag &th0, Tag &th1, Tag &th2, Tag &th3)
Definition: SurfaceSlidingConstrains.hpp:643
EdgeSlidingConstrains::OpJacobian::evaluateJacobian
bool evaluateJacobian
Definition: SurfaceSlidingConstrains.hpp:940
EdgeSlidingConstrains::OpJacobian::resultsPtr
boost::shared_ptr< VectorDouble > resultsPtr
Definition: SurfaceSlidingConstrains.hpp:938
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
FTensor::Index< 'i', 3 >
adouble
FTensor::dd
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEEntityHandle
EntityHandle getFEEntityHandle() const
Return finite element entity handle.
Definition: ForcesAndSourcesCore.hpp:1003
MoFEM::Types::VectorInt
UBlasVector< int > VectorInt
Definition: Types.hpp:67
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
EdgeSlidingConstrains::OpJacobian::activeVariablesPtr
boost::shared_ptr< VectorDouble > activeVariablesPtr
Definition: SurfaceSlidingConstrains.hpp:937
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
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFTensor1CoordsAtGaussPts
auto getFTensor1CoordsAtGaussPts()
Get coordinates at integration points assuming linear geometry.
Definition: ForcesAndSourcesCore.hpp:1268
MoFEM::ForcesAndSourcesCore::mField
Interface & mField
Definition: ForcesAndSourcesCore.hpp:24