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 497 of file DataOperators.cpp.

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

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:460
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:548
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: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_INVALID_DATA
@ MOFEM_INVALID_DATA
Definition: definitions.h:36