v0.8.15
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 806 of file DataOperators.cpp.

807  {
809 
810  if (type != MBTRI && type != MBTET)
812 
813  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
814 
815  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
816 
817  const unsigned int nb_base_functions = data.getN(base).size2() / 3;
818  if (!nb_base_functions)
819  continue;
820 
821  const double c = 1. / 6.;
822  const unsigned int nb_gauss_pts = data.getN(base).size1();
823 
824  double const a = c / vOlume;
825 
826  piolaN.resize(nb_gauss_pts, data.getN(base).size2(), false);
827  if (data.getN(base).size2() > 0) {
828  auto t_n = data.getFTensor1N<3>(base);
829  double *t_transformed_n_ptr = &*piolaN.data().begin();
831  t_transformed_n_ptr, // HVEC0
832  &t_transformed_n_ptr[HVEC1], &t_transformed_n_ptr[HVEC2]);
833  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
834  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
835  t_transformed_n(i) = a * tJac(i, k) * t_n(k);
836  ++t_n;
837  ++t_transformed_n;
838  }
839  }
840  data.getN(base).data().swap(piolaN.data());
841  }
842 
843  piolaDiffN.resize(nb_gauss_pts, data.getDiffN(base).size2(), false);
844  if (data.getDiffN(base).size2() > 0) {
845  auto t_diff_n = data.getFTensor2DiffN<3, 3>(base);
846  double *t_transformed_diff_n_ptr = &*piolaDiffN.data().begin();
847  FTensor::Tensor2<FTensor::PackPtr<double *, 9>, 3, 3> t_transformed_diff_n(
848  t_transformed_diff_n_ptr, &t_transformed_diff_n_ptr[HVEC0_1],
849  &t_transformed_diff_n_ptr[HVEC0_2],
850  &t_transformed_diff_n_ptr[HVEC1_0],
851  &t_transformed_diff_n_ptr[HVEC1_1],
852  &t_transformed_diff_n_ptr[HVEC1_2],
853  &t_transformed_diff_n_ptr[HVEC2_0],
854  &t_transformed_diff_n_ptr[HVEC2_1],
855  &t_transformed_diff_n_ptr[HVEC2_2]);
856  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
857  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
858  t_transformed_diff_n(i, k) = a * tJac(i, j) * t_diff_n(j, k);
859  ++t_diff_n;
860  ++t_transformed_diff_n;
861  }
862  }
863  data.getDiffN(base).data().swap(piolaDiffN.data());
864  }
865  }
866 
868 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
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:403

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: