v0.10.0
Public Member Functions | Public Attributes | List of all members
EshelbianPlasticity::OpPostProcDataStructure Struct Reference

#include <users_modules/eshelbian_plasticty/src/EshelbianPlasticity.hpp>

Inherits VolUserDataOperator.

Public Member Functions

 OpPostProcDataStructure (moab::Interface &post_proc_mesh, std::vector< EntityHandle > &map_gauss_pts, const std::string field_name, boost::shared_ptr< DataAtIntegrationPts > &data_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Public Attributes

moab::Interface & postProcMesh
 
std::vector< EntityHandle > & mapGaussPts
 
boost::shared_ptr< DataAtIntegrationPtsdataAtPts
 

Detailed Description

Definition at line 1046 of file EshelbianPlasticity.hpp.

Constructor & Destructor Documentation

◆ OpPostProcDataStructure()

EshelbianPlasticity::OpPostProcDataStructure::OpPostProcDataStructure ( moab::Interface &  post_proc_mesh,
std::vector< EntityHandle > &  map_gauss_pts,
const std::string  field_name,
boost::shared_ptr< DataAtIntegrationPts > &  data_ptr 
)

Definition at line 1052 of file EshelbianPlasticity.hpp.

1056  : VolUserDataOperator(field_name, UserDataOperator::OPROW),
1057  postProcMesh(post_proc_mesh), mapGaussPts(map_gauss_pts),
1058  dataAtPts(data_ptr) {}

Member Function Documentation

◆ doWork()

MoFEMErrorCode EshelbianPlasticity::OpPostProcDataStructure::doWork ( int  side,
EntityType  type,
EntData data 
)

Definition at line 2065 of file EshelbianOperators.cpp.

2066  {
2068  if (type != MBVERTEX)
2070 
2071  auto create_tag = [this](const std::string tag_name, const int size) {
2072  double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
2073  Tag th;
2074  CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
2075  th, MB_TAG_CREAT | MB_TAG_SPARSE,
2076  def_VAL);
2077  return th;
2078  };
2079 
2080  Tag th_w = create_tag("SpatialDisplacement", 3);
2081  Tag th_omega = create_tag("Omega", 3);
2082  Tag th_approxP = create_tag("Piola1Stress", 9);
2083  Tag th_sigma = create_tag("CauchyStress", 9);
2084  Tag th_log_u = create_tag("LogSpatialStreach", 9);
2085  Tag th_u = create_tag("SpatialStreach", 9);
2086  Tag th_h = create_tag("h", 9);
2087  Tag th_X = create_tag("X", 3);
2088  Tag th_detF = create_tag("detF", 1);
2089  Tag th_angular_momentum = create_tag("AngularMomentum", 3);
2090 
2091  Tag th_u_eig_vec = create_tag("SpatialStreachEigenVec", 9);
2092  Tag th_u_eig_vals = create_tag("SpatialStreachEigenVals", 3);
2093 
2094  int nb_gauss_pts = data.getN().size1();
2095  if (mapGaussPts.size() != (unsigned int)nb_gauss_pts) {
2096  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2097  "Nb. of integration points is not equal to number points on "
2098  "post-processing mesh");
2099  }
2100 
2101  auto t_w = getFTensor1FromMat<3>(dataAtPts->wAtPts);
2102  auto t_omega = getFTensor1FromMat<3>(dataAtPts->rotAxisAtPts);
2103  auto t_h = getFTensor2FromMat<3, 3>(dataAtPts->hAtPts);
2104  auto t_log_u =
2105  getFTensor2SymmetricFromMat<3>(dataAtPts->logStreachTensorAtPts);
2106  auto t_u = getFTensor2SymmetricFromMat<3>(dataAtPts->streachTensorAtPts);
2107  auto t_R = getFTensor2FromMat<3, 3>(dataAtPts->rotMatAtPts);
2108  auto t_approx_P = getFTensor2FromMat<3, 3>(dataAtPts->approxPAtPts);
2109  auto t_coords = getFTensor1CoordsAtGaussPts();
2110 
2115 
2116  // vectors
2117  VectorDouble3 v(3);
2118  FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
2119  auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
2121  t_v(i) = t_d(i);
2122  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2123  &*v.data().begin());
2125  };
2126 
2127  MatrixDouble3by3 m(3, 3);
2129  &m(0, 0), &m(0, 1), &m(0, 2),
2130 
2131  &m(1, 0), &m(1, 1), &m(1, 2),
2132 
2133  &m(2, 0), &m(2, 1), &m(2, 2));
2134 
2135  auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
2137  t_m(i, j) = t_d(i, j);
2138  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2139  &*m.data().begin());
2141  };
2142 
2143  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
2144 
2145  // vetors
2146  CHKERR save_vec_tag(th_w, t_w, gg);
2147  CHKERR save_vec_tag(th_X, t_coords, gg);
2148  CHKERR save_vec_tag(th_omega, t_omega, gg);
2149 
2150  // tensors
2151  CHKERR save_mat_tag(th_h, t_h, gg);
2152 
2153  FTensor::Tensor2<double, 3, 3> t_log_u_tmp;
2154  for (int ii = 0; ii != 3; ++ii)
2155  for (int jj = 0; jj != 3; ++jj)
2156  t_log_u_tmp(ii, jj) = t_log_u(ii, jj);
2157 
2158  CHKERR save_mat_tag(th_log_u, t_log_u_tmp, gg);
2159 
2161  for (int ii = 0; ii != 3; ++ii)
2162  for (int jj = 0; jj != 3; ++jj)
2163  t_u_tmp(ii, jj) = t_u(ii, jj);
2164 
2165  CHKERR save_mat_tag(th_u, t_u_tmp, gg);
2166  CHKERR save_mat_tag(th_approxP, t_approx_P, gg);
2167 
2168  const double jac = dEterminant(t_h);
2170  t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
2171  CHKERR save_mat_tag(th_sigma, t_cauchy, gg);
2172  CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
2173 
2175  t_PhT(i, k) = t_approx_P(i, j) * t_R(k, j);
2176  FTensor::Tensor1<double, 3> t_leviPRT;
2177  t_leviPRT(k) = levi_civita(i, l, k) * t_PhT(i, l);
2178 
2179  CHKERR postProcMesh.tag_set_data(th_angular_momentum, &mapGaussPts[gg], 1,
2180  &t_leviPRT(0));
2181 
2182  auto get_eiegn_vector_symmetric = [&](auto &t_u) {
2184 
2185  for (int ii = 0; ii != 3; ++ii)
2186  for (int jj = 0; jj != 3; ++jj)
2187  t_m(ii, jj) = t_u(ii, jj);
2188 
2189  VectorDouble3 eigen_values(3);
2190 
2191  // LAPACK - eigenvalues and vectors. Applied twice for initial creates
2192  // memory space
2193  int n = 3, lda = 3, info, lwork = -1;
2194  double wkopt;
2195  info = lapack_dsyev('V', 'U', n, &(m.data()[0]), lda,
2196  &(eigen_values.data()[0]), &wkopt, lwork);
2197  if (info != 0)
2198  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2199  "is something wrong with lapack_dsyev info = %d", info);
2200  lwork = (int)wkopt;
2201  double work[lwork];
2202  info = lapack_dsyev('V', 'U', n, &(m.data()[0]), lda,
2203  &(eigen_values.data()[0]), work, lwork);
2204  if (info != 0)
2205  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2206  "is something wrong with lapack_dsyev info = %d", info);
2207 
2208  CHKERR postProcMesh.tag_set_data(th_u_eig_vec, &mapGaussPts[gg], 1,
2209  &*m.data().begin());
2210  CHKERR postProcMesh.tag_set_data(th_u_eig_vals, &mapGaussPts[gg], 1,
2211  &*eigen_values.data().begin());
2212 
2214  };
2215 
2216  CHKERR get_eiegn_vector_symmetric(t_u);
2217 
2218  ++t_w;
2219  ++t_h;
2220  ++t_log_u;
2221  ++t_u;
2222  ++t_omega;
2223  ++t_R;
2224  ++t_approx_P;
2225  ++t_coords;
2226  }
2227 
2229 }

Member Data Documentation

◆ dataAtPts

boost::shared_ptr<DataAtIntegrationPts> EshelbianPlasticity::OpPostProcDataStructure::dataAtPts

Definition at line 1050 of file EshelbianPlasticity.hpp.

◆ mapGaussPts

std::vector<EntityHandle>& EshelbianPlasticity::OpPostProcDataStructure::mapGaussPts

Definition at line 1049 of file EshelbianPlasticity.hpp.

◆ postProcMesh

moab::Interface& EshelbianPlasticity::OpPostProcDataStructure::postProcMesh

Definition at line 1048 of file EshelbianPlasticity.hpp.


The documentation for this struct was generated from the following files:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
FTensor::Tensor2
Definition: Tensor2_value.hpp:17
n
static Index< 'n', 3 > n
Definition: BasicFeTools.hpp:78
FTensor::Tensor1
Definition: Tensor1_value.hpp:9
m
static Index< 'm', 3 > m
Definition: BasicFeTools.hpp:77
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:604
convert.type
type
Definition: convert.py:66
FTensor::Index< 'i', 3 >
FTensor::levi_civita
constexpr std::enable_if<(Dim0<=2 &&Dim1<=2), Tensor2_Expr< Levi_Civita< T >, T, Dim0, Dim1, i, j > >::type levi_civita(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
levi_civita functions to make for easy adhoc use
Definition: Levi_Civita.hpp:617
EshelbianPlasticity::OpPostProcDataStructure::dataAtPts
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
Definition: EshelbianPlasticity.hpp:1050
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
lapack_dsyev
static __CLPK_integer lapack_dsyev(char jobz, char uplo, __CLPK_integer n, __CLPK_doublereal *a, __CLPK_integer lda, __CLPK_doublereal *w, __CLPK_doublereal *work, __CLPK_integer lwork)
Definition: lapack_wrap.h:273
MoFEM::Types::MatrixDouble3by3
MatrixBoundedArray< double, 9 > MatrixDouble3by3
Definition: Types.hpp:102
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:123
MoFEM::DataForcesAndSourcesCore::EntData::getN
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
Definition: DataStructures.hpp:1288
MoFEM::Types::VectorDouble3
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:92
EshelbianPlasticity::OpPostProcDataStructure::postProcMesh
moab::Interface & postProcMesh
Definition: EshelbianPlasticity.hpp:1048
MoFEM::dEterminant
static double dEterminant(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:875
i
FTensor::Index< 'i', 3 > i
Definition: matrix_function.cpp:18
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
EshelbianPlasticity::OpPostProcDataStructure::mapGaussPts
std::vector< EntityHandle > & mapGaussPts
Definition: EshelbianPlasticity.hpp:1049
EshelbianPlasticity::VolUserDataOperator
VolumeElementForcesAndSourcesCore::UserDataOperator VolUserDataOperator
Definition: EshelbianPlasticity.hpp:35
convert.int
int
Definition: convert.py:66
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21