v0.14.0
Public Types | Public Member Functions | Public Attributes | Private 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 Types

using OP = VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator
 

Public Member Functions

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

Public Attributes

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

Private Attributes

int tagSense
 

Detailed Description

Definition at line 846 of file EshelbianPlasticity.hpp.

Member Typedef Documentation

◆ OP

Definition at line 849 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,
int  sense 
)
inline

Definition at line 855 of file EshelbianPlasticity.hpp.

859  : OP(NOSPACE, UserDataOperator::OPSPACE), postProcMesh(post_proc_mesh),
860  mapGaussPts(map_gauss_pts), dataAtPts(data_ptr), tagSense(sense) {}

Member Function Documentation

◆ doWork()

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

Definition at line 1705 of file EshelbianOperators.cpp.

1706  {
1708 
1709  if(tagSense != getSkeletonSense())
1711 
1712  auto create_tag = [this](const std::string tag_name, const int size) {
1713  double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
1714  Tag th;
1715  CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
1716  th, MB_TAG_CREAT | MB_TAG_SPARSE,
1717  def_VAL);
1718  return th;
1719  };
1720 
1721  Tag th_w = create_tag("SpatialDisplacement", 3);
1722  Tag th_omega = create_tag("Omega", 3);
1723  Tag th_approxP = create_tag("Piola1Stress", 9);
1724  Tag th_calcSigma = create_tag("EshelbyStress", 9);
1725  Tag th_sigma = create_tag("CauchyStress", 9);
1726  Tag th_log_u = create_tag("LogSpatialStretch", 9);
1727  Tag th_u = create_tag("SpatialStretch", 9);
1728  Tag th_h = create_tag("h", 9);
1729  Tag th_X = create_tag("X", 3);
1730  Tag th_detF = create_tag("detF", 1);
1731  Tag th_angular_momentum = create_tag("AngularMomentum", 3);
1732 
1733  // Tag th_u_eig_vec = create_tag("SpatialStretchEigenVec", 9);
1734  // Tag th_u_eig_vals = create_tag("SpatialStretchEigenVals", 3);
1735  Tag th_traction = create_tag("traction", 3);
1736 
1737  Tag th_disp = create_tag("H1Displacement", 3);
1738  Tag th_disp_error = create_tag("DisplacementError", 1);
1739  Tag th_lambda_disp = create_tag("ContactDisplacement", 3);
1740 
1741  Tag th_energy = create_tag("Energy", 1);
1742 
1743  auto t_w = getFTensor1FromMat<3>(dataAtPts->wL2AtPts);
1744  auto t_omega = getFTensor1FromMat<3>(dataAtPts->rotAxisAtPts);
1745  auto t_h = getFTensor2FromMat<3, 3>(dataAtPts->hAtPts);
1746  auto t_log_u =
1747  getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchTensorAtPts);
1748  auto t_u = getFTensor2SymmetricFromMat<3>(dataAtPts->stretchTensorAtPts);
1749  auto t_R = getFTensor2FromMat<3, 3>(dataAtPts->rotMatAtPts);
1750  auto t_approx_P = getFTensor2FromMat<3, 3>(dataAtPts->approxPAtPts);
1751  if (dataAtPts->SigmaAtPts.size2() != dataAtPts->approxPAtPts.size2()) {
1752  // that is for case that Eshelby stress is not calculated
1753  dataAtPts->SigmaAtPts.resize(dataAtPts->approxPAtPts.size1(),
1754  dataAtPts->approxPAtPts.size2(), false);
1755  dataAtPts->SigmaAtPts.clear();
1756  }
1757 
1758  auto t_calcSigma_P = getFTensor2FromMat<3, 3>(dataAtPts->SigmaAtPts);
1759  auto t_levi_kirchoff = getFTensor1FromMat<3>(dataAtPts->leviKirchhoffAtPts);
1760  auto t_coords = getFTensor1FromMat<3>(dataAtPts->XH1AtPts);
1761  auto t_normal = getFTensor1NormalsAtGaussPts();
1762  auto t_disp = getFTensor1FromMat<3>(dataAtPts->wH1AtPts);
1763  auto t_lambda_disp = getFTensor1FromMat<3>(dataAtPts->contactL2AtPts);
1764 
1765  if (dataAtPts->energyAtPts.size() == 0) {
1766  // that is for case that energy is not calculated
1767  dataAtPts->energyAtPts.resize(getGaussPts().size2());
1768  dataAtPts->energyAtPts.clear();
1769  }
1770  auto t_energy = getFTensor0FromVec(dataAtPts->energyAtPts);
1771 
1776 
1777  auto set_float_precision = [](const double x) {
1778  if (std::abs(x) < std::numeric_limits<float>::epsilon())
1779  return 0.;
1780  else
1781  return x;
1782  };
1783 
1784  // scalars
1785  auto save_scal_tag = [&](auto &th, auto v, const int gg) {
1787  v = set_float_precision(v);
1788  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, &v);
1790  };
1791 
1792  // vectors
1793  VectorDouble3 v(3);
1794  FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
1795  auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
1797  t_v(i) = t_d(i);
1798  for (auto &a : v.data())
1799  a = set_float_precision(a);
1800  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
1801  &*v.data().begin());
1803  };
1804 
1805  // tensors
1806 
1807  MatrixDouble3by3 m(3, 3);
1809  &m(0, 0), &m(0, 1), &m(0, 2),
1810 
1811  &m(1, 0), &m(1, 1), &m(1, 2),
1812 
1813  &m(2, 0), &m(2, 1), &m(2, 2));
1814 
1815  auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
1817  t_m(i, j) = t_d(i, j);
1818  for (auto &v : m.data())
1819  v = set_float_precision(v);
1820  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
1821  &*m.data().begin());
1823  };
1824 
1825  const auto nb_gauss_pts = getGaussPts().size2();
1826  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
1827 
1828  FTensor::Tensor1<double, 3> t_traction;
1829  t_traction(i) = t_approx_P(i, j) * t_normal(j) / t_normal.l2();
1830 
1831  // vectors
1832  CHKERR save_vec_tag(th_w, t_w, gg);
1833  CHKERR save_vec_tag(th_X, t_coords, gg);
1834  CHKERR save_vec_tag(th_omega, t_omega, gg);
1835  CHKERR save_vec_tag(th_traction, t_traction, gg);
1836 
1837  // tensors
1838  CHKERR save_mat_tag(th_h, t_h, gg);
1839 
1840  FTensor::Tensor2<double, 3, 3> t_log_u_tmp;
1841  for (int ii = 0; ii != 3; ++ii)
1842  for (int jj = 0; jj != 3; ++jj)
1843  t_log_u_tmp(ii, jj) = t_log_u(ii, jj);
1844 
1845  CHKERR save_mat_tag(th_log_u, t_log_u_tmp, gg);
1846 
1848  for (int ii = 0; ii != 3; ++ii)
1849  for (int jj = 0; jj != 3; ++jj)
1850  t_u_tmp(ii, jj) = t_u(ii, jj);
1851 
1852  CHKERR save_mat_tag(th_u, t_u_tmp, gg);
1853  CHKERR save_mat_tag(th_approxP, t_approx_P, gg);
1854  CHKERR save_mat_tag(th_calcSigma, t_calcSigma_P, gg);
1855  CHKERR save_vec_tag(th_disp, t_disp, gg);
1856  CHKERR save_vec_tag(th_lambda_disp, t_lambda_disp, gg);
1857 
1858  double u_error = sqrt((t_disp(i) - t_w(i)) * (t_disp(i) - t_w(i)));
1859  CHKERR save_scal_tag(th_disp_error, u_error, gg);
1860  CHKERR save_scal_tag(th_energy, t_energy, gg);
1861 
1862  const double jac = determinantTensor3by3(t_h);
1864  t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
1865  CHKERR save_mat_tag(th_sigma, t_cauchy, gg);
1866  CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
1867 
1869  t_levi(k) = t_levi_kirchoff(k);
1870  CHKERR postProcMesh.tag_set_data(th_angular_momentum, &mapGaussPts[gg], 1,
1871  &t_levi(0));
1872 
1873  auto get_eiegn_vector_symmetric = [&](auto &t_u) {
1875 
1876  // for (int ii = 0; ii != 3; ++ii)
1877  // for (int jj = 0; jj != 3; ++jj)
1878  // t_m(ii, jj) = t_u(ii, jj);
1879 
1880  // VectorDouble3 eigen_values(3);
1881  // auto t_eigen_values = getFTensor1FromArray<3>(eigen_values);
1882  // if (computeEigenValuesSymmetric(t_m, t_eigen_values) != 0) {
1883  // };
1884 
1885  // CHKERR postProcMesh.tag_set_data(th_u_eig_vec, &mapGaussPts[gg], 1,
1886  // &*m.data().begin());
1887  // CHKERR postProcMesh.tag_set_data(th_u_eig_vals, &mapGaussPts[gg], 1,
1888  // &*eigen_values.data().begin());
1889 
1891  };
1892 
1893  CHKERR get_eiegn_vector_symmetric(t_u);
1894 
1895  ++t_w;
1896  ++t_h;
1897  ++t_log_u;
1898  ++t_u;
1899  ++t_omega;
1900  ++t_R;
1901  ++t_approx_P;
1902  ++t_calcSigma_P;
1903  ++t_levi_kirchoff;
1904  ++t_coords;
1905  ++t_normal;
1906  ++t_disp;
1907  ++t_lambda_disp;
1908  ++t_energy;
1909  }
1910 
1912 }

Member Data Documentation

◆ dataAtPts

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

Definition at line 853 of file EshelbianPlasticity.hpp.

◆ mapGaussPts

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

Definition at line 852 of file EshelbianPlasticity.hpp.

◆ postProcMesh

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

Definition at line 851 of file EshelbianPlasticity.hpp.

◆ tagSense

int EshelbianPlasticity::OpPostProcDataStructure::tagSense
private

Definition at line 865 of file EshelbianPlasticity.hpp.


The documentation for this struct was generated from the following files:
NOSPACE
@ NOSPACE
Definition: definitions.h:83
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
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:852
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:548
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
EshelbianPlasticity::OpPostProcDataStructure::dataAtPts
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
Definition: EshelbianPlasticity.hpp:853
EshelbianPlasticity::OpPostProcDataStructure::OP
VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator OP
Definition: EshelbianPlasticity.hpp:849
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
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
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
EshelbianPlasticity::OpPostProcDataStructure::tagSense
int tagSense
Definition: EshelbianPlasticity.hpp:865
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:851
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