v0.13.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
EshelbianPlasticity::OpTractionBc Struct Reference

#include <users_modules/eshelbian_plasticty/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 615 of file EshelbianPlasticity.hpp.

Constructor & Destructor Documentation

◆ OpTractionBc()

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

Definition at line 616 of file EshelbianPlasticity.hpp.

617 : FaceUserDataOperator(row_field, FaceUserDataOperator::OPROW),
618 bcFe(bc_fe) {}
FaceElementForcesAndSourcesCore::UserDataOperator FaceUserDataOperator

Member Function Documentation

◆ doWork()

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

Definition at line 676 of file EshelbianOperators.cpp.

676 {
678
681
682 auto t_normal = getFTensor1Normal();
683 const double nrm2 = sqrt(t_normal(i) * t_normal(i));
684 FTensor::Tensor1<double, 3> t_unit_normal;
685 t_unit_normal(i) = t_normal(i) / nrm2;
686 int nb_dofs = data.getFieldData().size();
687 int nb_integration_pts = data.getN().size1();
688 int nb_base_functions = data.getN().size2() / 3;
689 double ts_t = getFEMethod()->ts_t;
690
691 auto integrate_matrix = [&]() {
693
694 auto t_w = getFTensor0IntegrationWeight();
695 matPP.resize(nb_dofs / 3, nb_dofs / 3, false);
696 matPP.clear();
697
698 auto t_row_base_fun = data.getFTensor1N<3>();
699 for (int gg = 0; gg != nb_integration_pts; ++gg) {
700
701 int rr = 0;
702 for (; rr != nb_dofs / 3; ++rr) {
703 const double a = t_row_base_fun(i) * t_unit_normal(i);
704 auto t_col_base_fun = data.getFTensor1N<3>(gg, 0);
705 for (int cc = 0; cc != nb_dofs / 3; ++cc) {
706 const double b = t_col_base_fun(i) * t_unit_normal(i);
707 matPP(rr, cc) += t_w * a * b;
708 ++t_col_base_fun;
709 }
710 ++t_row_base_fun;
711 }
712
713 for (; rr != nb_base_functions; ++rr)
714 ++t_row_base_fun;
715
716 ++t_w;
717 }
718
720 };
721
722 auto integrate_rhs = [&](auto &bc) {
724
725 auto t_w = getFTensor0IntegrationWeight();
726 vecPv.resize(3, nb_dofs / 3, false);
727 vecPv.clear();
728
729 auto t_row_base_fun = data.getFTensor1N<3>();
730 double ts_t = getFEMethod()->ts_t;
731
732 for (int gg = 0; gg != nb_integration_pts; ++gg) {
733 int rr = 0;
734 for (; rr != nb_dofs / 3; ++rr) {
735 const double t = ts_t * t_w * t_row_base_fun(i) * t_unit_normal(i);
736 for (int dd = 0; dd != 3; ++dd)
737 if (bc.flags[dd])
738 vecPv(dd, rr) += t * bc.vals[dd];
739 ++t_row_base_fun;
740 }
741 for (; rr != nb_base_functions; ++rr)
742 ++t_row_base_fun;
743 ++t_w;
744 }
746 };
747
748 auto integrate_rhs_cook = [&](auto &bc) {
750
751 vecPv.resize(3, nb_dofs / 3, false);
752 vecPv.clear();
753
754 auto t_w = getFTensor0IntegrationWeight();
755 auto t_row_base_fun = data.getFTensor1N<3>();
756 auto t_coords = getFTensor1CoordsAtGaussPts();
757
758 for (int gg = 0; gg != nb_integration_pts; ++gg) {
759
760 auto calc_tau = [](double y) {
761 y -= 44;
762 y /= (60 - 44);
763 return -y * (y - 1) / 0.25;
764 };
765
766 const double tau = calc_tau(t_coords(1));
767
768 int rr = 0;
769 for (; rr != nb_dofs / 3; ++rr) {
770 const double t = ts_t * t_w * t_row_base_fun(i) * t_unit_normal(i);
771 for (int dd = 0; dd != 3; ++dd)
772 if (bc.flags[dd])
773 vecPv(dd, rr) += t * tau * bc.vals[dd];
774 ++t_row_base_fun;
775 }
776
777 for (; rr != nb_base_functions; ++rr)
778 ++t_row_base_fun;
779 ++t_w;
780 ++t_coords;
781 }
783 };
784
785 // get entity of face
786 EntityHandle fe_ent = getFEEntityHandle();
787 for (auto &bc : *(bcFe.bcData)) {
788 if (bc.faces.find(fe_ent) != bc.faces.end()) {
789
790 int nb_dofs = data.getFieldData().size();
791 if (nb_dofs) {
792
793 CHKERR integrate_matrix();
794 if (bc.blockName.compare(20, 4, "COOK") == 0)
795 CHKERR integrate_rhs_cook(bc);
796 else
797 CHKERR integrate_rhs(bc);
798
799 const auto info =
800 lapack_dposv('L', nb_dofs / 3, 3, &*matPP.data().begin(),
801 nb_dofs / 3, &*vecPv.data().begin(), nb_dofs / 3);
802 if (info > 0)
803 SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
804 "The leading minor of order %i is "
805 "not positive; definite;\nthe "
806 "solution could not be computed",
807 info);
808
809 for (int dd = 0; dd != 3; ++dd)
810 if (bc.flags[dd])
811 for (int rr = 0; rr != nb_dofs / 3; ++rr)
812 data.getFieldDofs()[3 * rr + dd]->getFieldData() = vecPv(dd, rr);
813 }
814 }
815 }
816
818}
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
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34
#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< 'i', SPACE_DIM > i
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
FTensor::Index< 'j', 3 > j
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
constexpr double t
plate stiffness
Definition: plate.cpp:59
boost::shared_ptr< TractionBcVec > bcData
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorDouble & getFieldData() const
get dofs values
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
const VectorDofs & getFieldDofs() const
get dofs data stature FEDofEntity

Member Data Documentation

◆ bcFe

FeTractionBc& EshelbianPlasticity::OpTractionBc::bcFe
protected
Examples
EshelbianOperators.cpp.

Definition at line 622 of file EshelbianPlasticity.hpp.

◆ matPP

MatrixDouble EshelbianPlasticity::OpTractionBc::matPP
protected
Examples
EshelbianOperators.cpp.

Definition at line 623 of file EshelbianPlasticity.hpp.

◆ vecPv

MatrixDouble EshelbianPlasticity::OpTractionBc::vecPv
protected
Examples
EshelbianOperators.cpp.

Definition at line 624 of file EshelbianPlasticity.hpp.


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