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

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

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

Public Member Functions

 OpTractionBc (std::string row_field, FeTractionBc &bc_fe)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Protected Attributes

FeTractionBcbcFe
 
MatrixDouble matPP
 
MatrixDouble vecPv
 

Detailed Description

Definition at line 612 of file EshelbianPlasticity.hpp.

Constructor & Destructor Documentation

◆ OpTractionBc()

EshelbianPlasticity::OpTractionBc::OpTractionBc ( std::string  row_field,
FeTractionBc bc_fe 
)
inline

Definition at line 613 of file EshelbianPlasticity.hpp.

614  : FaceUserDataOperator(row_field, FaceUserDataOperator::OPROW),
615  bcFe(bc_fe) {}

Member Function Documentation

◆ doWork()

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

Definition at line 1083 of file EshelbianOperators.cpp.

1083  {
1085 
1088 
1089  auto t_normal = getFTensor1Normal();
1090  const double nrm2 = sqrt(t_normal(i) * t_normal(i));
1091  FTensor::Tensor1<double, 3> t_unit_normal;
1092  t_unit_normal(i) = t_normal(i) / nrm2;
1093  int nb_dofs = data.getFieldData().size();
1094  int nb_integration_pts = data.getN().size1();
1095  int nb_base_functions = data.getN().size2() / 3;
1096  double ts_t = getFEMethod()->ts_t;
1097 
1098  auto integrate_matrix = [&]() {
1100 
1101  auto t_w = getFTensor0IntegrationWeight();
1102  matPP.resize(nb_dofs / 3, nb_dofs / 3, false);
1103  matPP.clear();
1104 
1105  auto t_row_base_fun = data.getFTensor1N<3>();
1106  for (int gg = 0; gg != nb_integration_pts; ++gg) {
1107 
1108  int rr = 0;
1109  for (; rr != nb_dofs / 3; ++rr) {
1110  const double a = t_row_base_fun(i) * t_unit_normal(i);
1111  auto t_col_base_fun = data.getFTensor1N<3>(gg, 0);
1112  for (int cc = 0; cc != nb_dofs / 3; ++cc) {
1113  const double b = t_col_base_fun(i) * t_unit_normal(i);
1114  matPP(rr, cc) += t_w * a * b;
1115  ++t_col_base_fun;
1116  }
1117  ++t_row_base_fun;
1118  }
1119 
1120  for (; rr != nb_base_functions; ++rr)
1121  ++t_row_base_fun;
1122 
1123  ++t_w;
1124  }
1125 
1127  };
1128 
1129  auto integrate_rhs = [&](auto &bc) {
1131 
1132  auto t_w = getFTensor0IntegrationWeight();
1133  vecPv.resize(3, nb_dofs / 3, false);
1134  vecPv.clear();
1135 
1136  auto t_row_base_fun = data.getFTensor1N<3>();
1137  double ts_t = getFEMethod()->ts_t;
1138 
1139  for (int gg = 0; gg != nb_integration_pts; ++gg) {
1140  int rr = 0;
1141  for (; rr != nb_dofs / 3; ++rr) {
1142  const double t = ts_t * t_w * t_row_base_fun(i) * t_unit_normal(i);
1143  for (int dd = 0; dd != 3; ++dd)
1144  if (bc.flags[dd])
1145  vecPv(dd, rr) += t * bc.vals[dd];
1146  ++t_row_base_fun;
1147  }
1148  for (; rr != nb_base_functions; ++rr)
1149  ++t_row_base_fun;
1150  ++t_w;
1151  }
1153  };
1154 
1155  auto integrate_rhs_cook = [&](auto &bc) {
1157 
1158  vecPv.resize(3, nb_dofs / 3, false);
1159  vecPv.clear();
1160 
1161  auto t_w = getFTensor0IntegrationWeight();
1162  auto t_row_base_fun = data.getFTensor1N<3>();
1163  auto t_coords = getFTensor1CoordsAtGaussPts();
1164 
1165  for (int gg = 0; gg != nb_integration_pts; ++gg) {
1166 
1167  auto calc_tau = [](double y) {
1168  y -= 44;
1169  y /= (60 - 44);
1170  return -y * (y - 1) / 0.25;
1171  };
1172 
1173  const double tau = calc_tau(t_coords(1));
1174 
1175  int rr = 0;
1176  for (; rr != nb_dofs / 3; ++rr) {
1177  const double t = ts_t * t_w * t_row_base_fun(i) * t_unit_normal(i);
1178  for (int dd = 0; dd != 3; ++dd)
1179  if (bc.flags[dd])
1180  vecPv(dd, rr) += t * tau * bc.vals[dd];
1181  ++t_row_base_fun;
1182  }
1183 
1184  for (; rr != nb_base_functions; ++rr)
1185  ++t_row_base_fun;
1186  ++t_w;
1187  ++t_coords;
1188  }
1190  };
1191 
1192  // get entity of face
1193  EntityHandle fe_ent = getFEEntityHandle();
1194  for (auto &bc : *(bcFe.bcData)) {
1195  if (bc.faces.find(fe_ent) != bc.faces.end()) {
1196 
1197  int nb_dofs = data.getFieldData().size();
1198  if (nb_dofs) {
1199 
1200  CHKERR integrate_matrix();
1201  if (std::regex_match(bc.blockName, std::regex(".*COOK.*")))
1202  CHKERR integrate_rhs_cook(bc);
1203  else
1204  CHKERR integrate_rhs(bc);
1205 
1206  const auto info =
1207  lapack_dposv('L', nb_dofs / 3, 3, &*matPP.data().begin(),
1208  nb_dofs / 3, &*vecPv.data().begin(), nb_dofs / 3);
1209  if (info > 0)
1210  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1211  "The leading minor of order %i is "
1212  "not positive; definite;\nthe "
1213  "solution could not be computed",
1214  info);
1215 
1216  for (int dd = 0; dd != 3; ++dd)
1217  if (bc.flags[dd])
1218  for (int rr = 0; rr != nb_dofs / 3; ++rr)
1219  data.getFieldDofs()[3 * rr + dd]->getFieldData() = vecPv(dd, rr);
1220  }
1221  }
1222  }
1223 
1225 }

Member Data Documentation

◆ bcFe

FeTractionBc& EshelbianPlasticity::OpTractionBc::bcFe
protected

Definition at line 619 of file EshelbianPlasticity.hpp.

◆ matPP

MatrixDouble EshelbianPlasticity::OpTractionBc::matPP
protected

Definition at line 620 of file EshelbianPlasticity.hpp.

◆ vecPv

MatrixDouble EshelbianPlasticity::OpTractionBc::vecPv
protected

Definition at line 621 of file EshelbianPlasticity.hpp.


The documentation for this struct was generated from the following files:
FTensor::Tensor1< double, 3 >
EntityHandle
MoFEM::EntitiesFieldData::EntData::getFieldData
const VectorDouble & getFieldData() const
get dofs values
Definition: EntitiesFieldData.hpp:1241
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
a
constexpr double a
Definition: approx_sphere.cpp:30
EshelbianPlasticity::OpTractionBc::vecPv
MatrixDouble vecPv
Definition: EshelbianPlasticity.hpp:621
MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34
MoFEM::EntitiesFieldData::EntData::getFieldDofs
const VectorDofs & getFieldDofs() const
get dofs data stature FEDofEntity
Definition: EntitiesFieldData.hpp:1256
t
constexpr double t
plate stiffness
Definition: plate.cpp:59
EshelbianPlasticity::OpTractionBc::bcFe
FeTractionBc & bcFe
Definition: EshelbianPlasticity.hpp:619
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 >
FTensor::dd
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
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:1305
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MoFEM::EntitiesFieldData::EntData::getFTensor1N
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
Definition: EntitiesFieldData.cpp:640
lapack_dposv
static __CLPK_integer lapack_dposv(char uplo, __CLPK_integer n, __CLPK_integer nrhs, __CLPK_doublereal *a, __CLPK_integer lda, __CLPK_doublereal *b, __CLPK_integer ldb)
Definition: lapack_wrap.h:211
EshelbianPlasticity::OpTractionBc::matPP
MatrixDouble matPP
Definition: EshelbianPlasticity.hpp:620
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
EshelbianPlasticity::FeTractionBc::bcData
boost::shared_ptr< TractionBcVec > bcData
Definition: EshelbianPlasticity.hpp:637
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346