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

#include <users_modules/eshelbian_plasticty/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, 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 764 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 
)
inline

Definition at line 770 of file EshelbianPlasticity.hpp.

774 : FaceUserDataOperator(NOSPACE, UserDataOperator::OPSPACE),
775 postProcMesh(post_proc_mesh), mapGaussPts(map_gauss_pts),
776 dataAtPts(data_ptr) {}
@ NOSPACE
Definition: definitions.h:83
FaceElementForcesAndSourcesCore::UserDataOperator FaceUserDataOperator
moab::Interface & postProcMesh
std::vector< EntityHandle > & mapGaussPts
boost::shared_ptr< DataAtIntegrationPts > dataAtPts

Member Function Documentation

◆ doWork()

MoFEMErrorCode EshelbianPlasticity::OpPostProcDataStructure::doWork ( int  side,
EntityType  type,
EntData data 
)
Examples
EshelbianOperators.cpp.

Definition at line 1894 of file EshelbianOperators.cpp.

1895 {
1897
1898 auto create_tag = [this](const std::string tag_name, const int size) {
1899 double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
1900 Tag th;
1901 CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
1902 th, MB_TAG_CREAT | MB_TAG_SPARSE,
1903 def_VAL);
1904 return th;
1905 };
1906
1907 Tag th_w = create_tag("SpatialDisplacement", 3);
1908 Tag th_omega = create_tag("Omega", 3);
1909 Tag th_approxP = create_tag("Piola1Stress", 9);
1910 Tag th_sigma = create_tag("CauchyStress", 9);
1911 Tag th_log_u = create_tag("LogSpatialStretch", 9);
1912 Tag th_u = create_tag("SpatialStretch", 9);
1913 Tag th_h = create_tag("h", 9);
1914 Tag th_X = create_tag("X", 3);
1915 Tag th_detF = create_tag("detF", 1);
1916 Tag th_angular_momentum = create_tag("AngularMomentum", 3);
1917
1918 Tag th_u_eig_vec = create_tag("SpatialStretchEigenVec", 9);
1919 Tag th_u_eig_vals = create_tag("SpatialStretchEigenVals", 3);
1920 Tag th_traction = create_tag("traction", 3);
1921
1922 Tag th_disp = create_tag("U", 3);
1923 Tag th_disp_error = create_tag("U_ERROR", 1);
1924
1925 auto t_w = getFTensor1FromMat<3>(dataAtPts->wL2AtPts);
1926 auto t_omega = getFTensor1FromMat<3>(dataAtPts->rotAxisAtPts);
1927 auto t_h = getFTensor2FromMat<3, 3>(dataAtPts->hAtPts);
1928 auto t_log_u =
1929 getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchTensorAtPts);
1930 auto t_u = getFTensor2SymmetricFromMat<3>(dataAtPts->stretchTensorAtPts);
1931 auto t_R = getFTensor2FromMat<3, 3>(dataAtPts->rotMatAtPts);
1932 auto t_approx_P = getFTensor2FromMat<3, 3>(dataAtPts->approxPAtPts);
1933 auto t_levi_kirchoff = getFTensor1FromMat<3>(dataAtPts->leviKirchoffAtPts);
1934 auto t_coords = getFTensor1CoordsAtGaussPts();
1935 auto t_normal = getFTensor1NormalsAtGaussPts();
1936 auto t_disp = getFTensor1FromMat<3>(dataAtPts->wH1AtPts);
1937
1942
1943 auto set_float_precision = [](const double x) {
1944 if (std::abs(x) < std::numeric_limits<float>::epsilon())
1945 return 0.;
1946 else
1947 return x;
1948 };
1949
1950 // scalars
1951 auto save_scal_tag = [&](auto &th, auto v, const int gg) {
1953 v = set_float_precision(v);
1954 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, &v);
1956 };
1957
1958 // vectors
1959 VectorDouble3 v(3);
1960 FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
1961 auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
1963 t_v(i) = t_d(i);
1964 for (auto &a : v.data())
1965 a = set_float_precision(a);
1966 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
1967 &*v.data().begin());
1969 };
1970
1971 // tensors
1972
1973 MatrixDouble3by3 m(3, 3);
1975 &m(0, 0), &m(0, 1), &m(0, 2),
1976
1977 &m(1, 0), &m(1, 1), &m(1, 2),
1978
1979 &m(2, 0), &m(2, 1), &m(2, 2));
1980
1981 auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
1983 t_m(i, j) = t_d(i, j);
1984 for (auto &v : m.data())
1985 v = set_float_precision(v);
1986 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
1987 &*m.data().begin());
1989 };
1990
1991 const auto nb_gauss_pts = getGaussPts().size2();
1992 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
1993
1994 FTensor::Tensor1<double, 3> t_traction;
1995 t_traction(i) = t_approx_P(i, j) * t_normal(j) / t_normal.l2();
1996
1997 // vectors
1998 CHKERR save_vec_tag(th_w, t_w, gg);
1999 CHKERR save_vec_tag(th_X, t_coords, gg);
2000 CHKERR save_vec_tag(th_omega, t_omega, gg);
2001 CHKERR save_vec_tag(th_traction, t_traction, gg);
2002
2003 // tensors
2004 CHKERR save_mat_tag(th_h, t_h, gg);
2005
2007 for (int ii = 0; ii != 3; ++ii)
2008 for (int jj = 0; jj != 3; ++jj)
2009 t_log_u_tmp(ii, jj) = t_log_u(ii, jj);
2010
2011 CHKERR save_mat_tag(th_log_u, t_log_u_tmp, gg);
2012
2014 for (int ii = 0; ii != 3; ++ii)
2015 for (int jj = 0; jj != 3; ++jj)
2016 t_u_tmp(ii, jj) = t_u(ii, jj);
2017
2018 CHKERR save_mat_tag(th_u, t_u_tmp, gg);
2019 CHKERR save_mat_tag(th_approxP, t_approx_P, gg);
2020 CHKERR save_vec_tag(th_disp, t_disp, gg);
2021
2022 double u_error = sqrt((t_disp(i) - t_w(i)) * (t_disp(i) - t_w(i)));
2023 CHKERR save_scal_tag(th_disp_error, u_error, gg);
2024
2025 const double jac = determinantTensor3by3(t_h);
2027 t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
2028 CHKERR save_mat_tag(th_sigma, t_cauchy, gg);
2029 CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
2030
2032 t_levi(k) = t_levi_kirchoff(k);
2033 CHKERR postProcMesh.tag_set_data(th_angular_momentum, &mapGaussPts[gg], 1,
2034 &t_levi(0));
2035
2036 auto get_eiegn_vector_symmetric = [&](auto &t_u) {
2038
2039 for (int ii = 0; ii != 3; ++ii)
2040 for (int jj = 0; jj != 3; ++jj)
2041 t_m(ii, jj) = t_u(ii, jj);
2042
2043 VectorDouble3 eigen_values(3);
2044 auto t_eigen_values = getFTensor1FromArray<3>(eigen_values);
2045 CHKERR computeEigenValuesSymmetric(t_m, t_eigen_values);
2046
2047 CHKERR postProcMesh.tag_set_data(th_u_eig_vec, &mapGaussPts[gg], 1,
2048 &*m.data().begin());
2049 CHKERR postProcMesh.tag_set_data(th_u_eig_vals, &mapGaussPts[gg], 1,
2050 &*eigen_values.data().begin());
2051
2053 };
2054
2055 CHKERR get_eiegn_vector_symmetric(t_u);
2056
2057 ++t_w;
2058 ++t_h;
2059 ++t_log_u;
2060 ++t_u;
2061 ++t_omega;
2062 ++t_R;
2063 ++t_approx_P;
2064 ++t_levi_kirchoff;
2065 ++t_coords;
2066 ++t_normal;
2067 ++t_disp;
2068 }
2069
2071}
constexpr double a
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
FTensor::Index< 'm', SPACE_DIM > m
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:92
MoFEMErrorCode computeEigenValuesSymmetric(const MatrixDouble &mat, VectorDouble &eig, MatrixDouble &eigen_vec)
compute eigenvalues of a symmetric matrix using lapack dsyev
Definition: Templates.hpp:1469
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:1557

Member Data Documentation

◆ dataAtPts

boost::shared_ptr<DataAtIntegrationPts> EshelbianPlasticity::OpPostProcDataStructure::dataAtPts
Examples
EshelbianOperators.cpp.

Definition at line 768 of file EshelbianPlasticity.hpp.

◆ mapGaussPts

std::vector<EntityHandle>& EshelbianPlasticity::OpPostProcDataStructure::mapGaussPts
Examples
EshelbianOperators.cpp.

Definition at line 767 of file EshelbianPlasticity.hpp.

◆ postProcMesh

moab::Interface& EshelbianPlasticity::OpPostProcDataStructure::postProcMesh
Examples
EshelbianOperators.cpp.

Definition at line 766 of file EshelbianPlasticity.hpp.


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