v0.14.0
Public Member Functions | Public Attributes | Private Attributes | List of all members
EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du Struct Reference
Inheritance diagram for EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du:
[legend]
Collaboration diagram for EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du:
[legend]

Public Member Functions

 OpSpatialPhysical_du_du (std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha)
 
MoFEMErrorCode integrate (EntData &row_data, EntData &col_data)
 
MoFEMErrorCode integrateHencky (EntData &row_data, EntData &col_data)
 
MoFEMErrorCode integratePolyconvexHencky (EntData &row_data, EntData &col_data)
 
- Public Member Functions inherited from EshelbianPlasticity::OpAssembleVolume
 OpAssembleVolume (const std::string &field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const char type)
 
 OpAssembleVolume (std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const char type, const bool assemble_symmetry)
 
- Public Member Functions inherited from EshelbianPlasticity::OpAssembleBasic< VolUserDataOperator >
 OpAssembleBasic (const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const char type)
 
 OpAssembleBasic (std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const char type, const bool assemble_symmetry, ScaleOff scale_off=[]() { return 1;})
 
virtual MoFEMErrorCode integrate (EntData &data)
 
virtual MoFEMErrorCode integrate (int row_side, EntityType row_type, EntData &data)
 
virtual MoFEMErrorCode assemble (EntData &data)
 
virtual MoFEMErrorCode assemble (int row_side, EntityType row_type, EntData &data)
 
virtual MoFEMErrorCode assemble (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 

Public Attributes

const double alphaU
 
- Public Attributes inherited from EshelbianPlasticity::OpAssembleBasic< VolUserDataOperator >
const bool assembleSymmetry
 
boost::shared_ptr< DataAtIntegrationPtsdataAtPts
 data at integration pts More...
 
VectorDouble nF
 local right hand side vector More...
 
MatrixDouble K
 local tangent matrix More...
 
MatrixDouble transposeK
 
ScaleOff scaleOff
 

Private Attributes

PetscBool polyConvex = PETSC_FALSE
 
MatrixDouble dP
 

Additional Inherited Members

- Public Types inherited from EshelbianPlasticity::OpAssembleBasic< VolUserDataOperator >
using ScaleOff = boost::function< double()>
 

Detailed Description

Definition at line 103 of file Hencky.cpp.

Constructor & Destructor Documentation

◆ OpSpatialPhysical_du_du()

EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::OpSpatialPhysical_du_du ( std::string  row_field,
std::string  col_field,
boost::shared_ptr< DataAtIntegrationPts data_ptr,
const double  alpha 
)

Definition at line 451 of file Hencky.cpp.

454  : OpAssembleVolume(row_field, col_field, data_ptr, OPROWCOL, false),
455  alphaU(alpha) {
456  sYmm = false;
457 
458  CHK_MOAB_THROW(PetscOptionsGetBool(PETSC_NULL, "", "-poly_convex",
459  &polyConvex, PETSC_NULL),
460  "get polyconvex option failed");
461 }

Member Function Documentation

◆ integrate()

MoFEMErrorCode EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::integrate ( EntData row_data,
EntData col_data 
)
virtual

Reimplemented from EshelbianPlasticity::OpAssembleBasic< VolUserDataOperator >.

Definition at line 464 of file Hencky.cpp.

465  {
467 
468  if (polyConvex) {
469  CHKERR integratePolyconvexHencky(row_data, col_data);
470  } else {
471  CHKERR integrateHencky(row_data, col_data);
472  }
474 }

◆ integrateHencky()

MoFEMErrorCode EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::integrateHencky ( EntData row_data,
EntData col_data 
)

Definition at line 477 of file Hencky.cpp.

478  {
480 
483  auto t_L = symm_L_tensor();
484  auto t_diff = diff_tensor();
485 
486  int nb_integration_pts = row_data.getN().size1();
487  int row_nb_dofs = row_data.getIndices().size();
488  int col_nb_dofs = col_data.getIndices().size();
489 
490  auto get_ftensor2 = [](MatrixDouble &m, const int r, const int c) {
492  size_symm>(
493 
494  &m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2), &m(r + 0, c + 3),
495  &m(r + 0, c + 4), &m(r + 0, c + 5),
496 
497  &m(r + 1, c + 0), &m(r + 1, c + 1), &m(r + 1, c + 2), &m(r + 1, c + 3),
498  &m(r + 1, c + 4), &m(r + 1, c + 5),
499 
500  &m(r + 2, c + 0), &m(r + 2, c + 1), &m(r + 2, c + 2), &m(r + 2, c + 3),
501  &m(r + 2, c + 4), &m(r + 2, c + 5),
502 
503  &m(r + 3, c + 0), &m(r + 3, c + 1), &m(r + 3, c + 2), &m(r + 3, c + 3),
504  &m(r + 3, c + 4), &m(r + 3, c + 5),
505 
506  &m(r + 4, c + 0), &m(r + 4, c + 1), &m(r + 4, c + 2), &m(r + 4, c + 3),
507  &m(r + 4, c + 4), &m(r + 4, c + 5),
508 
509  &m(r + 5, c + 0), &m(r + 5, c + 1), &m(r + 5, c + 2), &m(r + 5, c + 3),
510  &m(r + 5, c + 4), &m(r + 5, c + 5)
511 
512  );
513  };
520 
521  auto v = getVolume();
522  auto t_w = getFTensor0IntegrationWeight();
523 
524  auto t_approx_P_adjont_dstretch =
525  getFTensor2FromMat<3, 3>(dataAtPts->adjointPdstretchAtPts);
526  auto t_eigen_vals = getFTensor1FromMat<3>(dataAtPts->eigenVals);
527  auto t_eigen_vecs = getFTensor2FromMat<3, 3>(dataAtPts->eigenVecs);
528  auto &nbUniq = dataAtPts->nbUniq;
529 
530  int row_nb_base_functions = row_data.getN().size2();
531  auto t_row_base_fun = row_data.getFTensor0N();
532 
533  auto get_dP = [&]() {
534  dP.resize(size_symm * size_symm, nb_integration_pts, false);
535  auto ts_a = getTSa();
536 
537  auto t_D = getFTensor4DdgFromPtr<3, 3, 0>(&*dataAtPts->matD.data().begin());
539  t_dP_tmp(L, J) = -(1 + alphaU * ts_a) *
540  (t_L(i, j, L) *
541  ((t_D(i, j, m, n) * t_diff(m, n, k, l)) * t_L(k, l, J)));
542 
544  auto t_approx_P_adjont_dstretch =
545  getFTensor2FromMat<3, 3>(dataAtPts->adjointPdstretchAtPts);
546  auto t_eigen_vals = getFTensor1FromMat<3>(dataAtPts->eigenVals);
547  auto t_eigen_vecs = getFTensor2FromMat<3, 3>(dataAtPts->eigenVecs);
548  auto &nbUniq = dataAtPts->nbUniq;
549 
550  auto t_dP = getFTensor2FromMat<size_symm, size_symm>(dP);
551  for (auto gg = 0; gg != nb_integration_pts; ++gg) {
552 
553  // Work of symmetric tensor on undefined tensor is equal to the work
554  // of the symmetric part of it
556  t_sym(i, j) = (t_approx_P_adjont_dstretch(i, j) ||
557  t_approx_P_adjont_dstretch(j, i));
558  t_sym(i, j) /= 2.0;
559  auto t_diff2_uP2 = EigenMatrix::getDiffDiffMat(
560  t_eigen_vals, t_eigen_vecs, EshelbianCore::f, EshelbianCore::d_f,
561  EshelbianCore::dd_f, t_sym, nbUniq[gg]);
562  t_dP(L, J) = t_L(i, j, L) *
563  ((t_diff2_uP2(i, j, k, l) + t_diff2_uP2(k, l, i, j)) *
564  t_L(k, l, J)) /
565  2. +
566  t_dP_tmp(L, J);
567 
568  ++t_dP;
569  ++t_approx_P_adjont_dstretch;
570  ++t_eigen_vals;
571  ++t_eigen_vecs;
572  }
573  } else {
574  auto t_dP = getFTensor2FromMat<size_symm, size_symm>(dP);
575  for (auto gg = 0; gg != nb_integration_pts; ++gg) {
576  t_dP(L, J) = t_dP_tmp(L, J);
577  ++t_dP;
578  }
579  }
580 
581  return getFTensor2FromMat<size_symm, size_symm>(dP);
582  };
583 
584  auto t_dP = get_dP();
585  for (int gg = 0; gg != nb_integration_pts; ++gg) {
586  double a = v * t_w;
587 
588  int rr = 0;
589  for (; rr != row_nb_dofs / 6; ++rr) {
590  auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
591  auto t_m = get_ftensor2(K, 6 * rr, 0);
592  for (int cc = 0; cc != col_nb_dofs / 6; ++cc) {
593  const double b = a * t_row_base_fun * t_col_base_fun;
594  t_m(L, J) += b * t_dP(L, J);
595  ++t_m;
596  ++t_col_base_fun;
597  }
598  ++t_row_base_fun;
599  }
600 
601  for (; rr != row_nb_base_functions; ++rr) {
602  ++t_row_base_fun;
603  }
604 
605  ++t_w;
606  ++t_dP;
607  }
609 }

◆ integratePolyconvexHencky()

MoFEMErrorCode EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::integratePolyconvexHencky ( EntData row_data,
EntData col_data 
)

Definition at line 611 of file Hencky.cpp.

612  {
614 
617  auto t_L = symm_L_tensor();
618  auto t_diff = diff_tensor();
619 
620  int nb_integration_pts = row_data.getN().size1();
621  int row_nb_dofs = row_data.getIndices().size();
622  int col_nb_dofs = col_data.getIndices().size();
623 
624  auto get_ftensor2 = [](MatrixDouble &m, const int r, const int c) {
626  size_symm>(
627 
628  &m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2), &m(r + 0, c + 3),
629  &m(r + 0, c + 4), &m(r + 0, c + 5),
630 
631  &m(r + 1, c + 0), &m(r + 1, c + 1), &m(r + 1, c + 2), &m(r + 1, c + 3),
632  &m(r + 1, c + 4), &m(r + 1, c + 5),
633 
634  &m(r + 2, c + 0), &m(r + 2, c + 1), &m(r + 2, c + 2), &m(r + 2, c + 3),
635  &m(r + 2, c + 4), &m(r + 2, c + 5),
636 
637  &m(r + 3, c + 0), &m(r + 3, c + 1), &m(r + 3, c + 2), &m(r + 3, c + 3),
638  &m(r + 3, c + 4), &m(r + 3, c + 5),
639 
640  &m(r + 4, c + 0), &m(r + 4, c + 1), &m(r + 4, c + 2), &m(r + 4, c + 3),
641  &m(r + 4, c + 4), &m(r + 4, c + 5),
642 
643  &m(r + 5, c + 0), &m(r + 5, c + 1), &m(r + 5, c + 2), &m(r + 5, c + 3),
644  &m(r + 5, c + 4), &m(r + 5, c + 5)
645 
646  );
647  };
654 
655  auto v = getVolume();
656  auto t_w = getFTensor0IntegrationWeight();
657 
658  int row_nb_base_functions = row_data.getN().size2();
659  auto t_row_base_fun = row_data.getFTensor0N();
660 
661  auto get_dP = [&]() {
662  dP.resize(size_symm * size_symm, nb_integration_pts, false);
663  auto ts_a = getTSa();
664 
665  auto t_D = getFTensor4DdgFromPtr<3, 3, 0>(&*dataAtPts->matD.data().begin());
666 
667  constexpr double nohat_k = 1. / 4;
668  constexpr double hat_k = 1. / 8;
669  double mu = dataAtPts->mu;
670  double lambda = dataAtPts->lambda;
671 
672  constexpr double third = boost::math::constants::third<double>();
674  auto t_diff_deviator = diff_deviator(diff_tensor());
675 
676  auto t_approx_P_adjont_dstretch =
677  getFTensor2FromMat<3, 3>(dataAtPts->adjointPdstretchAtPts);
678  auto t_log_stretch_h1 =
679  getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchTotalTensorAtPts);
680  auto t_eigen_vals = getFTensor1FromMat<3>(dataAtPts->eigenVals);
681  auto t_eigen_vecs = getFTensor2FromMat<3, 3>(dataAtPts->eigenVecs);
682  auto &nbUniq = dataAtPts->nbUniq;
683 
684  auto t_dP = getFTensor2FromMat<size_symm, size_symm>(dP);
685  for (auto gg = 0; gg != nb_integration_pts; ++gg) {
686 
687  double log_det = t_log_stretch_h1(i, i);
688  double log_det2 = log_det * log_det;
690  t_dev(i, j) = t_log_stretch_h1(i, j) - t_kd(i, j) * (third * log_det);
691  double dev_norm2 = t_dev(i, j) * t_dev(i, j);
692 
693  auto A = 2 * mu * std::exp(nohat_k * dev_norm2);
694  auto B = lambda * std::exp(hat_k * log_det2) * log_det;
695 
696  FTensor::Tensor2_symmetric<double, 3> t_A_diff, t_B_diff;
697  t_A_diff(i, j) =
698  (A * 2 * nohat_k) * (t_dev(k, l) * t_diff_deviator(k, l, i, j));
699  t_B_diff(i, j) = (B * 2 * hat_k) * log_det * t_kd(i, j) +
700  lambda * std::exp(hat_k * log_det2) * t_kd(i, j);
702  t_dT(i, j, k, l) =
703  t_A_diff(i, j) * (t_dev(m, n) * t_diff_deviator(m, n, k, l))
704 
705  +
706 
707  A * t_diff_deviator(m, n, i, j) * t_diff_deviator(m, n, k, l)
708 
709  +
710 
711  t_B_diff(i, j) * t_kd(k, l);
712 
713  t_dP(L, J) = -t_L(i, j, L) *
714  ((
715 
716  t_dT(i, j, k, l)
717 
718  +
719 
720  (alphaU * ts_a) * (t_D(i, j, m, n) * t_diff(m, n, k, l)
721 
722  )) *
723  t_L(k, l, J));
724 
725  // Work of symmetric tensor on undefined tensor is equal to the work
726  // of the symmetric part of it
729  t_sym(i, j) = (t_approx_P_adjont_dstretch(i, j) ||
730  t_approx_P_adjont_dstretch(j, i));
731  t_sym(i, j) /= 2.0;
732  auto t_diff2_uP2 = EigenMatrix::getDiffDiffMat(
733  t_eigen_vals, t_eigen_vecs, EshelbianCore::f, EshelbianCore::d_f,
734  EshelbianCore::dd_f, t_sym, nbUniq[gg]);
735  t_dP(L, J) += t_L(i, j, L) *
736  ((t_diff2_uP2(i, j, k, l) + t_diff2_uP2(k, l, i, j)) *
737  t_L(k, l, J)) /
738  2.;
739  }
740 
741  ++t_dP;
742  ++t_approx_P_adjont_dstretch;
743  ++t_log_stretch_h1;
744  ++t_eigen_vals;
745  ++t_eigen_vecs;
746  }
747 
748  return getFTensor2FromMat<size_symm, size_symm>(dP);
749  };
750 
751  auto t_dP = get_dP();
752  for (int gg = 0; gg != nb_integration_pts; ++gg) {
753  double a = v * t_w;
754 
755  int rr = 0;
756  for (; rr != row_nb_dofs / 6; ++rr) {
757  auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
758  auto t_m = get_ftensor2(K, 6 * rr, 0);
759  for (int cc = 0; cc != col_nb_dofs / 6; ++cc) {
760  const double b = a * t_row_base_fun * t_col_base_fun;
761  t_m(L, J) += b * t_dP(L, J);
762  ++t_m;
763  ++t_col_base_fun;
764  }
765  ++t_row_base_fun;
766  }
767 
768  for (; rr != row_nb_base_functions; ++rr) {
769  ++t_row_base_fun;
770  }
771 
772  ++t_w;
773  ++t_dP;
774  }
776 }

Member Data Documentation

◆ alphaU

const double EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::alphaU

Definition at line 104 of file Hencky.cpp.

◆ dP

MatrixDouble EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::dP
private

Definition at line 116 of file Hencky.cpp.

◆ polyConvex

PetscBool EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::polyConvex = PETSC_FALSE
private

Definition at line 114 of file Hencky.cpp.


The documentation for this struct was generated from the following file:
EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::integratePolyconvexHencky
MoFEMErrorCode integratePolyconvexHencky(EntData &row_data, EntData &col_data)
Definition: Hencky.cpp:611
CHK_MOAB_THROW
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:589
EshelbianPlasticity::LINEAR
@ LINEAR
Definition: EshelbianPlasticity.hpp:44
EshelbianPlasticity::size_symm
constexpr static auto size_symm
Definition: EshelbianAux.hpp:39
EshelbianPlasticity::EshelbianCore::dd_f
static boost::function< double(const double)> dd_f
Definition: EshelbianPlasticity.hpp:905
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
EshelbianPlasticity::diff_tensor
auto diff_tensor()
Definition: EshelbianAux.hpp:41
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
J
FTensor::Index< 'J', DIM1 > J
Definition: level_set.cpp:30
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
EshelbianPlasticity::EshelbianCore::d_f
static boost::function< double(const double)> d_f
Definition: EshelbianPlasticity.hpp:904
sdf.r
int r
Definition: sdf.py:8
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::alphaU
const double alphaU
Definition: Hencky.cpp:104
MoFEM::EntitiesFieldData::EntData::getFTensor0N
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
Definition: EntitiesFieldData.hpp:1502
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::integrateHencky
MoFEMErrorCode integrateHencky(EntData &row_data, EntData &col_data)
Definition: Hencky.cpp:477
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
a
constexpr double a
Definition: approx_sphere.cpp:30
EshelbianPlasticity::EshelbianCore::stretchSelector
static enum StretchSelector stretchSelector
Definition: EshelbianPlasticity.hpp:898
EshelbianPlasticity::EshelbianCore::f
static boost::function< double(const double)> f
Definition: EshelbianPlasticity.hpp:903
MoFEM::EntitiesFieldData::EntData::getIndices
const VectorInt & getIndices() const
Get global indices of dofs on entity.
Definition: EntitiesFieldData.hpp:1214
MoFEM::L
VectorDouble L
Definition: Projection10NodeCoordsOnField.cpp:124
EshelbianPlasticity::OpAssembleBasic< VolUserDataOperator >::dataAtPts
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
data at integration pts
Definition: EshelbianPlasticity.hpp:412
EshelbianPlasticity::diff_deviator
auto diff_deviator(FTensor::Ddg< double, 3, 3 > &&t_diff_stress)
Definition: EshelbianAux.hpp:12
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
t_kd
constexpr auto t_kd
Definition: free_surface.cpp:137
EshelbianPlasticity::symm_L_tensor
auto symm_L_tensor()
Definition: EshelbianAux.hpp:52
FTensor::Index
Definition: Index.hpp:23
EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::polyConvex
PetscBool polyConvex
Definition: Hencky.cpp:114
convert.n
n
Definition: convert.py:82
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
MoFEM::EntitiesFieldData::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: EntitiesFieldData.hpp:1318
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Ddg< double, 3, 3 >
mu
double mu
Definition: dynamic_first_order_con_law.cpp:98
lambda
static double lambda
Definition: incompressible_elasticity.cpp:199
EigenMatrix::getDiffDiffMat
FTensor::Ddg< double, 3, 3 > getDiffDiffMat(Val< double, 3 > &t_val, Vec< double, 3 > &t_vec, Fun< double > f, Fun< double > d_f, Fun< double > dd_f, FTensor::Tensor2< double, 3, 3 > &t_S, const int nb)
Definition: MatrixFunction.cpp:78
EshelbianPlasticity::HMHHencky::OpSpatialPhysical_du_du::dP
MatrixDouble dP
Definition: Hencky.cpp:116
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
FTensor::Kronecker_Delta_symmetric
Kronecker Delta class symmetric.
Definition: Kronecker_Delta.hpp:49
EshelbianPlasticity::OpAssembleVolume::OpAssembleVolume
OpAssembleVolume(const std::string &field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const char type)
Definition: EshelbianPlasticity.hpp:518
third
constexpr double third
Definition: EshelbianADOL-C.cpp:17
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
EshelbianPlasticity::OpAssembleBasic< VolUserDataOperator >::K
MatrixDouble K
local tangent matrix
Definition: EshelbianPlasticity.hpp:427
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
MoFEM::PetscOptionsGetBool
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:182