v0.8.23
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 right 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 left 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 216 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ OpSetContravariantPiolaTransform()

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

Definition at line 226 of file DataOperators.hpp.

227  : vOlume(volume),
228  // jAc(jac),
229  tJac(&jac(0, 0), &jac(0, 1), &jac(0, 2), &jac(1, 0), &jac(1, 1),
230  &jac(1, 2), &jac(2, 0), &jac(2, 1), &jac(2, 2)) {}
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 right hand side.

Reimplemented from MoFEM::DataOperator.

Definition at line 771 of file DataOperators.cpp.

772  {
774 
775  if (type != MBTRI && type != MBTET)
777 
778  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
779 
780  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
781 
782  const unsigned int nb_base_functions = data.getN(base).size2() / 3;
783  if (!nb_base_functions)
784  continue;
785 
786  const double c = 1. / 6.;
787  const unsigned int nb_gauss_pts = data.getN(base).size1();
788 
789  double const a = c / vOlume;
790 
791  piolaN.resize(nb_gauss_pts, data.getN(base).size2(), false);
792  if (data.getN(base).size2() > 0) {
793  auto t_n = data.getFTensor1N<3>(base);
794  double *t_transformed_n_ptr = &*piolaN.data().begin();
796  t_transformed_n_ptr, // HVEC0
797  &t_transformed_n_ptr[HVEC1], &t_transformed_n_ptr[HVEC2]);
798  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
799  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
800  t_transformed_n(i) = a * tJac(i, k) * t_n(k);
801  ++t_n;
802  ++t_transformed_n;
803  }
804  }
805  data.getN(base).data().swap(piolaN.data());
806  }
807 
808  piolaDiffN.resize(nb_gauss_pts, data.getDiffN(base).size2(), false);
809  if (data.getDiffN(base).size2() > 0) {
810  auto t_diff_n = data.getFTensor2DiffN<3, 3>(base);
811  double *t_transformed_diff_n_ptr = &*piolaDiffN.data().begin();
813  t_transformed_diff_n(t_transformed_diff_n_ptr,
814  &t_transformed_diff_n_ptr[HVEC0_1],
815  &t_transformed_diff_n_ptr[HVEC0_2],
816  &t_transformed_diff_n_ptr[HVEC1_0],
817  &t_transformed_diff_n_ptr[HVEC1_1],
818  &t_transformed_diff_n_ptr[HVEC1_2],
819  &t_transformed_diff_n_ptr[HVEC2_0],
820  &t_transformed_diff_n_ptr[HVEC2_1],
821  &t_transformed_diff_n_ptr[HVEC2_2]);
822  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
823  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
824  t_transformed_diff_n(i, k) = a * tJac(i, j) * t_diff_n(j, k);
825  ++t_diff_n;
826  ++t_transformed_diff_n;
827  }
828  }
829  data.getDiffN(base).data().swap(piolaDiffN.data());
830  }
831  }
832 
834 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507
FieldApproximationBase
approximation base
Definition: definitions.h:142
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:144
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:406

Member Data Documentation

◆ i

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

Definition at line 222 of file DataOperators.hpp.

◆ j

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

Definition at line 223 of file DataOperators.hpp.

◆ k

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

Definition at line 224 of file DataOperators.hpp.

◆ piolaDiffN

MatrixDouble MoFEM::OpSetContravariantPiolaTransform::piolaDiffN

Definition at line 233 of file DataOperators.hpp.

◆ piolaN

MatrixDouble MoFEM::OpSetContravariantPiolaTransform::piolaN

Definition at line 232 of file DataOperators.hpp.

◆ tJac

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

Definition at line 221 of file DataOperators.hpp.

◆ vOlume

double& MoFEM::OpSetContravariantPiolaTransform::vOlume

Definition at line 218 of file DataOperators.hpp.


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