v0.14.0
Public Member Functions | Public Attributes | List of all members
BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs Struct Reference

\biref operator to calculate the LHS for the RVE bounary conditions More...

#include <users_modules/homogenisation/src/BCs_RVELagrange_Trac_Rigid_Trans.hpp>

Inheritance diagram for BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs:
[legend]
Collaboration diagram for BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs:
[legend]

Public Member Functions

 OpRVEBCsLhs (const string field_name, const string lagrang_field_name, Mat aij, RVEBC_Data &data)
 
PetscErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 

Public Attributes

RVEBC_DatadAta
 
Mat Aij
 
MatrixDouble Mat_face
 
MatrixDouble Mat_face_Tran
 

Detailed Description

\biref operator to calculate the LHS for the RVE bounary conditions

Definition at line 24 of file BCs_RVELagrange_Trac_Rigid_Trans.hpp.

Constructor & Destructor Documentation

◆ OpRVEBCsLhs()

BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::OpRVEBCsLhs ( const string  field_name,
const string  lagrang_field_name,
Mat  aij,
RVEBC_Data data 
)
inline

Definition at line 28 of file BCs_RVELagrange_Trac_Rigid_Trans.hpp.

28  :
30  lagrang_field_name,field_name,UserDataOperator::OPROWCOL
31  ),
32  dAta(data),Aij(aij) {
33  //This will make sure to loop over all intities (e.g. for order=2 it will make doWork to loop 16 time)
34  sYmm = false;
35  }

Member Function Documentation

◆ doWork()

PetscErrorCode BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)
inline

Definition at line 40 of file BCs_RVELagrange_Trac_Rigid_Trans.hpp.

45  {
46  PetscFunctionBegin;
47 
48  try {
49  if(row_data.getIndices().size()==0) PetscFunctionReturn(0);
50  if(col_data.getIndices().size()==0) PetscFunctionReturn(0);
51  if(col_type==MBVERTEX) {
52 
53  auto weak_ptr_dof =
54  getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(
55  col_data.getIndices()[0]);
56  const FENumeredDofEntity *dof_ptr;
57  if (auto ptr = weak_ptr_dof.lock())
58  dof_ptr = ptr.get();
59  else
60  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Dof not found");
61 
62  int rank = dof_ptr->getNbOfCoeffs();
63 
64  Mat_face.resize(rank,3*rank);
65  Mat_face.clear();
66  Mat_face_Tran.resize(3*rank,rank);
67  Mat_face_Tran.clear();
68 
69  switch(rank) {
70  case 3:
71  for(int nn=0; nn<3; nn++){
72  Mat_face(0,3*nn+0) = 1.0;
73  Mat_face(1,3*nn+1) = 1.0;
74  Mat_face(2,3*nn+2) = 1.0;
75  }
76  break;
77  case 1:
78  Mat_face(0,0) = 1.0;
79  Mat_face(0,1) = 1.0;
80  Mat_face(0,2) = 1.0;
81  break;
82  default:
83  SETERRQ(PETSC_COMM_SELF,1,"not implemented");
84  }
85 
86  // Matrix C1
87  int nb_rows=row_data.getIndices().size();
88  int nb_cols=col_data.getIndices().size();
90  Aij,nb_rows,&row_data.getIndices()[0],nb_cols,&col_data.getIndices()[0],&Mat_face(0,0),ADD_VALUES
91  ); CHKERRQ(ierr);
92 
93  // Matrix C1T
94  noalias(Mat_face_Tran) = trans(Mat_face);
96  Aij,nb_cols,&col_data.getIndices()[0],nb_rows,&row_data.getIndices()[0],&Mat_face_Tran(0,0),ADD_VALUES
97  ); CHKERRQ(ierr);
98 
99  }
100  } catch (const std::exception& ex) {
101  ostringstream ss;
102  ss << "throw in method: " << ex.what() << endl;
103  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
104  }
105  PetscFunctionReturn(0);
106  }

Member Data Documentation

◆ Aij

Mat BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::Aij

Definition at line 27 of file BCs_RVELagrange_Trac_Rigid_Trans.hpp.

◆ dAta

RVEBC_Data& BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::dAta

Definition at line 26 of file BCs_RVELagrange_Trac_Rigid_Trans.hpp.

◆ Mat_face

MatrixDouble BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::Mat_face

Definition at line 37 of file BCs_RVELagrange_Trac_Rigid_Trans.hpp.

◆ Mat_face_Tran

MatrixDouble BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::Mat_face_Tran

Definition at line 38 of file BCs_RVELagrange_Trac_Rigid_Trans.hpp.


The documentation for this struct was generated from the following file:
MoFEM::MatSetValues
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
Definition: EntitiesFieldData.hpp:1644
BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::dAta
RVEBC_Data & dAta
Definition: BCs_RVELagrange_Trac_Rigid_Trans.hpp:26
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROWCOL
@ OPROWCOL
operator doWork is executed on FE rows &columns
Definition: ForcesAndSourcesCore.hpp:569
BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::Aij
Mat Aij
Definition: BCs_RVELagrange_Trac_Rigid_Trans.hpp:27
BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::Mat_face
MatrixDouble Mat_face
Definition: BCs_RVELagrange_Trac_Rigid_Trans.hpp:37
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
BCs_RVELagrange_Trac_Rigid_Trans::OpRVEBCsLhs::Mat_face_Tran
MatrixDouble Mat_face_Tran
Definition: BCs_RVELagrange_Trac_Rigid_Trans.hpp:38
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31