v0.14.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, EntitiesFieldData::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, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &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
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
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...
 

Additional Inherited Members

- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 

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

Constructor & Destructor Documentation

◆ OpSetContravariantPiolaTransform()

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

Definition at line 192 of file DataOperators.hpp.

193  : vOlume(volume),
194  // jAc(jac),
195  tJac(&jac(0, 0), &jac(0, 1), &jac(0, 2), &jac(1, 0), &jac(1, 1),
196  &jac(1, 2), &jac(2, 0), &jac(2, 1), &jac(2, 2)) {}

Member Function Documentation

◆ doWork()

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

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

Reimplemented from MoFEM::DataOperator.

Definition at line 265 of file DataOperators.cpp.

266  {
268 
269  if (CN::Dimension(type) > 1) {
270 
271  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
272 
273  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
274 
275  const unsigned int nb_base_functions = data.getN(base).size2() / 3;
276  if (!nb_base_functions)
277  continue;
278 
279  const unsigned int nb_gauss_pts = data.getN(base).size1();
280  double const a = 1. / vOlume;
281 
282  piolaN.resize(nb_gauss_pts, data.getN(base).size2(), false);
283  if (data.getN(base).size2() > 0) {
284  auto t_n = data.getFTensor1N<3>(base);
285  double *t_transformed_n_ptr = &*piolaN.data().begin();
287  t_transformed_n_ptr, // HVEC0
288  &t_transformed_n_ptr[HVEC1], &t_transformed_n_ptr[HVEC2]);
289  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
290  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
291  t_transformed_n(i) = a * (tJac(i, k) * t_n(k));
292  ++t_n;
293  ++t_transformed_n;
294  }
295  }
296  data.getN(base).swap(piolaN);
297  }
298 
299  piolaDiffN.resize(nb_gauss_pts, data.getDiffN(base).size2(), false);
300  if (data.getDiffN(base).size2() > 0) {
301  auto t_diff_n = data.getFTensor2DiffN<3, 3>(base);
302  double *t_transformed_diff_n_ptr = &*piolaDiffN.data().begin();
304  t_transformed_diff_n(t_transformed_diff_n_ptr,
305  &t_transformed_diff_n_ptr[HVEC0_1],
306  &t_transformed_diff_n_ptr[HVEC0_2],
307  &t_transformed_diff_n_ptr[HVEC1_0],
308  &t_transformed_diff_n_ptr[HVEC1_1],
309  &t_transformed_diff_n_ptr[HVEC1_2],
310  &t_transformed_diff_n_ptr[HVEC2_0],
311  &t_transformed_diff_n_ptr[HVEC2_1],
312  &t_transformed_diff_n_ptr[HVEC2_2]);
313  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
314  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
315  t_transformed_diff_n(i, k) = a * tJac(i, j) * t_diff_n(j, k);
316  ++t_diff_n;
317  ++t_transformed_diff_n;
318  }
319  }
320  data.getDiffN(base).swap(piolaDiffN);
321  }
322  }
323  }
324 
326 }

Member Data Documentation

◆ i

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

Definition at line 188 of file DataOperators.hpp.

◆ j

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

Definition at line 189 of file DataOperators.hpp.

◆ k

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

Definition at line 190 of file DataOperators.hpp.

◆ piolaDiffN

MatrixDouble MoFEM::OpSetContravariantPiolaTransform::piolaDiffN

Definition at line 199 of file DataOperators.hpp.

◆ piolaN

MatrixDouble MoFEM::OpSetContravariantPiolaTransform::piolaN

Definition at line 198 of file DataOperators.hpp.

◆ tJac

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

Definition at line 187 of file DataOperators.hpp.

◆ vOlume

double& MoFEM::OpSetContravariantPiolaTransform::vOlume

Definition at line 185 of file DataOperators.hpp.


The documentation for this struct was generated from the following files:
MoFEM::OpSetContravariantPiolaTransform::piolaDiffN
MatrixDouble piolaDiffN
Definition: DataOperators.hpp:199
LASTBASE
@ LASTBASE
Definition: definitions.h:69
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
HVEC0_2
@ HVEC0_2
Definition: definitions.h:211
HVEC0_1
@ HVEC0_1
Definition: definitions.h:208
HVEC1_1
@ HVEC1_1
Definition: definitions.h:209
HVEC1
@ HVEC1
Definition: definitions.h:199
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
MoFEM::OpSetContravariantPiolaTransform::tJac
FTensor::Tensor2< double *, 3, 3 > tJac
Definition: DataOperators.hpp:187
HVEC2_1
@ HVEC2_1
Definition: definitions.h:210
HVEC2_2
@ HVEC2_2
Definition: definitions.h:213
HVEC1_2
@ HVEC1_2
Definition: definitions.h:212
MoFEM::OpSetContravariantPiolaTransform::j
FTensor::Index< 'j', 3 > j
Definition: DataOperators.hpp:189
a
constexpr double a
Definition: approx_sphere.cpp:30
convert.type
type
Definition: convert.py:64
MoFEM::OpSetContravariantPiolaTransform::i
FTensor::Index< 'i', 3 > i
Definition: DataOperators.hpp:188
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::OpSetContravariantPiolaTransform::piolaN
MatrixDouble piolaN
Definition: DataOperators.hpp:198
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
HVEC2_0
@ HVEC2_0
Definition: definitions.h:207
MoFEM::OpSetContravariantPiolaTransform::vOlume
double & vOlume
Definition: DataOperators.hpp:185
MoFEM::OpSetContravariantPiolaTransform::k
FTensor::Index< 'k', 3 > k
Definition: DataOperators.hpp:190
HVEC2
@ HVEC2
Definition: definitions.h:199
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
HVEC1_0
@ HVEC1_0
Definition: definitions.h:206