v0.9.0
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 770 of file DataOperators.cpp.

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

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: