v0.10.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)
 
virtual ~DataOperator ()=default
 
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)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &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

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...
 
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...
 

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 212 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ OpSetContravariantPiolaTransform()

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

Definition at line 221 of file DataOperators.hpp.

222  : vOlume(volume),
223  // jAc(jac),
224  tJac(&jac(0, 0), &jac(0, 1), &jac(0, 2), &jac(1, 0), &jac(1, 1),
225  &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 314 of file DataOperators.cpp.

315  {
317 
318  if (type != MBTRI && type != MBTET)
320 
321  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
322 
323  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
324 
325  const unsigned int nb_base_functions = data.getN(base).size2() / 3;
326  if (!nb_base_functions)
327  continue;
328 
329  const double c = 1. / 6.;
330  const unsigned int nb_gauss_pts = data.getN(base).size1();
331 
332  double const a = c / vOlume;
333 
334  piolaN.resize(nb_gauss_pts, data.getN(base).size2(), false);
335  if (data.getN(base).size2() > 0) {
336  auto t_n = data.getFTensor1N<3>(base);
337  double *t_transformed_n_ptr = &*piolaN.data().begin();
339  t_transformed_n_ptr, // HVEC0
340  &t_transformed_n_ptr[HVEC1], &t_transformed_n_ptr[HVEC2]);
341  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
342  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
343  t_transformed_n(i) = a * tJac(i, k) * t_n(k);
344  ++t_n;
345  ++t_transformed_n;
346  }
347  }
348  data.getN(base).data().swap(piolaN.data());
349  }
350 
351  piolaDiffN.resize(nb_gauss_pts, data.getDiffN(base).size2(), false);
352  if (data.getDiffN(base).size2() > 0) {
353  auto t_diff_n = data.getFTensor2DiffN<3, 3>(base);
354  double *t_transformed_diff_n_ptr = &*piolaDiffN.data().begin();
356  t_transformed_diff_n(t_transformed_diff_n_ptr,
357  &t_transformed_diff_n_ptr[HVEC0_1],
358  &t_transformed_diff_n_ptr[HVEC0_2],
359  &t_transformed_diff_n_ptr[HVEC1_0],
360  &t_transformed_diff_n_ptr[HVEC1_1],
361  &t_transformed_diff_n_ptr[HVEC1_2],
362  &t_transformed_diff_n_ptr[HVEC2_0],
363  &t_transformed_diff_n_ptr[HVEC2_1],
364  &t_transformed_diff_n_ptr[HVEC2_2]);
365  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
366  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
367  t_transformed_diff_n(i, k) = a * tJac(i, j) * t_diff_n(j, k);
368  ++t_diff_n;
369  ++t_transformed_diff_n;
370  }
371  }
372  data.getDiffN(base).data().swap(piolaDiffN.data());
373  }
374  }
375 
377 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
FieldApproximationBase
approximation base
Definition: definitions.h:150
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:152
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:415

Member Data Documentation

◆ i

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

Definition at line 217 of file DataOperators.hpp.

◆ j

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

Definition at line 218 of file DataOperators.hpp.

◆ k

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

Definition at line 219 of file DataOperators.hpp.

◆ piolaDiffN

MatrixDouble MoFEM::OpSetContravariantPiolaTransform::piolaDiffN

Definition at line 228 of file DataOperators.hpp.

◆ piolaN

MatrixDouble MoFEM::OpSetContravariantPiolaTransform::piolaN

Definition at line 227 of file DataOperators.hpp.

◆ tJac

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

Definition at line 216 of file DataOperators.hpp.

◆ vOlume

double& MoFEM::OpSetContravariantPiolaTransform::vOlume

Definition at line 214 of file DataOperators.hpp.


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