v0.14.0
Public Member Functions | Public Attributes | List of all members
HookeInternalStressElement::OpPostProcHookeElement< ELEMENT > Struct Template Reference

#include <users_modules/mortar_contact/src/HookeInternalStressElement.hpp>

Inheritance diagram for HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >:
[legend]
Collaboration diagram for HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >:
[legend]

Public Member Functions

 OpPostProcHookeElement (const string row_field, boost::shared_ptr< DataAtIntegrationPts > data_at_pts, map< int, BlockData > &block_sets_ptr, moab::Interface &post_proc_mesh, std::vector< EntityHandle > &map_gauss_pts, bool is_ale=false, bool is_field_disp=true)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 

Public Attributes

boost::shared_ptr< DataAtIntegrationPtsdataAtPts
 
map< int, BlockData > & blockSetsPtr
 
moab::Interface & postProcMesh
 
std::vector< EntityHandle > & mapGaussPts
 
bool isALE
 
bool isFieldDisp
 

Detailed Description

template<class ELEMENT>
struct HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >

Examples
mortar_contact_thermal.cpp, and simple_contact_thermal.cpp.

Definition at line 142 of file HookeInternalStressElement.hpp.

Constructor & Destructor Documentation

◆ OpPostProcHookeElement()

template<class ELEMENT >
HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >::OpPostProcHookeElement ( const string  row_field,
boost::shared_ptr< DataAtIntegrationPts data_at_pts,
map< int, BlockData > &  block_sets_ptr,
moab::Interface &  post_proc_mesh,
std::vector< EntityHandle > &  map_gauss_pts,
bool  is_ale = false,
bool  is_field_disp = true 
)
inline
Examples
HookeInternalStressElement.hpp.

Definition at line 151 of file HookeInternalStressElement.hpp.

158  dataAtPts(data_at_pts), blockSetsPtr(block_sets_ptr),
159  postProcMesh(post_proc_mesh), mapGaussPts(map_gauss_pts),
160  isALE(is_ale), isFieldDisp(is_field_disp) {}

Member Function Documentation

◆ doWork()

template<class ELEMENT >
MoFEMErrorCode HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
Examples
HookeInternalStressElement.hpp.

Definition at line 487 of file HookeInternalStressElement.hpp.

488  {
490 
491  if (type != MBVERTEX) {
493  }
494 
495  auto tensor_to_tensor = [](const auto &t1, auto &t2) {
496  t2(0, 0) = t1(0, 0);
497  t2(1, 1) = t1(1, 1);
498  t2(2, 2) = t1(2, 2);
499  t2(0, 1) = t2(1, 0) = t1(1, 0);
500  t2(0, 2) = t2(2, 0) = t1(2, 0);
501  t2(1, 2) = t2(2, 1) = t1(2, 1);
502  };
503 
504  auto get_tag_handle = [&](auto name, auto size) {
505  Tag th;
506  std::vector<double> def_vals(size, 0.0);
507  CHKERR postProcMesh.tag_get_handle(name, size, MB_TYPE_DOUBLE, th,
508  MB_TAG_CREAT | MB_TAG_SPARSE,
509  def_vals.data());
510  return th;
511  };
512 
513  auto th_stress = get_tag_handle("STRESS", 9);
514  auto th_strain = get_tag_handle("STRAIN", 9);
515  auto th_psi = get_tag_handle("ENERGY", 1);
516  auto th_disp = get_tag_handle("DISPLACEMENT", 3);
517 
518  const int nb_integration_pts = mapGaussPts.size();
519 
524 
525  auto t_h = getFTensor2FromMat<3, 3>(*dataAtPts->hMat);
526  auto t_H = getFTensor2FromMat<3, 3>(*dataAtPts->HMat);
527 
528  dataAtPts->stiffnessMat->resize(36, 1, false);
530  MAT_TO_DDG(dataAtPts->stiffnessMat));
531  for (auto &m : (blockSetsPtr)) {
532  const double young = m.second.E;
533  const double poisson = m.second.PoissonRatio;
534 
535  const double coefficient = young / ((1 + poisson) * (1 - 2 * poisson));
536 
537  t_D(i, j, k, l) = 0.;
538  t_D(0, 0, 0, 0) = t_D(1, 1, 1, 1) = t_D(2, 2, 2, 2) = 1 - poisson;
539  t_D(0, 1, 0, 1) = t_D(0, 2, 0, 2) = t_D(1, 2, 1, 2) =
540  0.5 * (1 - 2 * poisson);
541  t_D(0, 0, 1, 1) = t_D(1, 1, 0, 0) = t_D(0, 0, 2, 2) = t_D(2, 2, 0, 0) =
542  t_D(1, 1, 2, 2) = t_D(2, 2, 1, 1) = poisson;
543  t_D(i, j, k, l) *= coefficient;
544 
545  break; // FIXME: calculates only first block
546  }
547 
548  double detH = 0.;
552  FTensor::Tensor2<double, 3, 3> t_small_strain;
553 
555  FTensor::Tensor2_symmetric<double, 3> t_small_strain_symm;
556 
557  auto t_spat_pos = getFTensor1FromMat<3>(*dataAtPts->spatPosMat);
558  auto t_mesh_node_pos = getFTensor1FromMat<3>(*dataAtPts->meshNodePosMat);
560 
561  for (int gg = 0; gg != nb_integration_pts; ++gg) {
562 
563  if (isFieldDisp) {
564  t_h(0, 0) += 1;
565  t_h(1, 1) += 1;
566  t_h(2, 2) += 1;
567  }
568 
569  if (!isALE) {
570  t_small_strain_symm(i, j) = (t_h(i, j) || t_h(j, i)) / 2.;
571  } else {
572  CHKERR determinantTensor3by3(t_H, detH);
573  CHKERR invertTensor3by3(t_H, detH, t_invH);
574  t_F(i, j) = t_h(i, k) * t_invH(k, j);
575  t_small_strain_symm(i, j) = (t_F(i, j) || t_F(j, i)) / 2.;
576  ++t_H;
577  }
578 
579  t_small_strain_symm(0, 0) -= 1;
580  t_small_strain_symm(1, 1) -= 1;
581  t_small_strain_symm(2, 2) -= 1;
582 
583  // symmetric tensors need improvement
584  t_stress_symm(i, j) = t_D(i, j, k, l) * t_small_strain_symm(k, l);
585  tensor_to_tensor(t_stress_symm, t_stress);
586  tensor_to_tensor(t_small_strain_symm, t_small_strain);
587 
588  t_disp(i) = t_spat_pos(i) - t_mesh_node_pos(i);
589 
590  const double psi = 0.5 * t_stress_symm(i, j) * t_small_strain_symm(i, j);
591 
592  CHKERR postProcMesh.tag_set_data(th_psi, &mapGaussPts[gg], 1, &psi);
593  CHKERR postProcMesh.tag_set_data(th_stress, &mapGaussPts[gg], 1,
594  &t_stress(0, 0));
595  CHKERR postProcMesh.tag_set_data(th_strain, &mapGaussPts[gg], 1,
596  &t_small_strain(0, 0));
597  CHKERR postProcMesh.tag_set_data(th_disp, &mapGaussPts[gg], 1, &t_disp(0));
598 
599  ++t_h;
600  ++t_spat_pos;
601  ++t_mesh_node_pos;
602  }
603 
605 }

Member Data Documentation

◆ blockSetsPtr

template<class ELEMENT >
map<int, BlockData>& HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >::blockSetsPtr

◆ dataAtPts

template<class ELEMENT >
boost::shared_ptr<DataAtIntegrationPts> HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >::dataAtPts

◆ isALE

◆ isFieldDisp

template<class ELEMENT >
bool HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >::isFieldDisp

◆ mapGaussPts

template<class ELEMENT >
std::vector<EntityHandle>& HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >::mapGaussPts

◆ postProcMesh

template<class ELEMENT >
moab::Interface& HookeInternalStressElement::OpPostProcHookeElement< ELEMENT >::postProcMesh

The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
FTensor::Tensor1< double, 3 >
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
FTensor::Tensor2< double, 3, 3 >
HookeInternalStressElement::OpPostProcHookeElement::blockSetsPtr
map< int, BlockData > & blockSetsPtr
Definition: HookeInternalStressElement.hpp:145
MoFEM::invertTensor3by3
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
Definition: Templates.hpp:1588
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
convert.type
type
Definition: convert.py:64
HookeInternalStressElement::OpPostProcHookeElement::mapGaussPts
std::vector< EntityHandle > & mapGaussPts
Definition: HookeInternalStressElement.hpp:147
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
HookeInternalStressElement::OpPostProcHookeElement::isFieldDisp
bool isFieldDisp
Definition: HookeInternalStressElement.hpp:149
HookeInternalStressElement::OpPostProcHookeElement::postProcMesh
moab::Interface & postProcMesh
Definition: HookeInternalStressElement.hpp:146
FTensor::Index< 'i', 3 >
MoFEM::determinantTensor3by3
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:1540
HookeInternalStressElement::OpPostProcHookeElement::isALE
bool isALE
Definition: HookeInternalStressElement.hpp:148
MAT_TO_DDG
#define MAT_TO_DDG(SM)
Definition: HookeElement.hpp:142
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Ddg
Definition: Ddg_value.hpp:7
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
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
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROW
@ OPROW
operator doWork function is executed on FE rows
Definition: ForcesAndSourcesCore.hpp:567
HookeInternalStressElement::OpPostProcHookeElement::dataAtPts
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
Definition: HookeInternalStressElement.hpp:143