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 1078 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 1084 of file EshelbianPlasticity.hpp.

1088  : VolUserDataOperator(field_name, UserDataOperator::OPROW),
1089  postProcMesh(post_proc_mesh), mapGaussPts(map_gauss_pts),
1090  dataAtPts(data_ptr) {}
std::vector< EntityHandle > & mapGaussPts
VolumeElementForcesAndSourcesCore::UserDataOperator VolUserDataOperator
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
moab::Interface & postProcMesh

Member Function Documentation

◆ doWork()

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

Definition at line 2303 of file EshelbianOperators.cpp.

2304  {
2306  if (type != MBVERTEX)
2308 
2309  auto create_tag = [this](const std::string tag_name, const int size) {
2310  double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
2311  Tag th;
2312  CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
2313  th, MB_TAG_CREAT | MB_TAG_SPARSE,
2314  def_VAL);
2315  return th;
2316  };
2317 
2318  Tag th_w = create_tag("SpatialDisplacement", 3);
2319  Tag th_omega = create_tag("Omega", 3);
2320  Tag th_approxP = create_tag("Piola1Stress", 9);
2321  Tag th_sigma = create_tag("CauchyStress", 9);
2322  Tag th_log_u = create_tag("LogSpatialStreach", 9);
2323  Tag th_u = create_tag("SpatialStreach", 9);
2324  Tag th_h = create_tag("h", 9);
2325  Tag th_X = create_tag("X", 3);
2326  Tag th_detF = create_tag("detF", 1);
2327  Tag th_angular_momentum = create_tag("AngularMomentum", 3);
2328 
2329  Tag th_u_eig_vec = create_tag("SpatialStreachEigenVec", 9);
2330  Tag th_u_eig_vals = create_tag("SpatialStreachEigenVals", 3);
2331 
2332  int nb_gauss_pts = data.getN().size1();
2333  if (mapGaussPts.size() != (unsigned int)nb_gauss_pts) {
2334  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2335  "Nb. of integration points is not equal to number points on "
2336  "post-processing mesh");
2337  }
2338 
2339  auto t_w = getFTensor1FromMat<3>(dataAtPts->wAtPts);
2340  auto t_omega = getFTensor1FromMat<3>(dataAtPts->rotAxisAtPts);
2341  auto t_h = getFTensor2FromMat<3, 3>(dataAtPts->hAtPts);
2342  auto t_log_u =
2343  getFTensor2SymmetricFromMat<3>(dataAtPts->logStreachTensorAtPts);
2344  auto t_u = getFTensor2SymmetricFromMat<3>(dataAtPts->streachTensorAtPts);
2345  auto t_R = getFTensor2FromMat<3, 3>(dataAtPts->rotMatAtPts);
2346  auto t_approx_P = getFTensor2FromMat<3, 3>(dataAtPts->approxPAtPts);
2347  auto t_coords = getFTensor1CoordsAtGaussPts();
2348 
2353 
2354  // vectors
2355  VectorDouble3 v(3);
2356  FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
2357  auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
2359  t_v(i) = t_d(i);
2360  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2361  &*v.data().begin());
2363  };
2364 
2365  MatrixDouble3by3 m(3, 3);
2367  &m(0, 0), &m(0, 1), &m(0, 2),
2368 
2369  &m(1, 0), &m(1, 1), &m(1, 2),
2370 
2371  &m(2, 0), &m(2, 1), &m(2, 2));
2372 
2373  auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
2375  t_m(i, j) = t_d(i, j);
2376  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2377  &*m.data().begin());
2379  };
2380 
2381  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
2382 
2383  // vetors
2384  CHKERR save_vec_tag(th_w, t_w, gg);
2385  CHKERR save_vec_tag(th_X, t_coords, gg);
2386  CHKERR save_vec_tag(th_omega, t_omega, gg);
2387 
2388  // tensors
2389  CHKERR save_mat_tag(th_h, t_h, gg);
2390 
2391  FTensor::Tensor2<double, 3, 3> t_log_u_tmp;
2392  for (int ii = 0; ii != 3; ++ii)
2393  for (int jj = 0; jj != 3; ++jj)
2394  t_log_u_tmp(ii, jj) = t_log_u(ii, jj);
2395 
2396  CHKERR save_mat_tag(th_log_u, t_log_u_tmp, gg);
2397 
2399  for (int ii = 0; ii != 3; ++ii)
2400  for (int jj = 0; jj != 3; ++jj)
2401  t_u_tmp(ii, jj) = t_u(ii, jj);
2402 
2403  CHKERR save_mat_tag(th_u, t_u_tmp, gg);
2404  CHKERR save_mat_tag(th_approxP, t_approx_P, gg);
2405 
2406  const double jac = dEterminant(t_h);
2408  t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
2409  CHKERR save_mat_tag(th_sigma, t_cauchy, gg);
2410  CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
2411 
2413  t_PhT(i, k) = t_approx_P(i, j) * t_R(k, j);
2414  FTensor::Tensor1<double, 3> t_leviPRT;
2415  t_leviPRT(k) = levi_civita(i, l, k) * t_PhT(i, l);
2416 
2417  CHKERR postProcMesh.tag_set_data(th_angular_momentum, &mapGaussPts[gg], 1,
2418  &t_leviPRT(0));
2419 
2420  auto get_eiegn_vector_symmetric = [&](auto &t_u) {
2422 
2423  for (int ii = 0; ii != 3; ++ii)
2424  for (int jj = 0; jj != 3; ++jj)
2425  t_m(ii, jj) = t_u(ii, jj);
2426 
2427  VectorDouble3 eigen_values(3);
2428 
2429  // LAPACK - eigenvalues and vectors. Applied twice for initial creates
2430  // memory space
2431  int n = 3, lda = 3, info, lwork = -1;
2432  double wkopt;
2433  info = lapack_dsyev('V', 'U', n, &(m.data()[0]), lda,
2434  &(eigen_values.data()[0]), &wkopt, lwork);
2435  if (info != 0)
2436  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2437  "is something wrong with lapack_dsyev info = %d", info);
2438  lwork = (int)wkopt;
2439  double work[lwork];
2440  info = lapack_dsyev('V', 'U', n, &(m.data()[0]), lda,
2441  &(eigen_values.data()[0]), work, lwork);
2442  if (info != 0)
2443  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2444  "is something wrong with lapack_dsyev info = %d", info);
2445 
2446  CHKERR postProcMesh.tag_set_data(th_u_eig_vec, &mapGaussPts[gg], 1,
2447  &*m.data().begin());
2448  CHKERR postProcMesh.tag_set_data(th_u_eig_vals, &mapGaussPts[gg], 1,
2449  &*eigen_values.data().begin());
2450 
2452  };
2453 
2454  CHKERR get_eiegn_vector_symmetric(t_u);
2455 
2456  ++t_w;
2457  ++t_h;
2458  ++t_log_u;
2459  ++t_u;
2460  ++t_omega;
2461  ++t_R;
2462  ++t_approx_P;
2463  ++t_coords;
2464  }
2465 
2467 }
std::vector< EntityHandle > & mapGaussPts
#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
static Index< 'l', 3 > l
static Index< 'n', 3 > n
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
static Index< 'm', 3 > m
static Index< 'i', 3 > i
static double dEterminant(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:475
static Index< 'j', 3 > j
MatrixBoundedArray< double, 9 > MatrixDouble3by3
Definition: Types.hpp:102
#define CHKERR
Inline error check.
Definition: definitions.h:604
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:92
static Index< 'k', 3 > k
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
moab::Interface & postProcMesh
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

Member Data Documentation

◆ dataAtPts

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

Definition at line 1082 of file EshelbianPlasticity.hpp.

◆ mapGaussPts

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

Definition at line 1081 of file EshelbianPlasticity.hpp.

◆ postProcMesh

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

Definition at line 1080 of file EshelbianPlasticity.hpp.


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