19 #ifndef __BCS_RVELAGRANGE_TRAC_HPP
20 #define __BCS_RVELAGRANGE_TRAC_HPP
38 int shape_size = col_data.getN().size2();
40 n.resize(rank,shape_size*rank);
44 for(
int ii=0; ii<shape_size; ii++){
45 double val = col_data.getN()(gg,ii);
46 for(
int jj=0; jj<rank; jj++){
52 PetscFunctionReturn(0);
71 if(face_normal[0]>0) {
75 }
else if(face_normal[0]<0) {
79 }
else if(face_normal[1]>0) {
83 }
else if(face_normal[1]<0) {
87 }
else if(face_normal[2]>0) {
91 }
else if(face_normal[2]<0) {
99 int num_col = n_mat.size2();
100 h_mat.resize(6,num_col);
103 for(
int bb = 0; bb<num_col/3; bb++) {
105 for(
int rr = 0; rr<6; rr++) {
106 for(
int cc = 0; cc<3; cc++) {
119 if(face_normal[0]>0) {
122 if(face_normal[0]<0) {
125 if(face_normal[1]>0) {
128 if(face_normal[1]<0) {
131 if(face_normal[2]>0) {
134 if(face_normal[2]<0) {
138 int num_col = n_mat.size2();
139 h_mat.resize(3,num_col);
142 for(
int bb = 0; bb<num_col; bb++) {
144 for(
int rr = 0; rr<3; rr++) {
145 for(
int cc = 0; cc<1; cc++) {
157 PetscFunctionReturn(0);
171 OpRVEBCsLhs(
const string field_name,
const string lagrang_field_name,Mat aij,
186 int row_side,
int col_side,
187 EntityType row_type,EntityType col_type,
194 if(row_data.getIndices().size()==0) PetscFunctionReturn(0);
195 if(col_data.getIndices().size()==0) PetscFunctionReturn(0);
197 int nb_row = row_data.getIndices().size();
198 int nb_col = col_data.getIndices().size();
201 getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(
202 col_data.getIndices()[0]);
203 const FENumeredDofEntity *dof_ptr;
204 if (
auto ptr = weak_ptr_dof.lock())
209 int rank = dof_ptr->getNbOfCoeffs();
211 K.resize(nb_row,nb_col);
214 N_mat_row.resize(col_data.getN().size1());
215 for(
unsigned int gg = 0;gg<col_data.getN().size1();gg++) {
218 area = norm_2(getNormalsAtGaussPts(gg))*0.5;
222 double val = getGaussPts()(2,gg)*area;
224 if(col_type==MBVERTEX) {
240 int nb_rows=row_data.getIndices().size();
241 int nb_cols=col_data.getIndices().size();
243 Aij,nb_rows,&row_data.getIndices()[0],nb_cols,&col_data.getIndices()[0],&
K(0,0),ADD_VALUES
249 Aij,nb_cols,&col_data.getIndices()[0],nb_rows,&row_data.getIndices()[0],&
transK(0,0),ADD_VALUES
252 }
catch (
const std::exception& ex) {
254 ss <<
"throw in method: " << ex.what() << endl;
257 PetscFunctionReturn(0);
285 if(
type!=MBVERTEX) PetscFunctionReturn(0);
286 if(data.getIndices().size()==0) PetscFunctionReturn(0);
289 getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(
290 data.getIndices()[0]);
291 const FENumeredDofEntity *dof_ptr;
292 if (
auto ptr = weak_ptr_dof.lock())
297 int rank = dof_ptr->getNbOfCoeffs();
300 for(
unsigned int gg = 0;gg<data.getN().size1();gg++) {
303 area = norm_2(getNormalsAtGaussPts(gg))*0.5;
307 double val = getGaussPts()(2,gg)*area;
309 x = getCoordsAtGaussPts()(gg,0);
310 y = getCoordsAtGaussPts()(gg,1);
311 z = getCoordsAtGaussPts()(gg,2);
315 X_mat.resize(rank,6,
false);
323 X_mat.resize(rank,3,
false);
344 PetscFunctionReturn(0);
366 if(data.getIndices().size()==0) PetscFunctionReturn(0);
371 for(
int ii = 0;ii<
F.size();ii++) {
374 f.resize(D_mat.size1(),
false);
376 ierr =
VecSetValues(
F[ii],data.getIndices().size(),&data.getIndices()[0],&
f[0],ADD_VALUES); CHKERRQ(
ierr);
379 PetscFunctionReturn(0);
384 string field_name,
string lagrang_field_name,
string mesh_nodals_positions,Mat aij,vector<Vec> &
f
387 bool ho_geometry =
false;
391 map<int,RVEBC_Data>::iterator sit =
setOfRVEBC.begin();
405 PetscFunctionReturn(0);
426 if(data.getIndices().size()==0) PetscFunctionReturn(0);
427 if(
dAta.
tRis.find(getNumeredEntFiniteElementPtr()->getEnt())==
dAta.
tRis.end()) PetscFunctionReturn(0);
431 const int indices_6[6] = {0, 1, 2, 3, 4, 5};
432 const int indices_3[3] = {0, 1, 2};
443 PetscFunctionReturn(0);
449 string field_name,
string lagrang_field_name,
string mesh_nodals_positions,
Vec stress_homo
452 bool ho_geometry =
false;
456 map<int,RVEBC_Data>::iterator sit =
setOfRVEBC.begin();
465 PetscFunctionReturn(0);
ForcesAndSourcesCore::UserDataOperator UserDataOperator
EntitiesFieldData::EntData EntData
@ MOFEM_DATA_INCONSISTENCY
virtual bool check_field(const std::string &name) const =0
check if field is in database
const FTensor::Tensor2< T, Dim, Dim > Vec
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
UBlasMatrix< double > MatrixDouble
UBlasVector< double > VectorDouble
constexpr auto VecSetValues
constexpr auto MatSetValues
map< int, RVEBC_Data > setOfRVEBC
maps side set id with appropriate FluxData
CommonFunctions common_functions
MoFEM::Interface & mField
PetscErrorCode hMat(VectorDouble face_normal, int rank, MatrixDouble &n_mat, MatrixDouble &h_mat)
PetscErrorCode shapeMat(int rank, unsigned int gg, DataForcesAndSourcesCore::EntData &col_data, MatrixDouble &n)
\biref operator to calculate the LHS for the RVE bounary conditions
CommonFunctions & commonFunctions
ublas::vector< MatrixDouble > N_mat_row
PetscErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
OpRVEBCsLhs(const string field_name, const string lagrang_field_name, Mat aij, RVEBC_Data &data, CommonFunctions &common_functions, bool ho_geometry=false)
\biref operator to calculate the RHS of the constrain for the RVE boundary conditions
PetscErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
OpRVEBCsRhs_Assemble(const string lagrang_field_name, vector< Vec > &f, RVEBC_Data &data, CommonData &common_data)
VectorDouble applied_strain
\biref operator to calculate the RHS of the constrain for the RVE boundary conditions
OpRVEBCsRhs_Cal(const string field_name, RVEBC_Data &data, CommonData &common_data, CommonFunctions &common_functions, bool ho_geometry=false)
PetscErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
CommonFunctions & commonFunctions
VectorDouble stressVector
PetscErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
OpRVEHomoStress_Assemble(const string lagrang_field_name, Vec stress_homo, RVEBC_Data &data, CommonData &common_data)
BCs_RVELagrange_Trac(MoFEM::Interface &m_field)
PetscErrorCode setRVEBCsOperators(string field_name, string lagrang_field_name, string mesh_nodals_positions, Mat aij, vector< Vec > &f)
PetscErrorCode setRVEBCsHomoStressOperators(string field_name, string lagrang_field_name, string mesh_nodals_positions, Vec stress_homo)
CommonFunctions commonFunctions
Deprecated interface functions.