v0.14.0
Public Member Functions | Public Attributes | List of all members
MoFEM::OpSetContravariantPiolaTransformOnFace Struct Reference

transform Hdiv base fluxes from reference element to physical triangle More...

#include <src/finite_elements/DataOperators.hpp>

Inheritance diagram for MoFEM::OpSetContravariantPiolaTransformOnFace:
[legend]
Collaboration diagram for MoFEM::OpSetContravariantPiolaTransformOnFace:
[legend]

Public Member Functions

 OpSetContravariantPiolaTransformOnFace (const VectorDouble &normal, const MatrixDouble &normals_at_pts, const int normal_shift=0)
 
 OpSetContravariantPiolaTransformOnFace (const VectorDouble *normal_raw_ptr=nullptr, const MatrixDouble *normals_at_pts_ptr=nullptr, const int normal_shift=0)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. 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 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 VectorDoublenormalRawPtr
 
const MatrixDoublenormalsAtGaussPtsRawPtr
 
int normalShift
 Shift in vector for linear geometry. More...
 
- 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::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)>
 

Detailed Description

transform Hdiv base fluxes from reference element to physical triangle

Deprecated:
It is used in contact elements. Contact elements should be minified to work as face element,

Definition at line 416 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ OpSetContravariantPiolaTransformOnFace() [1/2]

MoFEM::OpSetContravariantPiolaTransformOnFace::OpSetContravariantPiolaTransformOnFace ( const VectorDouble normal,
const MatrixDouble normals_at_pts,
const int  normal_shift = 0 
)
inline

Definition at line 433 of file DataOperators.hpp.

436  : normalRawPtr(&normal), normalsAtGaussPtsRawPtr(&normals_at_pts),
437  normalShift(normal_shift) {}

◆ OpSetContravariantPiolaTransformOnFace() [2/2]

MoFEM::OpSetContravariantPiolaTransformOnFace::OpSetContravariantPiolaTransformOnFace ( const VectorDouble normal_raw_ptr = nullptr,
const MatrixDouble normals_at_pts_ptr = nullptr,
const int  normal_shift = 0 
)
inline

Definition at line 439 of file DataOperators.hpp.

443  : normalRawPtr(normal_raw_ptr),
444  normalsAtGaussPtsRawPtr(normals_at_pts_ptr), normalShift(normal_shift) {
445  }

Member Function Documentation

◆ doWork()

MoFEMErrorCode MoFEM::OpSetContravariantPiolaTransformOnFace::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
virtual

Operator for linear form, usually to calculate values on right hand side.

Reimplemented from MoFEM::DataOperator.

Definition at line 492 of file DataOperators.cpp.

493  {
496 
497  if (moab::CN::Dimension(type) != 2)
499 
500  if (normalRawPtr == nullptr && normalsAtGaussPtsRawPtr == nullptr)
501  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
502  "Pointer to normal/normals not set");
503 
504  bool normal_is_at_gauss_pts = (normalsAtGaussPtsRawPtr != nullptr);
505  if (normal_is_at_gauss_pts)
506  normal_is_at_gauss_pts = (normalsAtGaussPtsRawPtr->size1() != 0);
507 
508  auto apply_transform_linear_geometry = [&](auto base, auto nb_gauss_pts,
509  auto nb_base_functions) {
511  const auto &normal = *normalRawPtr;
512  auto t_normal = FTensor::Tensor1<double, 3>{normal[normalShift + 0],
513  normal[normalShift + 1],
514  normal[normalShift + 2]};
515  const auto l02 = t_normal(i) * t_normal(i);
516  auto t_base = data.getFTensor1N<3>(base);
517  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
518  for (int bb = 0; bb != nb_base_functions; ++bb) {
519  const auto v = t_base(0);
520  t_base(i) = (v / l02) * t_normal(i);
521  ++t_base;
522  }
523  }
525  };
526 
527  auto apply_transform_nonlinear_geometry = [&](auto base, auto nb_gauss_pts,
528  auto nb_base_functions) {
530  const MatrixDouble &normals_at_pts = *normalsAtGaussPtsRawPtr;
532  &normals_at_pts(0, 0), &normals_at_pts(0, 1), &normals_at_pts(0, 2));
533 
534  auto t_base = data.getFTensor1N<3>(base);
535  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
536  const auto l2 = t_normal(i) * t_normal(i);
537  for (int bb = 0; bb != nb_base_functions; ++bb) {
538  const auto v = t_base(0);
539  t_base(i) = (v / l2) * t_normal(i);
540  ++t_base;
541  }
542  ++t_normal;
543  }
545  };
546 
547  if (normal_is_at_gauss_pts) {
548  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
549 
550  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
551  const auto &base_functions = data.getN(base);
552  const auto nb_gauss_pts = base_functions.size1();
553 
554  if (nb_gauss_pts) {
555 
556  if (normalsAtGaussPtsRawPtr->size1() != nb_gauss_pts)
557  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
558  "normalsAtGaussPtsRawPtr has inconsistent number of "
559  "integration "
560  "points");
561 
562  const auto nb_base_functions = base_functions.size2() / 3;
563  CHKERR apply_transform_nonlinear_geometry(base, nb_gauss_pts,
564  nb_base_functions);
565  }
566  }
567  } else {
568  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
569 
570  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
571  const auto &base_functions = data.getN(base);
572  const auto nb_gauss_pts = base_functions.size1();
573 
574  if (nb_gauss_pts) {
575  const auto nb_base_functions = base_functions.size2() / 3;
576  CHKERR apply_transform_linear_geometry(base, nb_gauss_pts,
577  nb_base_functions);
578  }
579  }
580  }
581 
583 }

Member Data Documentation

◆ normalRawPtr

const VectorDouble* MoFEM::OpSetContravariantPiolaTransformOnFace::normalRawPtr

Definition at line 419 of file DataOperators.hpp.

◆ normalsAtGaussPtsRawPtr

const MatrixDouble* MoFEM::OpSetContravariantPiolaTransformOnFace::normalsAtGaussPtsRawPtr

Definition at line 420 of file DataOperators.hpp.

◆ normalShift

int MoFEM::OpSetContravariantPiolaTransformOnFace::normalShift

Shift in vector for linear geometry.

Normal can have size larger than three, for example normal for contact prism and flat prims element have six comonents, for top and bottom triangle of the prims.

Definition at line 431 of file DataOperators.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:447
MoFEM::OpSetContravariantPiolaTransformOnFace::normalsAtGaussPtsRawPtr
const MatrixDouble * normalsAtGaussPtsRawPtr
Definition: DataOperators.hpp:420
LASTBASE
@ LASTBASE
Definition: definitions.h:69
FTensor::Tensor1< double, 3 >
MoFEM::OpSetContravariantPiolaTransformOnFace::normalRawPtr
const VectorDouble * normalRawPtr
Definition: DataOperators.hpp:419
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
convert.type
type
Definition: convert.py:64
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 3 >
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
MoFEM::OpSetContravariantPiolaTransformOnFace::normalShift
int normalShift
Shift in vector for linear geometry.
Definition: DataOperators.hpp:431
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
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
MOFEM_INVALID_DATA
@ MOFEM_INVALID_DATA
Definition: definitions.h:36