v0.8.4
Public Member Functions | Public Attributes | List of all members
MoFEM::OpSetContravariantPiolaTransform Struct Reference

apply contravariant (Piola) transfer to Hdiv space More...

#include <src/finite_elements/DataOperators.hpp>

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

Public Member Functions

 OpSetContravariantPiolaTransform (double &volume, MatrixDouble3by3 &jac)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Operator for linear form, usually to calculate values on left hand side. More...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)
 
virtual ~DataOperator ()
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data, bool symm=true)
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool do_vertices, const bool do_edges, const bool do_quads, const bool do_tris, const bool do_tets, const bool do_prisms, const bool error_if_no_base=true)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool error_if_no_base=true)
 
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

doublevOlume
 
FTensor::Tensor2< double *, 3, 3 > tJac
 
FTensor::Index< 'i', 3 > i
 
FTensor::Index< 'j', 3 > j
 
FTensor::Index< 'k', 3 > k
 
MatrixDouble piolaN
 
MatrixDouble piolaDiffN
 
- Public Attributes inherited from MoFEM::DataOperator
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
bool doVertices
 If false skip vertices. More...
 
bool doEdges
 If false skip edges. More...
 
bool doQuads
 
bool doTris
 
bool doTets
 
bool doPrisms
 

Detailed Description

apply contravariant (Piola) transfer to Hdiv space

Contravariant Piola transformation

\[ \psi_i|_t = \frac{1}{\textrm{det}(J)}J_{ij}\hat{\psi}_j\\ \left.\frac{\partial \psi_i}{\partial \xi_j}\right|_t = \frac{1}{\textrm{det}(J)}J_{ik}\frac{\partial \hat{\psi}_k}{\partial \xi_j} \]

Definition at line 360 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ OpSetContravariantPiolaTransform()

MoFEM::OpSetContravariantPiolaTransform::OpSetContravariantPiolaTransform ( double volume,
MatrixDouble3by3 jac 
)

Definition at line 370 of file DataOperators.hpp.

370  :
371  vOlume(volume),
372  // jAc(jac),
373  tJac(
374  &jac(0,0),&jac(0,1),&jac(0,2),
375  &jac(1,0),&jac(1,1),&jac(1,2),
376  &jac(2,0),&jac(2,1),&jac(2,2)
377  ) {
378  }
FTensor::Tensor2< double *, 3, 3 > tJac

Member Function Documentation

◆ doWork()

MoFEMErrorCode MoFEM::OpSetContravariantPiolaTransform::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
virtual

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

Reimplemented from MoFEM::DataOperator.

Definition at line 811 of file DataOperators.cpp.

812  {
814 
815  if (type != MBTRI && type != MBTET)
817 
818  for (int b = AINSWORTH_LEGENDRE_BASE; b != USER_BASE; b++) {
819 
820  FieldApproximationBase base = ApproximationBaseArray[b];
821 
822  const unsigned int nb_base_functions = data.getHdivN(base).size2() / 3;
823  if (!nb_base_functions)
824  continue;
825 
826  const double c = 1. / 6.;
827  const unsigned int nb_gauss_pts = data.getHdivN(base).size1();
828  piolaN.resize(nb_gauss_pts, data.getHdivN(base).size2(), false);
829  piolaDiffN.resize(nb_gauss_pts, data.getDiffHdivN(base).size2(), false);
830 
831  auto t_n = data.getFTensor1HdivN<3>(base);
832  double *t_transformed_n_ptr = &*piolaN.data().begin();
834  t_transformed_n_ptr, // HDIV0
835  &t_transformed_n_ptr[HDIV1], &t_transformed_n_ptr[HDIV2]);
836  auto t_diff_n = data.getFTensor2DiffHdivN<3, 3>(base);
837  double *t_transformed_diff_n_ptr = &*piolaDiffN.data().begin();
838  FTensor::Tensor2<double *, 3, 3> t_transformed_diff_n(
839  t_transformed_diff_n_ptr, &t_transformed_diff_n_ptr[HDIV0_1],
840  &t_transformed_diff_n_ptr[HDIV0_2], &t_transformed_diff_n_ptr[HDIV1_0],
841  &t_transformed_diff_n_ptr[HDIV1_1], &t_transformed_diff_n_ptr[HDIV1_2],
842  &t_transformed_diff_n_ptr[HDIV2_0], &t_transformed_diff_n_ptr[HDIV2_1],
843  &t_transformed_diff_n_ptr[HDIV2_2], 9);
844 
845  double const a = c / vOlume;
846  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
847  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
848  t_transformed_n(i) = a * tJac(i, k) * t_n(k);
849  t_transformed_diff_n(i, k) = a * tJac(i, j) * t_diff_n(j, k);
850  ++t_n;
851  ++t_transformed_n;
852  ++t_diff_n;
853  ++t_transformed_diff_n;
854  }
855  }
856  data.getHdivN(base).data().swap(piolaN.data());
857  data.getDiffHdivN(base).data().swap(piolaDiffN.data());
858  }
859 
860  // data.getBase() = base;
861 
863 }
user implemented approximation base
Definition: definitions.h:146
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:498
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
FieldApproximationBase
approximation base
Definition: definitions.h:140
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:142
FTensor::Tensor2< double *, 3, 3 > tJac
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:443

Member Data Documentation

◆ i

FTensor::Index<'i',3> MoFEM::OpSetContravariantPiolaTransform::i

Definition at line 366 of file DataOperators.hpp.

◆ j

FTensor::Index<'j',3> MoFEM::OpSetContravariantPiolaTransform::j

Definition at line 367 of file DataOperators.hpp.

◆ k

FTensor::Index<'k',3> MoFEM::OpSetContravariantPiolaTransform::k

Definition at line 368 of file DataOperators.hpp.

◆ piolaDiffN

MatrixDouble MoFEM::OpSetContravariantPiolaTransform::piolaDiffN

Definition at line 381 of file DataOperators.hpp.

◆ piolaN

MatrixDouble MoFEM::OpSetContravariantPiolaTransform::piolaN

Definition at line 380 of file DataOperators.hpp.

◆ tJac

FTensor::Tensor2<double*,3,3> MoFEM::OpSetContravariantPiolaTransform::tJac

Definition at line 365 of file DataOperators.hpp.

◆ vOlume

double& MoFEM::OpSetContravariantPiolaTransform::vOlume

Definition at line 362 of file DataOperators.hpp.


The documentation for this struct was generated from the following files: