v0.14.0
Public Member Functions | Public Attributes | List of all members
ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp > Struct Template Reference

#include <tutorials/adv-1/src/ContactOps.hpp>

Inheritance diagram for ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >:
[legend]
Collaboration diagram for ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >:
[legend]

Public Member Functions

 OpConstrainBoundaryLhs_dUImpl (const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< CommonData > common_data_ptr, bool is_axisymmetric=false)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 

Public Attributes

SurfaceDistanceFunction surfaceDistanceFunction = surface_distance_function
 
GradSurfaceDistanceFunction gradSurfaceDistanceFunction
 
HessSurfaceDistanceFunction hessSurfaceDistanceFunction
 
boost::shared_ptr< CommonDatacommonDataPtr
 
bool isAxisymmetric
 

Detailed Description

template<int DIM, typename AssemblyBoundaryEleOp>
struct ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >

Definition at line 511 of file ContactOps.hpp.

Constructor & Destructor Documentation

◆ OpConstrainBoundaryLhs_dUImpl()

template<int DIM, typename AssemblyBoundaryEleOp >
ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::OpConstrainBoundaryLhs_dUImpl ( const std::string  row_field_name,
const std::string  col_field_name,
boost::shared_ptr< CommonData common_data_ptr,
bool  is_axisymmetric = false 
)

Definition at line 950 of file ContactOps.hpp.

954  : AssemblyBoundaryEleOp(row_field_name, col_field_name,
955  AssemblyBoundaryEleOp::OPROWCOL),
956  commonDataPtr(common_data_ptr), isAxisymmetric(is_axisymmetric) {
957  AssemblyBoundaryEleOp::sYmm = false;
958 }

Member Function Documentation

◆ iNtegrate()

template<int DIM, typename AssemblyBoundaryEleOp >
MoFEMErrorCode ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::iNtegrate ( EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)
Examples
ContactOps.hpp.

Definition at line 962 of file ContactOps.hpp.

964  {
966 
970 
971  const size_t nb_gauss_pts = AssemblyBoundaryEleOp::getGaussPts().size2();
972  auto &locMat = AssemblyBoundaryEleOp::locMat;
973 
974  auto t_normal_at_pts = AssemblyBoundaryEleOp::getFTensor1NormalsAtGaussPts();
975  auto t_traction = getFTensor1FromMat<DIM>(commonDataPtr->contactTraction);
976  auto t_coords = AssemblyBoundaryEleOp::getFTensor1CoordsAtGaussPts();
977 
978  auto t_w = AssemblyBoundaryEleOp::getFTensor0IntegrationWeight();
979  auto t_row_base = row_data.getFTensor1N<3>();
980  size_t nb_face_functions = row_data.getN().size2() / 3;
981 
982  constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
983 
984  auto m_spatial_coords = get_spatial_coords(
985  BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
986  getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
987  auto m_normals_at_pts = get_normalize_normals(
988  BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
989 
990  auto t_normal = getFTensor1FromMat<3>(m_normals_at_pts);
991 
992  auto ts_time = AssemblyBoundaryEleOp::getTStime();
993  auto ts_time_step = AssemblyBoundaryEleOp::getTStimeStep();
994 
995  // placeholder to pass boundary block id to python
996  int block_id = 0;
997 
998  auto v_sdf =
999  surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
1000  m_spatial_coords, m_normals_at_pts, block_id);
1001 
1002  auto m_grad_sdf =
1003  gradSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
1004  m_spatial_coords, m_normals_at_pts, block_id);
1005 
1006  auto m_hess_sdf =
1007  hessSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
1008  m_spatial_coords, m_normals_at_pts, block_id);
1009 
1010  auto t_sdf = getFTensor0FromVec(v_sdf);
1011  auto t_grad_sdf = getFTensor1FromMat<3>(m_grad_sdf);
1012  auto t_hess_sdf = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
1013 
1014  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1015 
1016  double jacobian = 1.;
1017  if (isAxisymmetric) {
1018  jacobian = 2. * M_PI * t_coords(0);
1019  }
1020  const double alpha = t_w * jacobian * AssemblyBoundaryEleOp::getMeasure();
1021 
1022  auto tn = -t_traction(i) * t_grad_sdf(i);
1023  auto c = constrain(t_sdf, tn);
1024 
1026  t_cP(i, j) = (c * t_grad_sdf(i)) * t_grad_sdf(j);
1028  t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
1029 
1031  t_res_dU(i, j) = kronecker_delta(i, j) + t_cP(i, j);
1032 
1033  if (c > 0) {
1034  t_res_dU(i, j) +=
1035  (c * cn_contact) *
1036  (t_hess_sdf(i, j) * (t_grad_sdf(k) * t_traction(k)) +
1037  t_grad_sdf(i) * t_hess_sdf(k, j) * t_traction(k)) +
1038  c * t_sdf * t_hess_sdf(i, j);
1039  }
1040 
1041  size_t rr = 0;
1042  for (; rr != AssemblyBoundaryEleOp::nbRows / DIM; ++rr) {
1043 
1044  auto t_mat = getFTensor2FromArray<DIM, DIM, DIM>(locMat, DIM * rr);
1045 
1046  const double row_base = t_row_base(i) * t_normal(i);
1047 
1048  auto t_col_base = col_data.getFTensor0N(gg, 0);
1049  for (size_t cc = 0; cc != AssemblyBoundaryEleOp::nbCols / DIM; ++cc) {
1050  const double beta = alpha * row_base * t_col_base;
1051 
1052  t_mat(i, j) -= beta * t_res_dU(i, j);
1053 
1054  ++t_col_base;
1055  ++t_mat;
1056  }
1057 
1058  ++t_row_base;
1059  }
1060  for (; rr < nb_face_functions; ++rr)
1061  ++t_row_base;
1062 
1063  ++t_traction;
1064  ++t_coords;
1065  ++t_w;
1066  ++t_normal;
1067  ++t_sdf;
1068  ++t_grad_sdf;
1069  ++t_hess_sdf;
1070  }
1071 
1073 }

Member Data Documentation

◆ commonDataPtr

template<int DIM, typename AssemblyBoundaryEleOp >
boost::shared_ptr<CommonData> ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::commonDataPtr

Definition at line 526 of file ContactOps.hpp.

◆ gradSurfaceDistanceFunction

template<int DIM, typename AssemblyBoundaryEleOp >
GradSurfaceDistanceFunction ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::gradSurfaceDistanceFunction
Initial value:

Definition at line 521 of file ContactOps.hpp.

◆ hessSurfaceDistanceFunction

template<int DIM, typename AssemblyBoundaryEleOp >
HessSurfaceDistanceFunction ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::hessSurfaceDistanceFunction
Initial value:

Definition at line 523 of file ContactOps.hpp.

◆ isAxisymmetric

template<int DIM, typename AssemblyBoundaryEleOp >
bool ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::isAxisymmetric

Definition at line 527 of file ContactOps.hpp.

◆ surfaceDistanceFunction

template<int DIM, typename AssemblyBoundaryEleOp >
SurfaceDistanceFunction ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::surfaceDistanceFunction = surface_distance_function

Definition at line 520 of file ContactOps.hpp.


The documentation for this struct was generated from the following file:
ContactOps::get_spatial_coords
auto get_spatial_coords(FTensor::Tensor1< T1, DIM1 > &&t_coords, FTensor::Tensor1< T2, DIM2 > &&t_disp, size_t nb_gauss_pts)
Definition: ContactOps.hpp:414
ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::commonDataPtr
boost::shared_ptr< CommonData > commonDataPtr
Definition: ContactOps.hpp:526
ContactOps::hess_surface_distance_function
MatrixDouble hess_surface_distance_function(double delta_t, double t, int nb_gauss_pts, MatrixDouble &m_spatial_coords, MatrixDouble &m_normals_at_pts, int block_id)
Definition: ContactOps.hpp:338
ContactOps::constrain
double constrain(double sdf, double tn)
constrain function
Definition: ContactOps.hpp:603
is_axisymmetric
PetscBool is_axisymmetric
Definition: contact.cpp:93
FTensor::Kronecker_Delta
Kronecker Delta class.
Definition: Kronecker_Delta.hpp:15
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::gradSurfaceDistanceFunction
GradSurfaceDistanceFunction gradSurfaceDistanceFunction
Definition: ContactOps.hpp:521
ContactOps::get_normalize_normals
auto get_normalize_normals(FTensor::Tensor1< T1, DIM1 > &&t_normal_at_pts, size_t nb_gauss_pts)
Definition: ContactOps.hpp:431
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
ContactOps::AssemblyBoundaryEleOp
FormsIntegrators< BoundaryEleOp >::Assembly< A >::OpBase AssemblyBoundaryEleOp
Definition: EshelbianContact.hpp:18
ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::isAxisymmetric
bool isAxisymmetric
Definition: ContactOps.hpp:527
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
FTensor::Index< 'i', DIM >
ContactOps::cn_contact
double cn_contact
Definition: contact.cpp:100
ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::hessSurfaceDistanceFunction
HessSurfaceDistanceFunction hessSurfaceDistanceFunction
Definition: ContactOps.hpp:523
FTensor::kronecker_delta
Tensor2_Expr< Kronecker_Delta< T >, T, Dim0, Dim1, i, j > kronecker_delta(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
Rank 2.
Definition: Kronecker_Delta.hpp:81
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
ContactOps::grad_surface_distance_function
MatrixDouble grad_surface_distance_function(double delta_t, double t, int nb_gauss_pts, MatrixDouble &m_spatial_coords, MatrixDouble &m_normals_at_pts, int block_id)
Definition: ContactOps.hpp:281
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
ContactOps::OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >::surfaceDistanceFunction
SurfaceDistanceFunction surfaceDistanceFunction
Definition: ContactOps.hpp:520
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359