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

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

Inheritance diagram for SurfaceSlidingConstrains::OpJacobian:
[legend]
Collaboration diagram for SurfaceSlidingConstrains::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, DriverElementOrientation &orientation, bool evaluate_jacobian, const double &alpha)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 
- Public Member Functions inherited from MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
double getArea ()
 get area of face More...
 
VectorDoublegetNormal ()
 get triangle normal More...
 
VectorDoublegetTangent1 ()
 get triangle tangent 1 More...
 
VectorDoublegetTangent2 ()
 get triangle tangent 2 More...
 
auto getFTensor1Normal ()
 get normal as tensor More...
 
auto getFTensor1Tangent1 ()
 get tangentOne as tensor More...
 
auto getFTensor1Tangent2 ()
 get tangentTwo as tensor More...
 
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
VectorDoublegetCoords ()
 get triangle coordinates More...
 
auto getFTensor1Coords ()
 get get coords at gauss points More...
 
MatrixDoublegetNormalsAtGaussPts ()
 if higher order geometry return normals at Gauss pts. More...
 
ublas::matrix_row< MatrixDoublegetNormalsAtGaussPts (const int gg)
 if higher order geometry return normals at Gauss pts. More...
 
MatrixDoublegetTangent1AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
MatrixDoublegetTangent2AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
auto getFTensor1NormalsAtGaussPts ()
 get normal at integration points More...
 
auto getFTensor1Tangent1AtGaussPts ()
 get tangent 1 at integration points More...
 
auto getFTensor1Tangent2AtGaussPts ()
 get tangent 2 at integration points More...
 
FaceElementForcesAndSourcesCoregetFaceFE ()
 return pointer to Generic Triangle Finite Element object More...
 
MoFEMErrorCode loopSideVolumes (const string fe_name, VolumeElementForcesAndSourcesCoreOnSide &fe_method)
 
- 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
 
DriverElementOrientationoRientation
 
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 Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Definition at line 417 of file SurfaceSlidingConstrains.hpp.

Constructor & Destructor Documentation

◆ OpJacobian()

SurfaceSlidingConstrains::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,
DriverElementOrientation orientation,
bool  evaluate_jacobian,
const double alpha 
)
inline

Definition at line 429 of file SurfaceSlidingConstrains.hpp.

437  tAg(tag), activeVariablesPtr(active_variables_ptr),
438  resultsPtr(results_ptr), jacobianPtr(jacobian_ptr),
439  oRientation(orientation), evaluateJacobian(evaluate_jacobian),
440  aLpha(alpha) {}

Member Function Documentation

◆ doWork()

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

Definition at line 442 of file SurfaceSlidingConstrains.hpp.

443  {
445  if (type != MBVERTEX)
447 
448  VectorInt &indices = data.getIndices();
449 
450  trace_on(tAg);
451 
452  ublas::vector<adouble> lambda_dofs(3);
453  for (int dd = 0; dd != 3; ++dd) {
454  lambda_dofs[dd] <<= (*activeVariablesPtr)[dd];
455  }
456  ublas::vector<adouble> position_dofs(9);
457  for (int dd = 0; dd != 9; ++dd) {
458  position_dofs[dd] <<= (*activeVariablesPtr)[3 + dd];
459  }
460 
467 
469  getFEMethod());
471 
472  int nb_gauss_pts = data.getN().size1();
473  int nb_base_functions = data.getN().size2();
474  auto t_base1 = data.getFTensor0N();
475  auto t_base2 = data.getFTensor0N();
476  auto t_diff_base = data.getFTensor1DiffN<2>();
477  FTensor::Tensor1<adouble, 3> t_position;
478  FTensor::Tensor1<adouble, 3> t_position_ksi;
479  FTensor::Tensor1<adouble, 3> t_position_eta;
480  adouble lambda;
483 
484  ublas::vector<adouble> c_vec(3);
485  ublas::vector<adouble> f_vec(9);
486  c_vec.clear();
487  f_vec.clear();
488 
489  auto t_coord_ref = getFTensor1CoordsAtGaussPts();
490 
491  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
492 
493  FTensor::Tensor1<adouble *, 3> t_position_dofs(
494  &position_dofs[0], &position_dofs[1], &position_dofs[2], 3);
495  FTensor::Tensor0<adouble *> t_lambda_dof(&lambda_dofs[0]);
496 
497  t_position(i) = 0;
498  t_position_ksi(i) = 0;
499  t_position_eta(i) = 0;
500  lambda = 0;
501 
502  for (int bb = 0; bb != nb_base_functions; ++bb) {
503  t_position(i) += t_base1 * t_position_dofs(i);
504  t_position_ksi(i) += t_diff_base(N0) * t_position_dofs(i);
505  t_position_eta(i) += t_diff_base(N1) * t_position_dofs(i);
506  lambda += t_base1 * t_lambda_dof;
507  ++t_base1;
508  ++t_position_dofs;
509  ++t_lambda_dof;
510  ++t_diff_base;
511  }
512 
513  t_delta(i) = t_position(i) - t_coord_ref(i);
514  t_normal(k) = FTensor::cross(t_position_ksi(i), t_position_eta(j), k);
515 
516  double w = getGaussPts()(2, gg) * 0.5 * aLpha;
517  adouble val;
518  FTensor::Tensor0<adouble *> t_c(&c_vec[0]);
519  FTensor::Tensor1<adouble *, 3> t_f(&f_vec[0], &f_vec[1], &f_vec[2], 3);
520 
521  adouble area = sqrt(t_normal(i) * t_normal(i));
522 
523  for (int bb = 0; bb != nb_base_functions; ++bb) {
524  if (indices[bb] != -1) {
525  val = w * eo * t_base2;
526  t_c += val * t_normal(i) * t_delta(i);
527  val *= lambda;
528  t_f(i) += val * t_normal(i);
529  }
530  ++t_c;
531  ++t_f;
532  ++t_base2;
533  }
534 
535  ++t_coord_ref;
536  }
537 
538  for (int rr = 0; rr != 3; ++rr)
539  c_vec[rr] >>= (*resultsPtr)[rr];
540 
541  for (int rr = 0; rr != 9; ++rr)
542  f_vec(rr) >>= (*resultsPtr)[3 + rr];
543 
544  trace_off();
545 
546  if (evaluateJacobian) {
547  double *jac_ptr[3 + 9];
548  for (int rr = 0; rr != 3 + 9; ++rr)
549  jac_ptr[rr] = &(*jacobianPtr)(rr, 0);
550 
551  // play recorder for jacobians
552  int r =
553  ::jacobian(tAg, 3 + 9, 3 + 9, &(*activeVariablesPtr)[0], jac_ptr);
554  if (r < 0)
555  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
556  "ADOL-C function evaluation with error");
557  }
558 
560  }

Member Data Documentation

◆ activeVariablesPtr

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

Definition at line 421 of file SurfaceSlidingConstrains.hpp.

◆ aLpha

const double& SurfaceSlidingConstrains::OpJacobian::aLpha

Definition at line 427 of file SurfaceSlidingConstrains.hpp.

◆ evaluateJacobian

bool SurfaceSlidingConstrains::OpJacobian::evaluateJacobian

Definition at line 425 of file SurfaceSlidingConstrains.hpp.

◆ jacobianPtr

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

Definition at line 423 of file SurfaceSlidingConstrains.hpp.

◆ oRientation

DriverElementOrientation& SurfaceSlidingConstrains::OpJacobian::oRientation

Definition at line 424 of file SurfaceSlidingConstrains.hpp.

◆ resultsPtr

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

Definition at line 422 of file SurfaceSlidingConstrains.hpp.

◆ tAg

const int SurfaceSlidingConstrains::OpJacobian::tAg

Definition at line 420 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
SurfaceSlidingConstrains::DriverElementOrientation::getElementOrientation
virtual MoFEMErrorCode getElementOrientation(MoFEM::Interface &m_field, const FEMethod *fe_method_ptr)
Definition: SurfaceSlidingConstrains.hpp:339
PlasticOps::w
double w(double eqiv, double dot_tau, double f, double sigma_y, double sigma_Y)
Definition: PlasticOpsGeneric.hpp:276
FTensor::Tensor1< adouble, 3 >
FTensor::cross
auto cross(const Tensor1_Expr< A, T, 3, i > &a, const Tensor1_Expr< B, U, 3, j > &b, const Index< k, 3 > &)
Definition: cross.hpp:10
SurfaceSlidingConstrains::OpJacobian::aLpha
const double & aLpha
Definition: SurfaceSlidingConstrains.hpp:427
SurfaceSlidingConstrains::OpJacobian::tAg
const int tAg
Definition: SurfaceSlidingConstrains.hpp:420
SurfaceSlidingConstrains::OpJacobian::oRientation
DriverElementOrientation & oRientation
Definition: SurfaceSlidingConstrains.hpp:424
SurfaceSlidingConstrains::mField
MoFEM::Interface & mField
Definition: SurfaceSlidingConstrains.hpp:353
SurfaceSlidingConstrains::OpJacobian::resultsPtr
boost::shared_ptr< VectorDouble > resultsPtr
Definition: SurfaceSlidingConstrains.hpp:422
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
FTensor::Number< 0 >
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
friend class UserDataOperator
Definition: FaceElementForcesAndSourcesCore.hpp:86
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
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
FTensor::Index< 'i', 3 >
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEMethod
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
Definition: ForcesAndSourcesCore.hpp:1041
SurfaceSlidingConstrains::OpJacobian::jacobianPtr
boost::shared_ptr< MatrixDouble > jacobianPtr
Definition: SurfaceSlidingConstrains.hpp:423
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
FTensor::Tensor0
Definition: Tensor0.hpp:16
MoFEM::Types::VectorInt
UBlasVector< int > VectorInt
Definition: Types.hpp:67
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
SurfaceSlidingConstrains::OpJacobian::activeVariablesPtr
boost::shared_ptr< VectorDouble > activeVariablesPtr
Definition: SurfaceSlidingConstrains.hpp:421
lambda
static double lambda
Definition: incompressible_elasticity.cpp:199
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
MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator::getFaceFE
FaceElementForcesAndSourcesCore * getFaceFE()
return pointer to Generic Triangle Finite Element object
Definition: FaceElementForcesAndSourcesCore.hpp:337
SurfaceSlidingConstrains::OpJacobian::evaluateJacobian
bool evaluateJacobian
Definition: SurfaceSlidingConstrains.hpp:425
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::getFTensor1CoordsAtGaussPts
auto getFTensor1CoordsAtGaussPts()
Get coordinates at integration points assuming linear geometry.
Definition: ForcesAndSourcesCore.hpp:1268
SurfaceSlidingConstrains::DriverElementOrientation::elementOrientation
int elementOrientation
Definition: SurfaceSlidingConstrains.hpp:336