22HookeElement::OpCalculateStrainAle::OpCalculateStrainAle(
23 const std::string row_field,
const std::string col_field,
24 boost::shared_ptr<DataAtIntegrationPts> &data_at_pts)
26 dataAtPts(data_at_pts) {
38 const int nb_integration_pts = getGaussPts().size2();
39 auto t_h = getFTensor2FromMat<3, 3>(*dataAtPts->hMat);
40 auto t_H = getFTensor2FromMat<3, 3>(*dataAtPts->HMat);
42 dataAtPts->detHVec->resize(nb_integration_pts,
false);
43 dataAtPts->invHMat->resize(9, nb_integration_pts,
false);
44 dataAtPts->FMat->resize(9, nb_integration_pts,
false);
45 dataAtPts->smallStrainMat->resize(6, nb_integration_pts,
false);
52 *dataAtPts->smallStrainMat);
54 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
57 t_F(
i,
j) = t_h(
i,
k) * t_invH(
k,
j);
58 t_strain(
i,
j) = (t_F(
i,
j) || t_F(
j,
i)) / 2.;
74HookeElement::OpCalculateEnergy::OpCalculateEnergy(
75 const std::string row_field,
const std::string col_field,
76 boost::shared_ptr<DataAtIntegrationPts> data_at_pts,
79 dataAtPts(data_at_pts), ghostVec(ghost_vec, true) {
89 const int nb_integration_pts = getGaussPts().size2();
91 *(dataAtPts->smallStrainMat));
92 auto t_cauchy_stress =
94 *(dataAtPts->cauchyStressMat));
95 dataAtPts->energyVec->resize(nb_integration_pts,
false);
97 &*(dataAtPts->energyVec->data().begin()));
102 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
103 t_energy = (t_strain(
i,
j) * t_cauchy_stress(
i,
j)) / 2.;
109 if (ghostVec.get()) {
111 double vol = getVolume();
113 auto t_w = getFTensor0IntegrationWeight();
114 auto &det_H = *dataAtPts->detHVec;
116 &*(dataAtPts->energyVec->data().begin()));
118 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
120 double a = t_w * vol;
124 energy +=
a * t_energy;
128 CHKERR VecSetValue(ghostVec, 0, energy, ADD_VALUES);
134HookeElement::OpCalculateEshelbyStress::OpCalculateEshelbyStress(
135 const std::string row_field,
const std::string col_field,
136 boost::shared_ptr<DataAtIntegrationPts> data_at_pts)
138 dataAtPts(data_at_pts) {
143 int row_side, EntityType row_type,
EntData &row_data) {
146 const int nb_integration_pts = getGaussPts().size2();
148 &*(dataAtPts->energyVec->data().begin()));
149 auto t_cauchy_stress =
151 *(dataAtPts->cauchyStressMat));
154 dataAtPts->eshelbyStressMat->resize(9, nb_integration_pts,
false);
155 auto t_eshelby_stress =
157 *(dataAtPts->eshelbyStressMat));
163 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
164 t_eshelby_stress(
i,
j) = -t_F(
k,
i) * t_cauchy_stress(
k,
j);
165 t_eshelby_stress(0, 0) += t_energy;
166 t_eshelby_stress(1, 1) += t_energy;
167 t_eshelby_stress(2, 2) += t_energy;
176HookeElement::OpAssemble::OpAssemble(
177 const std::string row_field,
const std::string col_field,
178 boost::shared_ptr<DataAtIntegrationPts> data_at_pts,
const char type,
181 dataAtPts(data_at_pts) {}
207 K.resize(nbRows, nbCols,
false);
211 nbIntegrationPts = getGaussPts().size2();
213 if (row_side == col_side && row_type == col_type) {
220 CHKERR iNtegrate(row_data, col_data);
223 CHKERR aSsemble(row_data, col_data);
239 nF.resize(nbRows,
false);
243 nbIntegrationPts = getGaussPts().size2();
246 CHKERR iNtegrate(row_data);
249 CHKERR aSsemble(row_data);
272 const int *row_indices = &*row_data.
getIndices().data().begin();
274 const int *col_indices = &*col_data.
getIndices().data().begin();
276 auto &data = *dataAtPts;
277 if (!data.forcesOnlyOnEntitiesRow.empty()) {
278 rowIndices.resize(nbRows,
false);
280 row_indices = &rowIndices[0];
282 VectorDofs::iterator dit = dofs.begin();
283 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
284 if (data.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
285 data.forcesOnlyOnEntitiesRow.end()) {
291 if (!data.forcesOnlyOnEntitiesCol.empty()) {
292 colIndices.resize(nbCols,
false);
294 col_indices = &colIndices[0];
296 VectorDofs::iterator dit = dofs.begin();
297 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
298 if (data.forcesOnlyOnEntitiesCol.find((*dit)->getEnt()) ==
299 data.forcesOnlyOnEntitiesCol.end()) {
305 Mat
B = getFEMethod()->ksp_B != PETSC_NULLPTR ? getFEMethod()->ksp_B
306 : getFEMethod()->snes_B;
309 &*
K.data().begin(), ADD_VALUES);
311 if (!isDiag && sYmm) {
314 transK.resize(
K.size2(),
K.size1(),
false);
315 noalias(transK) = trans(
K);
317 &*transK.data().begin(), ADD_VALUES);
326 const int *row_indices = &*row_data.
getIndices().data().begin();
328 auto &data = *dataAtPts;
329 if (!data.forcesOnlyOnEntitiesRow.empty()) {
330 rowIndices.resize(nbRows,
false);
332 row_indices = &rowIndices[0];
334 VectorDofs::iterator dit = dofs.begin();
335 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
336 if (data.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
337 data.forcesOnlyOnEntitiesRow.end()) {
343 Vec
F = getFEMethod()->snes_f;
349HookeElement::OpRhs_dx::OpRhs_dx(
350 const std::string row_field,
const std::string col_field,
351 boost::shared_ptr<DataAtIntegrationPts> &data_at_pts)
352 :
OpAssemble(row_field, col_field, data_at_pts, OPROW) {}
359 &
v(r + 0), &
v(r + 1), &
v(r + 2));
368 double vol = getVolume();
370 auto t_w = getFTensor0IntegrationWeight();
374 const int row_nb_base_fun = row_data.
getN().size2();
375 auto t_cauchy_stress =
377 *dataAtPts->cauchyStressMat);
380 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
383 double a = t_w * vol;
384 auto t_nf = get_tensor1(nF, 0);
387 for (; rr != nbRows / 3; ++rr) {
388 t_nf(
i) +=
a * t_row_diff_base(
j) * t_cauchy_stress(
i,
j);
393 for (; rr != row_nb_base_fun; ++rr)
403HookeElement::OpAleRhs_dx::OpAleRhs_dx(
404 const std::string row_field,
const std::string col_field,
405 boost::shared_ptr<DataAtIntegrationPts> &data_at_pts)
406 :
OpAssemble(row_field, col_field, data_at_pts, OPROW) {}
413 &
v(r + 0), &
v(r + 1), &
v(r + 2));
420 double vol = getVolume();
422 auto t_w = getFTensor0IntegrationWeight();
426 const int row_nb_base_fun = row_data.
getN().size2();
427 auto t_cauchy_stress =
429 *dataAtPts->cauchyStressMat);
430 auto &det_H = *dataAtPts->detHVec;
435 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
438 double a = t_w * vol * det_H[gg];
439 auto t_nf = get_tensor1(nF, 0);
442 for (; rr != nbRows / 3; ++rr) {
444 t_row_diff_base_pulled(
i) = t_row_diff_base(
j) * t_invH(
j,
i);
445 t_nf(
i) +=
a * t_row_diff_base_pulled(
j) * t_cauchy_stress(
i,
j);
450 for (; rr != row_nb_base_fun; ++rr)
461HookeElement::OpAleRhs_dX::OpAleRhs_dX(
462 const std::string row_field,
const std::string col_field,
463 boost::shared_ptr<DataAtIntegrationPts> &data_at_pts)
464 :
OpAssemble(row_field, col_field, data_at_pts, OPROW) {}
471 &
v(r + 0), &
v(r + 1), &
v(r + 2));
478 double vol = getVolume();
480 auto t_w = getFTensor0IntegrationWeight();
484 const int row_nb_base_fun = row_data.
getN().size2();
485 auto t_eshelby_stress =
487 *dataAtPts->eshelbyStressMat);
488 auto &det_H = *dataAtPts->detHVec;
493 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
496 double a = t_w * vol * det_H[gg];
497 auto t_nf = get_tensor1(nF, 0);
500 for (; rr != nbRows / 3; ++rr) {
502 t_row_diff_base_pulled(
i) = t_row_diff_base(
j) * t_invH(
j,
i);
503 t_nf(
i) +=
a * t_row_diff_base_pulled(
j) * t_eshelby_stress(
i,
j);
508 for (; rr != row_nb_base_fun; ++rr)
521 boost::shared_ptr<map<int, BlockData>> &block_sets_ptr) {
526 "Pointer to block of sets is null");
531 CHKERR it->getAttributeDataStructure(mydata);
532 int id = it->getMeshsetId();
533 auto &block_data = (*block_sets_ptr)[id];
534 EntityHandle meshset = it->getMeshset();
536 block_data.tEts,
true);
538 block_data.E = mydata.
data.Young;
539 block_data.PoissonRatio = mydata.
data.Poisson;
547 boost::shared_ptr<map<int, BlockData>> &block_sets_ptr,
548 const std::string element_name,
const std::string x_field,
549 const std::string X_field,
const bool ale) {
554 "Pointer to block of sets is null");
568 for (
auto &
m : (*block_sets_ptr)) {
577 boost::shared_ptr<ForcesAndSourcesCore> fe_lhs_ptr,
578 boost::shared_ptr<ForcesAndSourcesCore> fe_rhs_ptr,
579 boost::shared_ptr<map<int, BlockData>> block_sets_ptr,
580 const std::string x_field,
const std::string X_field,
const bool ale,
581 const bool field_disp,
const EntityType
type,
582 boost::shared_ptr<DataAtIntegrationPts> data_at_pts) {
587 "Pointer to block of sets is null");
590 data_at_pts = boost::make_shared<DataAtIntegrationPts>();
593 if (ale == PETSC_FALSE) {
594 if (
type == MBPRISM) {
595 boost::shared_ptr<MatrixDouble> inv_jac_ptr(
new MatrixDouble);
596 fe_lhs_ptr->getOpPtrVector().push_back(
598 fe_lhs_ptr->getOpPtrVector().push_back(
601 fe_lhs_ptr->getOpPtrVector().push_back(
603 x_field, x_field, block_sets_ptr, data_at_pts));
604 fe_lhs_ptr->getOpPtrVector().push_back(
607 if (
type == MBPRISM) {
608 boost::shared_ptr<MatrixDouble> inv_jac_ptr(
new MatrixDouble);
609 fe_lhs_ptr->getOpPtrVector().push_back(
611 fe_lhs_ptr->getOpPtrVector().push_back(
614 fe_lhs_ptr->getOpPtrVector().push_back(
616 fe_lhs_ptr->getOpPtrVector().push_back(
618 x_field, x_field, block_sets_ptr, data_at_pts));
619 fe_lhs_ptr->getOpPtrVector().push_back(
621 fe_lhs_ptr->getOpPtrVector().push_back(
623 fe_lhs_ptr->getOpPtrVector().push_back(
625 fe_lhs_ptr->getOpPtrVector().push_back(
627 fe_lhs_ptr->getOpPtrVector().push_back(
629 fe_lhs_ptr->getOpPtrVector().push_back(
631 fe_lhs_ptr->getOpPtrVector().push_back(
633 fe_lhs_ptr->getOpPtrVector().push_back(
635 fe_lhs_ptr->getOpPtrVector().push_back(
637 fe_lhs_ptr->getOpPtrVector().push_back(
644 if (ale == PETSC_FALSE) {
645 if (
type == MBPRISM) {
646 boost::shared_ptr<MatrixDouble> inv_jac_ptr(
new MatrixDouble);
647 fe_rhs_ptr->getOpPtrVector().push_back(
649 fe_rhs_ptr->getOpPtrVector().push_back(
652 fe_rhs_ptr->getOpPtrVector().push_back(
654 fe_rhs_ptr->getOpPtrVector().push_back(
656 block_sets_ptr, data_at_pts));
658 fe_rhs_ptr->getOpPtrVector().push_back(
661 fe_rhs_ptr->getOpPtrVector().push_back(
664 fe_rhs_ptr->getOpPtrVector().push_back(
666 fe_rhs_ptr->getOpPtrVector().push_back(
667 new OpRhs_dx(x_field, x_field, data_at_pts));
669 if (
type == MBPRISM) {
670 boost::shared_ptr<MatrixDouble> inv_jac_ptr(
new MatrixDouble);
671 fe_rhs_ptr->getOpPtrVector().push_back(
673 fe_rhs_ptr->getOpPtrVector().push_back(
676 fe_rhs_ptr->getOpPtrVector().push_back(
678 fe_rhs_ptr->getOpPtrVector().push_back(
680 block_sets_ptr, data_at_pts));
681 fe_rhs_ptr->getOpPtrVector().push_back(
683 fe_rhs_ptr->getOpPtrVector().push_back(
685 fe_rhs_ptr->getOpPtrVector().push_back(
687 fe_rhs_ptr->getOpPtrVector().push_back(
689 fe_rhs_ptr->getOpPtrVector().push_back(
691 fe_rhs_ptr->getOpPtrVector().push_back(
693 fe_rhs_ptr->getOpPtrVector().push_back(
702 DM dm, boost::shared_ptr<map<int, BlockData>> block_sets_ptr,
703 const std::string x_field,
const std::string X_field,
const bool ale,
712 boost::shared_ptr<DataAtIntegrationPts> data_at_pts(
716 boost::make_shared<VolumeElementForcesAndSourcesCore>(*m_field_ptr);
717 fe_ptr->getRuleHook = [](
const double,
const double,
const double o) {
721 if (m_field_ptr->
check_field(
"MESH_NODE_POSITIONS"))
723 "MESH_NODE_POSITIONS");
728 FatPrismElementForcesAndSourcesCore;
733 boost::shared_ptr<ForcesAndSourcesCore> prism_fe_ptr(
736 auto push_ops = [&](boost::shared_ptr<ForcesAndSourcesCore> fe_ptr,
739 boost::shared_ptr<MatrixDouble> inv_jac_ptr(
new MatrixDouble);
740 if (ale == PETSC_FALSE) {
741 if (
type == MBPRISM) {
742 fe_ptr->getOpPtrVector().push_back(
744 fe_ptr->getOpPtrVector().push_back(
747 fe_ptr->getOpPtrVector().push_back(
750 x_field, x_field, block_sets_ptr, data_at_pts));
752 fe_ptr->getOpPtrVector().push_back(
755 fe_ptr->getOpPtrVector().push_back(
758 fe_ptr->getOpPtrVector().push_back(
760 fe_ptr->getOpPtrVector().push_back(
763 if (
type == MBPRISM) {
764 fe_ptr->getOpPtrVector().push_back(
766 fe_ptr->getOpPtrVector().push_back(
769 fe_ptr->getOpPtrVector().push_back(
772 x_field, x_field, block_sets_ptr, data_at_pts));
773 fe_ptr->getOpPtrVector().push_back(
775 fe_ptr->getOpPtrVector().push_back(
777 fe_ptr->getOpPtrVector().push_back(
779 fe_ptr->getOpPtrVector().push_back(
785 CHKERR push_ops(fe_ptr, MBTET);
786 CHKERR push_ops(prism_fe_ptr, MBPRISM);
788 CHKERR VecZeroEntries(v_energy);
794 CHKERR VecAssemblyBegin(v_energy);
795 CHKERR VecAssemblyEnd(v_energy);
806 auto get_tensor2 = [](
MatrixDouble &
m,
const int r,
const int c) {
808 &
m(r + 0,
c + 0), &
m(r + 0,
c + 1), &
m(r + 0,
c + 2), &
m(r + 1,
c + 0),
809 &
m(r + 1,
c + 1), &
m(r + 1,
c + 2), &
m(r + 2,
c + 0), &
m(r + 2,
c + 1),
821 double vol = getVolume();
824 auto t_w = getFTensor0IntegrationWeight();
828 const int row_nb_base_fun = row_data.
getN().size2();
832 auto &det_H = *dataAtPts->detHVec;
834 auto get_eshelby_stress_dx = [
this]() {
838 for (
int ii = 0; ii != 3; ++ii)
839 for (
int jj = 0; jj != 3; ++jj)
840 for (
int kk = 0; kk != 3; ++kk)
841 for (
int ll = 0; ll != 3; ++ll)
842 t_eshelby_stress_dx.ptr(ii, jj, kk, ll) =
843 &(*dataAtPts->eshelbyStress_dx)(mm++, 0);
844 return t_eshelby_stress_dx;
847 auto t_eshelby_stress_dx = get_eshelby_stress_dx();
850 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
853 double a = t_w * vol * det_H[gg];
857 for (; rr != nbRows / 3; ++rr) {
860 auto t_m = get_tensor2(
K, 3 * rr, 0);
863 t_row_diff_base_pulled(
i) = t_row_diff_base(
j) * t_invH(
j,
i);
866 t_row_stress_dx(
i,
k,
l) =
867 a * t_row_diff_base_pulled(
j) * t_eshelby_stress_dx(
i,
j,
k,
l);
873 for (
int cc = 0; cc != nbCols / 3; ++cc) {
875 t_m(
i,
k) += t_row_stress_dx(
i,
k,
l) * t_col_diff_base(
l);
888 for (; rr != row_nb_base_fun; ++rr)
893 ++t_eshelby_stress_dx;
899HookeElement::OpAleLhsWithDensity_dX_dX::OpAleLhsWithDensity_dX_dX(
900 const std::string row_field,
const std::string col_field,
901 boost::shared_ptr<DataAtIntegrationPts> &data_at_pts,
902 boost::shared_ptr<VectorDouble> rho_at_gauss_pts,
903 boost::shared_ptr<MatrixDouble> rho_grad_at_gauss_pts,
const double rho_n,
905 :
OpAssemble(row_field, col_field, data_at_pts, OPROWCOL, false),
906 rhoAtGaussPtsPtr(rho_at_gauss_pts),
907 rhoGradAtGaussPtsPtr(rho_grad_at_gauss_pts), rhoN(rho_n), rHo0(rho_0) {}
910HookeElement::OpAleLhsWithDensity_dX_dX::iNtegrate(
EntData &row_data,
916 auto get_tensor2 = [](
MatrixDouble &
m,
const int r,
const int c) {
918 &
m(r + 0,
c + 0), &
m(r + 0,
c + 1), &
m(r + 0,
c + 2), &
m(r + 1,
c + 0),
919 &
m(r + 1,
c + 1), &
m(r + 1,
c + 2), &
m(r + 2,
c + 0), &
m(r + 2,
c + 1),
929 double vol = getVolume();
932 auto t_w = getFTensor0IntegrationWeight();
936 const int row_nb_base_fun = row_data.
getN().size2();
944 auto t_eshelby_stress =
946 *dataAtPts->eshelbyStressMat);
950 auto &det_H = *dataAtPts->detHVec;
953 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
956 double a = t_w * vol * det_H[gg];
958 const double stress_dho_coef = (rhoN /
rho);
964 for (; rr != nbRows / 3; ++rr) {
967 auto t_m = get_tensor2(
K, 3 * rr, 0);
970 t_row_diff_base_pulled(
i) = t_row_diff_base(
j) * t_invH(
j,
i);
973 t_row_stress(
i) =
a * t_row_diff_base_pulled(
j) * t_eshelby_stress(
i,
j);
980 for (
int cc = 0; cc != nbCols / 3; ++cc) {
983 t_row_stress(
i) * stress_dho_coef * t_grad_rho(
k) * t_col_base;
995 for (; rr != row_nb_base_fun; ++rr)
1009HookeElement::OpAleLhsWithDensity_dx_dX::OpAleLhsWithDensity_dx_dX(
1010 const std::string row_field,
const std::string col_field,
1011 boost::shared_ptr<DataAtIntegrationPts> &data_at_pts,
1012 boost::shared_ptr<VectorDouble> rho_at_gauss_pts,
1013 boost::shared_ptr<MatrixDouble> rho_grad_at_gauss_pts,
const double rho_n,
1015 :
OpAssemble(row_field, col_field, data_at_pts, OPROWCOL, false),
1016 rhoAtGaussPtsPtr(rho_at_gauss_pts),
1017 rhoGradAtGaussPtsPtr(rho_grad_at_gauss_pts), rhoN(rho_n), rHo0(rho_0) {}
1020HookeElement::OpAleLhsWithDensity_dx_dX::iNtegrate(
EntData &row_data,
1026 auto get_tensor2 = [](
MatrixDouble &
m,
const int r,
const int c) {
1028 &
m(r + 0,
c + 0), &
m(r + 0,
c + 1), &
m(r + 0,
c + 2), &
m(r + 1,
c + 0),
1029 &
m(r + 1,
c + 1), &
m(r + 1,
c + 2), &
m(r + 2,
c + 0), &
m(r + 2,
c + 1),
1039 double vol = getVolume();
1042 auto t_w = getFTensor0IntegrationWeight();
1046 const int row_nb_base_fun = row_data.
getN().size2();
1051 auto t_cauchy_stress =
1053 *(dataAtPts->cauchyStressMat));
1057 auto &det_H = *dataAtPts->detHVec;
1060 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
1063 double a = t_w * vol * det_H[gg];
1065 const double stress_dho_coef = (rhoN /
rho);
1069 for (; rr != nbRows / 3; ++rr) {
1072 auto t_m = get_tensor2(
K, 3 * rr, 0);
1075 t_row_diff_base_pulled(
i) = t_row_diff_base(
j) * t_invH(
j,
i);
1078 t_row_stress(
i) =
a * t_row_diff_base_pulled(
j) * t_cauchy_stress(
i,
j);
1083 for (
int cc = 0; cc != nbCols / 3; ++cc) {
1086 t_row_stress(
i) * stress_dho_coef * t_grad_rho(
k) * t_col_base;
1098 for (; rr != row_nb_base_fun; ++rr)
1114HookeElement::OpCalculateStiffnessScaledByDensityField::
1115 OpCalculateStiffnessScaledByDensityField(
1116 const std::string row_field,
const std::string col_field,
1117 boost::shared_ptr<map<int, BlockData>> &block_sets_ptr,
1118 boost::shared_ptr<DataAtIntegrationPts> data_at_pts,
1119 boost::shared_ptr<VectorDouble> rho_at_gauss_pts,
const double rho_n,
1123 blockSetsPtr(block_sets_ptr), dataAtPts(data_at_pts),
1124 rhoAtGaussPtsPtr(rho_at_gauss_pts), rhoN(rho_n), rHo0(rho_0) {
1129 int row_side, EntityType row_type,
EntData &row_data) {
1132 if (!rhoAtGaussPtsPtr)
1133 SETERRQ(PETSC_COMM_SELF, 1,
"Calculate density with MWLS first.");
1135 for (
auto &
m : (*blockSetsPtr)) {
1137 if (
m.second.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
1138 m.second.tEts.end()) {
1142 const int nb_integration_pts = getGaussPts().size2();
1143 dataAtPts->stiffnessMat->resize(36, nb_integration_pts,
false);
1147 const double young =
m.second.E;
1148 const double poisson =
m.second.PoissonRatio;
1153 const double coefficient = young / ((1 + poisson) * (1 - 2 * poisson));
1160 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
1162 t_D(
i,
j,
k,
l) = 0.;
1164 t_D(0, 0, 0, 0) = 1 - poisson;
1165 t_D(1, 1, 1, 1) = 1 - poisson;
1166 t_D(2, 2, 2, 2) = 1 - poisson;
1168 t_D(0, 1, 0, 1) = 0.5 * (1 - 2 * poisson);
1169 t_D(0, 2, 0, 2) = 0.5 * (1 - 2 * poisson);
1170 t_D(1, 2, 1, 2) = 0.5 * (1 - 2 * poisson);
1172 t_D(0, 0, 1, 1) = poisson;
1173 t_D(1, 1, 0, 0) = poisson;
1174 t_D(0, 0, 2, 2) = poisson;
1175 t_D(2, 2, 0, 0) = poisson;
1176 t_D(1, 1, 2, 2) = poisson;
1177 t_D(2, 2, 1, 1) = poisson;
1180 t_D(
i,
j,
k,
l) *= coefficient * pow(
rho / rHo0, rhoN);
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode DMoFEMGetInterfacePtr(DM dm, MoFEM::Interface **m_field_ptr)
Get pointer to MoFEM::Interface.
virtual MoFEMErrorCode add_ents_to_finite_element_by_dim(const EntityHandle entities, const int dim, const std::string name, const bool recursive=true)=0
add entities to finite element
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string name_row)=0
set field col which finite element use
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
virtual bool check_field(const std::string &name) const =0
check if field is in database
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
const double v
phase velocity of light in medium (cm/ns)
const double n
refractive index of diffusive medium
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
auto getFTensor2FromMat(M &data)
Get tensor rank 2 (matrix) form data matrix.
static auto getFTensor2SymmetricFromMat(M &data)
Get symmetric tensor rank 2 (matrix) form data matrix.
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
auto createVectorMPI(MPI_Comm comm, PetscInt n, PetscInt N)
Create MPI Vector.
auto getFTensor1FromMat(M &data, int rr=0, int cc=0)
Get tensor rank 1 (vector) form data matrix.
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
ublas::vector< FEDofEntity *, DofsAllocator > VectorDofs
FTensor::Index< 'm', 3 > m
Add operators pushing bases from local to physical configuration.
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
auto getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorDofs & getFieldDofs() const
Get DOF data structures (const version)
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.
Elastic material data structure.
Calculate inverse of jacobian for face element.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Transform local reference derivatives of shape functions to global derivatives.
intrusive_ptr for managing petsc objects
@ CTX_SNESNONE
No specific SNES context.
int getRuleThroughThickness(int order)
int getRuleTrianglesOnly(int order)