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

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

Inheritance diagram for EshelbianPlasticity::OpPostProcDataStructure:
[legend]
Collaboration diagram for EshelbianPlasticity::OpPostProcDataStructure:
[legend]

Public Member Functions

 OpPostProcDataStructure (moab::Interface &post_proc_mesh, std::vector< EntityHandle > &map_gauss_pts, 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 804 of file EshelbianPlasticity.hpp.

Constructor & Destructor Documentation

◆ OpPostProcDataStructure()

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

Definition at line 810 of file EshelbianPlasticity.hpp.

814  postProcMesh(post_proc_mesh), mapGaussPts(map_gauss_pts),
815  dataAtPts(data_ptr) {}

Member Function Documentation

◆ doWork()

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

Definition at line 2225 of file EshelbianOperators.cpp.

2226  {
2228 
2229  auto create_tag = [this](const std::string tag_name, const int size) {
2230  double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
2231  Tag th;
2232  CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
2233  th, MB_TAG_CREAT | MB_TAG_SPARSE,
2234  def_VAL);
2235  return th;
2236  };
2237 
2238  Tag th_w = create_tag("SpatialDisplacement", 3);
2239  Tag th_omega = create_tag("Omega", 3);
2240  Tag th_approxP = create_tag("Piola1Stress", 9);
2241  Tag th_sigma = create_tag("CauchyStress", 9);
2242  Tag th_log_u = create_tag("LogSpatialStretch", 9);
2243  Tag th_u = create_tag("SpatialStretch", 9);
2244  Tag th_h = create_tag("h", 9);
2245  Tag th_X = create_tag("X", 3);
2246  Tag th_detF = create_tag("detF", 1);
2247  Tag th_angular_momentum = create_tag("AngularMomentum", 3);
2248 
2249  Tag th_u_eig_vec = create_tag("SpatialStretchEigenVec", 9);
2250  Tag th_u_eig_vals = create_tag("SpatialStretchEigenVals", 3);
2251  Tag th_traction = create_tag("traction", 3);
2252 
2253  Tag th_disp = create_tag("H1Displacement", 3);
2254  Tag th_disp_error = create_tag("DisplacementError", 1);
2255  Tag th_lambda_disp = create_tag("ContactDisplacement", 3);
2256 
2257  auto t_w = getFTensor1FromMat<3>(dataAtPts->wL2AtPts);
2258  auto t_omega = getFTensor1FromMat<3>(dataAtPts->rotAxisAtPts);
2259  auto t_h = getFTensor2FromMat<3, 3>(dataAtPts->hAtPts);
2260  auto t_log_u =
2261  getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchTensorAtPts);
2262  auto t_u = getFTensor2SymmetricFromMat<3>(dataAtPts->stretchTensorAtPts);
2263  auto t_R = getFTensor2FromMat<3, 3>(dataAtPts->rotMatAtPts);
2264  auto t_approx_P = getFTensor2FromMat<3, 3>(dataAtPts->approxPAtPts);
2265  auto t_levi_kirchoff = getFTensor1FromMat<3>(dataAtPts->leviKirchhoffAtPts);
2266  auto t_coords = getFTensor1CoordsAtGaussPts();
2267  auto t_normal = getFTensor1NormalsAtGaussPts();
2268  auto t_disp = getFTensor1FromMat<3>(dataAtPts->wH1AtPts);
2269  auto t_lambda_disp = getFTensor1FromMat<3>(dataAtPts->contactL2AtPts);
2270 
2275 
2276  auto set_float_precision = [](const double x) {
2277  if (std::abs(x) < std::numeric_limits<float>::epsilon())
2278  return 0.;
2279  else
2280  return x;
2281  };
2282 
2283  // scalars
2284  auto save_scal_tag = [&](auto &th, auto v, const int gg) {
2286  v = set_float_precision(v);
2287  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, &v);
2289  };
2290 
2291  // vectors
2292  VectorDouble3 v(3);
2293  FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
2294  auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
2296  t_v(i) = t_d(i);
2297  for (auto &a : v.data())
2298  a = set_float_precision(a);
2299  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2300  &*v.data().begin());
2302  };
2303 
2304  // tensors
2305 
2306  MatrixDouble3by3 m(3, 3);
2308  &m(0, 0), &m(0, 1), &m(0, 2),
2309 
2310  &m(1, 0), &m(1, 1), &m(1, 2),
2311 
2312  &m(2, 0), &m(2, 1), &m(2, 2));
2313 
2314  auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
2316  t_m(i, j) = t_d(i, j);
2317  for (auto &v : m.data())
2318  v = set_float_precision(v);
2319  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2320  &*m.data().begin());
2322  };
2323 
2324  const auto nb_gauss_pts = getGaussPts().size2();
2325  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
2326 
2327  FTensor::Tensor1<double, 3> t_traction;
2328  t_traction(i) = t_approx_P(i, j) * t_normal(j) / t_normal.l2();
2329 
2330  // vectors
2331  CHKERR save_vec_tag(th_w, t_w, gg);
2332  CHKERR save_vec_tag(th_X, t_coords, gg);
2333  CHKERR save_vec_tag(th_omega, t_omega, gg);
2334  CHKERR save_vec_tag(th_traction, t_traction, gg);
2335 
2336  // tensors
2337  CHKERR save_mat_tag(th_h, t_h, gg);
2338 
2339  FTensor::Tensor2<double, 3, 3> t_log_u_tmp;
2340  for (int ii = 0; ii != 3; ++ii)
2341  for (int jj = 0; jj != 3; ++jj)
2342  t_log_u_tmp(ii, jj) = t_log_u(ii, jj);
2343 
2344  CHKERR save_mat_tag(th_log_u, t_log_u_tmp, gg);
2345 
2347  for (int ii = 0; ii != 3; ++ii)
2348  for (int jj = 0; jj != 3; ++jj)
2349  t_u_tmp(ii, jj) = t_u(ii, jj);
2350 
2351  CHKERR save_mat_tag(th_u, t_u_tmp, gg);
2352  CHKERR save_mat_tag(th_approxP, t_approx_P, gg);
2353  CHKERR save_vec_tag(th_disp, t_disp, gg);
2354  CHKERR save_vec_tag(th_lambda_disp, t_lambda_disp, gg);
2355 
2356  double u_error = sqrt((t_disp(i) - t_w(i)) * (t_disp(i) - t_w(i)));
2357  CHKERR save_scal_tag(th_disp_error, u_error, gg);
2358 
2359  const double jac = determinantTensor3by3(t_h);
2361  t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
2362  CHKERR save_mat_tag(th_sigma, t_cauchy, gg);
2363  CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
2364 
2366  t_levi(k) = t_levi_kirchoff(k);
2367  CHKERR postProcMesh.tag_set_data(th_angular_momentum, &mapGaussPts[gg], 1,
2368  &t_levi(0));
2369 
2370  auto get_eiegn_vector_symmetric = [&](auto &t_u) {
2372 
2373  for (int ii = 0; ii != 3; ++ii)
2374  for (int jj = 0; jj != 3; ++jj)
2375  t_m(ii, jj) = t_u(ii, jj);
2376 
2377  VectorDouble3 eigen_values(3);
2378  auto t_eigen_values = getFTensor1FromArray<3>(eigen_values);
2379  CHKERR computeEigenValuesSymmetric(t_m, t_eigen_values);
2380 
2381  CHKERR postProcMesh.tag_set_data(th_u_eig_vec, &mapGaussPts[gg], 1,
2382  &*m.data().begin());
2383  CHKERR postProcMesh.tag_set_data(th_u_eig_vals, &mapGaussPts[gg], 1,
2384  &*eigen_values.data().begin());
2385 
2387  };
2388 
2389  CHKERR get_eiegn_vector_symmetric(t_u);
2390 
2391  ++t_w;
2392  ++t_h;
2393  ++t_log_u;
2394  ++t_u;
2395  ++t_omega;
2396  ++t_R;
2397  ++t_approx_P;
2398  ++t_levi_kirchoff;
2399  ++t_coords;
2400  ++t_normal;
2401  ++t_disp;
2402  ++t_lambda_disp;
2403  }
2404 
2406 }

Member Data Documentation

◆ dataAtPts

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

Definition at line 808 of file EshelbianPlasticity.hpp.

◆ mapGaussPts

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

Definition at line 807 of file EshelbianPlasticity.hpp.

◆ postProcMesh

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

Definition at line 806 of file EshelbianPlasticity.hpp.


The documentation for this struct was generated from the following files:
NOSPACE
@ NOSPACE
Definition: definitions.h:83
MoFEM::Types::VectorDouble3
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:92
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPSPACE
@ OPSPACE
operator do Work is execute on space data
Definition: ForcesAndSourcesCore.hpp:570
EshelbianPlasticity::OpPostProcDataStructure::mapGaussPts
std::vector< EntityHandle > & mapGaussPts
Definition: EshelbianPlasticity.hpp:807
FTensor::Tensor1::l2
T l2() const
Definition: Tensor1_value.hpp:84
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
a
constexpr double a
Definition: approx_sphere.cpp:30
EshelbianPlasticity::OpPostProcDataStructure::dataAtPts
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
Definition: EshelbianPlasticity.hpp:808
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
EshelbianPlasticity::FaceUserDataOperator
FaceElementForcesAndSourcesCore::UserDataOperator FaceUserDataOperator
Definition: EshelbianPlasticity.hpp:29
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:1511
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MoFEM::Types::MatrixDouble3by3
MatrixBoundedArray< double, 9 > MatrixDouble3by3
Definition: Types.hpp:105
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
EshelbianPlasticity::OpPostProcDataStructure::postProcMesh
moab::Interface & postProcMesh
Definition: EshelbianPlasticity.hpp:806
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:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
MoFEM::computeEigenValuesSymmetric
MoFEMErrorCode computeEigenValuesSymmetric(const MatrixDouble &mat, VectorDouble &eig, MatrixDouble &eigen_vec)
compute eigenvalues of a symmetric matrix using lapack dsyev
Definition: Templates.hpp:1423