v0.15.0
Loading...
Searching...
No Matches
BCs_RVELagrange_Disp.hpp
Go to the documentation of this file.
1/* This file is part of MoFEM.
2 * MoFEM is free software: you can redistribute it and/or modify it under
3 * the terms of the GNU Lesser General Public License as published by the
4 * Free Software Foundation, either version 3 of the License, or (at your
5 * option) any later version.
6 *
7 * MoFEM is distributed in the hope that it will be useful, but WITHOUT
8 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10 * License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
14
15#ifndef __BCS_RVELAGRANGE_DISP_HPP
16#define __BCS_RVELAGRANGE_DISP_HPP
17
19
24
25 boost::ptr_vector<MethodForForceScaling> methodsOp; //This is to apply strain vector in steps (for given steps) for nonlinear problem
26
27
29 MyTriFE feRVEBCRhs; //To calculate the Rhs or RVE BCs
30 MyTriFE feRVEBCLhs; //To calculate the Lhs or RVE BCs
31 MyTriFE feRVEBCStress; //To calculate the Rhs or RVE BCs
32 MyTriFE feRVEBCRhsResidual; //To calculate the Rhs or RVE BCs
33 MyTriFE feRVEBCRhsHomoC; //To be used for the calculation of homgenised stiffness matrix
34
37
40
42
43
45 mField(m_field),
46 feRVEBCRhs(m_field),
47 feRVEBCLhs(m_field),
48 feRVEBCRhsResidual(m_field),
49 feRVEBCStress(m_field),
50 feRVEBCRhsHomoC(m_field){
51 }
52
53 struct RVEBC_Data {
54 Range tRis; // All boundary surfaces
55 };
56 map<int,RVEBC_Data> setOfRVEBC; ///< maps side set id with appropriate FluxData
57
58 PetscErrorCode addLagrangiangElement(
59 const string element_name,
60 const string field_name,
61 const string lagrang_field_name,
62 const string mesh_nodals_positions
63 ) {
64 PetscFunctionBegin;
65
66
67
68
69 ierr = mField.add_finite_element(element_name,MF_ZERO); CHKERRQ(ierr);
70
71 //============================================================================================================
72 //C row as Lagrange_mul_disp and col as DISPLACEMENT
73 ierr = mField.modify_finite_element_add_field_row(element_name,lagrang_field_name); CHKERRQ(ierr);
75 //CT col as Lagrange_mul_disp and row as DISPLACEMENT
76 ierr = mField.modify_finite_element_add_field_col(element_name,lagrang_field_name); CHKERRQ(ierr);
78 //data
79 ierr = mField.modify_finite_element_add_field_data(element_name,lagrang_field_name); CHKERRQ(ierr);
81 //============================================================================================================
82
83 if(mField.check_field(mesh_nodals_positions)) { //for high order geometry
84 ierr = mField.modify_finite_element_add_field_data(element_name,mesh_nodals_positions); CHKERRQ(ierr);
85 }
86
87 //this is alternative method for setting boundary conditions, to bypass bu in cubit file reader.
88 //not elegant, but good enough
90 if(it->getName().compare(0,12,"AllBoundSurf") == 0 || it->getMeshsetId() == 103) {
91 // cout<<"Hi from addLagrangiangElement "<<endl;
92 rval = mField.get_moab().get_entities_by_type(it->meshset,MBTRI,setOfRVEBC[it->getMeshsetId()].tRis,true); CHKERRQ_MOAB(rval);
93 ierr = mField.add_ents_to_finite_element_by_type(setOfRVEBC[it->getMeshsetId()].tRis,MBTRI,element_name); CHKERRQ(ierr);
94 }
95 }
96
97 PetscFunctionReturn(0);
98 }
99
100 /// \biref operator to calculate the LHS for the RVE bounary conditions
101 struct OpRVEBCsLhs:public FaceElementForcesAndSourcesCore::UserDataOperator {
102
105 Mat Aij;
107 const string field_name, const string lagrang_field_name, Mat aij,
108 RVEBC_Data &data,bool ho_geometry = false
109 ):
111 lagrang_field_name, field_name, UserDataOperator::OPROWCOL
112 ),
113 dAta(data),hoGeometry(ho_geometry),Aij(aij) {
114 // This will make sure to loop over all entities
115 // (e.g. for order=2 it will make doWork to loop 16 time)
116 sYmm = false;
117 }
118
119 MatrixDouble K,transK;
120
121 /** \brief calculate thermal convection term in the lhs of equations
122 *
123 * C = intS N^T N dS
124 */
125 PetscErrorCode doWork(
126 int row_side,int col_side,
127 EntityType row_type,EntityType col_type,
128 DataForcesAndSurcesCore::EntData &row_data,
129 DataForcesAndSurcesCore::EntData &col_data
130 ) {
131 PetscFunctionBegin;
132
133 try {
134 int nb_row = row_data.getIndices().size();
135 int nb_col = col_data.getIndices().size();
136
137 if(nb_row == 0) PetscFunctionReturn(0);
138 if(nb_col == 0) PetscFunctionReturn(0);
139
140
141 const FENumeredDofEntity *dof_ptr;
142 ierr = getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(row_data.getIndices()[0],&dof_ptr); CHKERRQ(ierr);
143 int rank = dof_ptr->getNbOfCoeffs();
144
145 K.resize(nb_row/rank,nb_col/rank);
146 K.clear();
147
148 for(unsigned int gg = 0;gg<row_data.getN().size1();gg++) {
149 double area;
150 if(hoGeometry) {
151 area = norm_2(getNormalsAtGaussPt(gg))*0.5;
152 } else {
153 area = getArea();
154 }
155 double val = getGaussPts()(2,gg)*area;
156 noalias(K) += val*outer_prod(
157 row_data.getN(gg,nb_row/rank),col_data.getN(gg,nb_col/rank)
158 );
159 }
160
161 VectorInt row_indices,col_indices;
162 row_indices.resize(nb_row/rank);
163 col_indices.resize(nb_col/rank);
164
165 for(int rr = 0;rr < rank; rr++) {
166 unsigned int nb_rows;
167 unsigned int nb_cols;
168 int *rows;
169 int *cols;
170 if(rank > 1) {
171
172 ublas::noalias(row_indices) = ublas::vector_slice<VectorInt >
173 (row_data.getIndices(), ublas::slice(rr, rank, row_data.getIndices().size()/rank));
174
175 ublas::noalias(col_indices) = ublas::vector_slice<VectorInt >
176 (col_data.getIndices(), ublas::slice(rr, rank, col_data.getIndices().size()/rank));
177
178 nb_rows = row_indices.size();
179 nb_cols = col_indices.size();
180 rows = &*row_indices.data().begin();
181 cols = &*col_indices.data().begin();
182
183 } else {
184
185 nb_rows = row_data.getIndices().size();
186 nb_cols = col_data.getIndices().size();
187 rows = &*row_data.getIndices().data().begin();
188 cols = &*col_data.getIndices().data().begin();
189
190 }
191
192 // Matrix C
193 ierr = MatSetValues(Aij,nb_rows,rows,nb_cols,cols,&K(0,0),ADD_VALUES); CHKERRQ(ierr);
194
195 // Matrix CT
196 transK.resize(nb_col/rank,nb_row/rank);
197 noalias(transK) = trans(K);
198 ierr = MatSetValues(Aij,nb_cols,cols,nb_rows,rows,&transK(0,0),ADD_VALUES); CHKERRQ(ierr);
199
200 }
201
202 } catch (const std::exception& ex) {
203 ostringstream ss;
204 ss << "throw in method: " << ex.what() << endl;
205 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
206 }
207
208 PetscFunctionReturn(0);
209 }
210 };
211
212 struct OpDmatRhs: public FaceElementForcesAndSourcesCore::UserDataOperator {
213
216
218 const string field_name, const string lagrang_field_name,
219 RVEBC_Data &data,bool ho_geometry = false
220 ):
222 lagrang_field_name,UserDataOperator::OPROW
223 ),
224 dAta(data),hoGeometry(ho_geometry) {
225 }
226
227 VectorDouble f,applied_strain;
228 MatrixDouble X_mat,N_mat,D_mat;
229
231
232 PetscErrorCode calculateDmat(int side,EntityType type,DataForcesAndSurcesCore::EntData &data) {
233 PetscFunctionBegin;
234
235 double x,y,z;
236 for(unsigned int gg = 0;gg<data.getN().size1();gg++) {
237
238 double area;
239 if(hoGeometry) {
240 area = norm_2(getNormalsAtGaussPt(gg))*0.5;
241 } else {
242 area = getArea();
243 }
244 double val = getGaussPts()(2,gg)*area;
245
246 x = getHoCoordsAtGaussPts()(gg,0);
247 y = getHoCoordsAtGaussPts()(gg,1);
248 z = getHoCoordsAtGaussPts()(gg,2);
249
250 switch(rank) {
251 case 3: //mech problem
252 X_mat.resize(3,6,false);
253 X_mat.clear();
254 X_mat(0,0) = 2.0*x; X_mat(0,3)=y; X_mat(0,5)=z;
255 X_mat(1,1) = 2.0*y; X_mat(1,3)=x; X_mat(1,4)=z;
256 X_mat(2,2) = 2.0*z; X_mat(2,4)=y; X_mat(2,5)=x;
257 X_mat = 0.5*X_mat;
258 break;
259 case 1: //moisture transport or thermal problem
260 X_mat.resize(3,3,false);
261 X_mat.clear();
262 X_mat(0,0)= x; X_mat(0,1)= y; X_mat(0,2) = z;
263 break;
264 default:
265 SETERRQ(PETSC_COMM_SELF,1,"not implemented");
266 }
267
268 int shape_size = data.getN().size2();
269 N_mat.resize(rank,shape_size*rank);
270 N_mat.clear();
271
272 // FIXME: this is inefficient implementation
273 {
274 int kk=0;
275 for(int ii=0; ii<shape_size; ii++){
276 //number of shape functions
277 double val = data.getN()(gg,ii);
278 for(int jj=0; jj<rank; jj++) {
279 N_mat(jj,kk) = val;
280 kk++;
281 }
282 }
283 if(gg==0) {
284 D_mat = val*prod(trans(N_mat),X_mat);
285 } else{
286 D_mat += val*prod(trans(N_mat),X_mat);
287 }
288 }
289
290 }
291
292 PetscFunctionReturn(0);
293 }
294
295 };
296
297
298 /// \biref operator to calculate the RHS of the constrain for the RVE boundary conditions
299 struct OpRVEBCsRhs:public OpDmatRhs {
300 Vec F;
301 VectorDouble givenStrain;
302 boost::ptr_vector<MethodForForceScaling> &methodsOp;
303
305 const string field_name, const string lagrang_field_name,
306 Vec f, VectorDouble given_strain, boost::ptr_vector<MethodForForceScaling> &methods_op, RVEBC_Data &data,bool ho_geometry = false
307 ):
308 OpDmatRhs(field_name,lagrang_field_name,data,ho_geometry),F(f),givenStrain(given_strain),methodsOp(methods_op) {
309 }
310
311 PetscErrorCode doWork(int side,EntityType type,DataForcesAndSurcesCore::EntData &data) {
312 PetscFunctionBegin;
313
314 nb_row_dofs = data.getIndices().size();
315
316 if(nb_row_dofs ==0) PetscFunctionReturn(0);
317 if(dAta.tRis.find(getNumeredEntFiniteElementPtr()->getEnt())==dAta.tRis.end()) PetscFunctionReturn(0);
318
319
320 const FENumeredDofEntity *dof_ptr;
321 ierr = getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(data.getIndices()[0],&dof_ptr); CHKERRQ(ierr);
322 rank = dof_ptr->getNbOfCoeffs();
323 nb_row_dofs /= rank;
324
325 ierr = calculateDmat(side,type,data); CHKERRQ(ierr);
326
327 //This is to scale givenStrain vector to apply the strian in steps
328 VectorDouble scaled_given_strain;
329 scaled_given_strain.resize(6);
330 scaled_given_strain=givenStrain;
331// cout <<"givenStrain Before = "<<scaled_given_strain<<endl;
332 ierr = MethodForForceScaling::applyScale(getFEMethod(),methodsOp,scaled_given_strain); CHKERRQ(ierr);
333// cout <<"givenStrain After = "<<scaled_given_strain<<endl;
334 f.resize(D_mat.size1(),false);
335 noalias(f) = prod(D_mat, scaled_given_strain);
336 f*=-1;
337
338// cout <<"f = "<<f<<endl;
339// string wait;
340// cin>>wait;
341
342 Vec myF = F;
343 if(F == PETSC_NULL) {
344 myF = getFEMethod()->snes_f;
345 }
346
347 ierr = VecSetValues(myF,data.getIndices().size(),&data.getIndices()[0],&f[0],ADD_VALUES); CHKERRQ(ierr);
348 PetscFunctionReturn(0);
349 }
350 };
351
352 /// \biref operator to calculate the RHS for the calculation of the homgoensied stiffness matrix
354
355 vector<Vec> &F;
356
358 const string field_name, const string lagrang_field_name,
359 vector<Vec> &f,RVEBC_Data &data,bool ho_geometry = false
360 ):
361 OpDmatRhs(field_name,lagrang_field_name,data,ho_geometry),F(f) {
362 }
363
364 PetscErrorCode doWork(int side,EntityType type,DataForcesAndSurcesCore::EntData &data) {
365 PetscFunctionBegin;
366
367 nb_row_dofs = data.getIndices().size();
368
369 if(nb_row_dofs ==0) PetscFunctionReturn(0);
370 if(dAta.tRis.find(getNumeredEntFiniteElementPtr()->getEnt())==dAta.tRis.end()) PetscFunctionReturn(0);
371
372
373 const FENumeredDofEntity *dof_ptr;
374 ierr = getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(data.getIndices()[0],&dof_ptr); CHKERRQ(ierr);
375 rank = dof_ptr->getNbOfCoeffs();
376 nb_row_dofs /= rank;
377
378 ierr = calculateDmat(side,type,data); CHKERRQ(ierr);
379
380 applied_strain.resize(D_mat.size2(),false);
381 f.resize(D_mat.size1(),false);
382
383 int size = (rank == 3) ? 6 : 3;
384 for(int ii = 0;ii<size;ii++) {
385 applied_strain.clear();
386 applied_strain[ii] = 1.0;
387 noalias(f) = prod(D_mat, applied_strain);
388 ierr = VecSetValues(
389 F[ii],data.getIndices().size(),&data.getIndices()[0],&f[0],ADD_VALUES
390 ); CHKERRQ(ierr);
391 }
392
393 PetscFunctionReturn(0);
394
395 }
396 };
397
399 PetscErrorCode shapeMat(int rank, unsigned int gg, DataForcesAndSurcesCore::EntData &col_data, MatrixDouble &N_mat) {
400 PetscFunctionBegin;
401 int shape_size=col_data.getN().size2();
402 // cout<<"shape_size = "<<shape_size<<endl;
403 // cout<<"rank = "<<rank<<endl;
404 N_mat.resize(rank,shape_size*rank); N_mat.clear();
405 int gg1=0; int kk=0;
406 for(int ii=0; ii<shape_size; ii++){ //number of shape funcitons
407 for(int jj=0; jj<rank; jj++){
408 // cout<<"ii "<<ii<<endl;
409 N_mat(jj,kk)=col_data.getN()(gg,gg1); kk++;
410 }
411 gg1++;
412 }
413 PetscFunctionReturn(0);
414 }
415 };
417
418
419 /// \biref operator to calculate and assemble CU
420 struct OpRVEBCsRhsForceExternal_CU:public FaceElementForcesAndSourcesCore::UserDataOperator {
421
423 Vec F;
426
427
429 const string field_name, const string lagrang_field_name, Vec f,
430 CommonFunctions &_common_functions, RVEBC_Data &data, bool ho_geometry = false
431 ):
433 lagrang_field_name, field_name, UserDataOperator::OPROWCOL
434 ),
435 dAta(data),hoGeometry(ho_geometry),F(f), commonFunctions(_common_functions){
436 // This will make sure to loop over all entities
437 // (e.g. for order=2 it will make doWork to loop 16 time)
438 sYmm = false;
439 }
440
441 MatrixDouble K,transK, N_mat_row, N_mat_col;
442 VectorDouble CU, CTLam;
443
444 PetscErrorCode doWork(
445 int row_side,int col_side,
446 EntityType row_type,EntityType col_type,
447 DataForcesAndSurcesCore::EntData &row_data,
448 DataForcesAndSurcesCore::EntData &col_data
449 ) {
450 PetscFunctionBegin;
451
452 try {
453 int nb_row = row_data.getIndices().size();
454 int nb_col = col_data.getIndices().size();
455
456 if(nb_row == 0) PetscFunctionReturn(0);
457 if(nb_col == 0) PetscFunctionReturn(0);
458
459
460
461 const FENumeredDofEntity *dof_ptr;
462 ierr = getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(row_data.getIndices()[0],&dof_ptr); CHKERRQ(ierr);
463 int rank = dof_ptr->getNbOfCoeffs();
464 for(unsigned int gg = 0;gg<row_data.getN().size1();gg++) {
465 double area;
466 if(hoGeometry) {
467 area = norm_2(getNormalsAtGaussPt(gg))*0.5;
468 } else {
469 area = getArea();
470 }
471 double val = getGaussPts()(2,gg)*area;
472 ierr = commonFunctions.shapeMat(rank, gg, row_data, N_mat_row); CHKERRQ(ierr);
473 ierr = commonFunctions.shapeMat(rank, gg, col_data, N_mat_col); CHKERRQ(ierr);
474
475// cout<<"row_data.getN() "<<row_data.getN()<<endl;
476// cout<<"N_mat_row() "<<N_mat_row<<endl;
477//
478// cout<<"col_data.getN() "<<col_data.getN()<<endl;
479// cout<<"N_mat_col "<<N_mat_col<<endl;
480
481 if(gg==0){
482 K =val* prod(trans(N_mat_row),N_mat_col); //we don't need to define size K
483 } else {
484 K += val*prod(trans(N_mat_row),N_mat_col);
485 }
486 }
487 CU=prod(K, col_data.getFieldData());
488 CTLam=prod(trans(K),row_data.getFieldData());
489
490
491 Vec myF = F;
492 if(F == PETSC_NULL) {
493 myF = getFEMethod()->snes_f;
494 }
495
496 ierr = VecSetValues(myF,row_data.getIndices().size(),&row_data.getIndices()[0],&CU[0],ADD_VALUES); CHKERRQ(ierr);
497 ierr = VecSetValues(myF,col_data.getIndices().size(),&col_data.getIndices()[0],&CTLam[0],ADD_VALUES); CHKERRQ(ierr);
498
499 } catch (const std::exception& ex) {
500 ostringstream ss;
501 ss << "throw in method: " << ex.what() << endl;
502 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
503 }
504
505 PetscFunctionReturn(0);
506 }
507 };
508
509
510 //for nonlinear problems
512 string field_name,
513 string lagrang_field_name,
514 string mesh_nodals_positions,
515 Mat aij,vector<Vec> &fvec,Vec f,VectorDouble given_strain
516 ) {
517 PetscFunctionBegin;
518
519 bool ho_geometry = false;
520 if(mField.check_field(mesh_nodals_positions)) {
521 ho_geometry = true;
522 }
523 map<int,RVEBC_Data>::iterator sit = setOfRVEBC.begin();
524 for(;sit!=setOfRVEBC.end();sit++) {
525
526 //Lhs (calculate LHS)
527 feRVEBCLhs.getOpPtrVector().push_back(
528 new OpRVEBCsLhs(field_name,lagrang_field_name, aij, sit->second,ho_geometry)
529 );
530
531
532 //Rhs (calculate RHS)
533 feRVEBCRhs.getOpPtrVector().push_back(
534 new OpRVEBCsRhs(field_name,lagrang_field_name,f,given_strain, methodsOp, sit->second,ho_geometry)
535 );
536
537
538 //Rhs (F[6] used to calculate Homgenised stiffness matrix)
539 feRVEBCRhsHomoC.getOpPtrVector().push_back(
540 new OpRVEBCsRhsHomoC(field_name,lagrang_field_name,fvec,sit->second,ho_geometry)
541 );
542
543 //for internal forces (i.e. RHS)
544 //calculate and assemble CU and CT Lam
545 feRVEBCRhsResidual.getOpPtrVector().push_back(
546 new OpRVEBCsRhsForceExternal_CU(field_name,lagrang_field_name,f,common_functions,sit->second,ho_geometry)
547 );
548
549
550 }
551
552 PetscFunctionReturn(0);
553 }
554
555 //for linear problems
556 PetscErrorCode setRVEBCsOperators(
557 string field_name,
558 string lagrang_field_name,
559 string mesh_nodals_positions,
560 Mat aij,vector<Vec> &fvec
561 ) {
562 PetscFunctionBegin;
563
564 bool ho_geometry = false;
565 if(mField.check_field(mesh_nodals_positions)) {
566 ho_geometry = true;
567 }
568 map<int,RVEBC_Data>::iterator sit = setOfRVEBC.begin();
569 for(;sit!=setOfRVEBC.end();sit++) {
570
571 //Lhs (calculate LHS)
572 feRVEBCLhs.getOpPtrVector().push_back(
573 new OpRVEBCsLhs(field_name,lagrang_field_name, aij, sit->second,ho_geometry)
574 );
575
576 //Rhs (F[6] used to calculate Homgenised stiffness matrix)
577 feRVEBCRhs.getOpPtrVector().push_back(
578 new OpRVEBCsRhsHomoC(field_name,lagrang_field_name,fvec,sit->second,ho_geometry)
579 );
580 }
581 PetscFunctionReturn(0);
582 }
583
584
585 /// \biref operator to calculate the RVE homogenised stress
587
589
591 const string field_name,
592 const string lagrang_field_name,
593 Vec stress_homo,
594 RVEBC_Data &data,
595 bool ho_geometry = false
596 ):
597 OpDmatRhs(field_name,lagrang_field_name,data,ho_geometry),
598 Stress_Homo(stress_homo) {
599 }
600
601 VectorDouble Stress_Homo_elem;
602
603 PetscErrorCode doWork(int side,EntityType type,DataForcesAndSurcesCore::EntData &data) {
604 PetscFunctionBegin;
605 if(data.getIndices().size()==0) PetscFunctionReturn(0);
606 if(dAta.tRis.find(getNumeredEntFiniteElementPtr()->getEnt())==dAta.tRis.end()) PetscFunctionReturn(0);
607 // cout<<"OpRVEBCsRhs "<<endl;
608
609
610 const FENumeredDofEntity *dof_ptr;
611 ierr = getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(data.getIndices()[0],&dof_ptr); CHKERRQ(ierr);
612 rank = dof_ptr->getNbOfCoeffs();
613 nb_row_dofs = data.getIndices().size()/rank;
614
615 ierr = calculateDmat(side,type,data); CHKERRQ(ierr);
616
617 Stress_Homo_elem.resize(D_mat.size2());
618
619 // data.getFieldData() is value of Lagrange multply
620 // data.getFieldData() is reaction force (so multiply for -1 to get the force)
621 noalias(Stress_Homo_elem) = prod(trans(D_mat), -data.getFieldData());
622
623 const int Indices6[6] = {0, 1, 2, 3, 4, 5};
624 const int Indices3[3] = {0, 1, 2};
625 switch(rank) {
626 case 3:
627 ierr = VecSetValues(Stress_Homo,6,Indices6,&(Stress_Homo_elem.data())[0],ADD_VALUES); CHKERRQ(ierr);
628 break;
629 case 1:
630 ierr = VecSetValues(Stress_Homo,3,Indices3,&(Stress_Homo_elem.data())[0],ADD_VALUES); CHKERRQ(ierr);
631 break;
632 default:
633 SETERRQ(PETSC_COMM_SELF,1,"not implemented");
634 }
635
636 PetscFunctionReturn(0);
637 }
638 };
639
641 string field_name,
642 string lagrang_field_name,
643 string mesh_nodals_positions,
644 Vec Stress_Homo
645 ) {
646 PetscFunctionBegin;
647
648 bool ho_geometry = false;
649 if(mField.check_field(mesh_nodals_positions)) {
650 ho_geometry = true;
651 }
652
653 map<int,RVEBC_Data>::iterator sit = setOfRVEBC.begin();
654 for(;sit!=setOfRVEBC.end();sit++) {
655 feRVEBCStress.getOpPtrVector().push_back(new OpRVEHomoStress(field_name, lagrang_field_name, Stress_Homo, sit->second, ho_geometry));
656 }
657
658 PetscFunctionReturn(0);
659 }
660};
661
662#endif // __BCS_RVELAGRANGE_DISP_HPP
static PetscErrorCode ierr
@ MF_ZERO
@ SIDESET
#define CHKERRQ_MOAB(a)
check error code of MoAB function
constexpr int order
Order displacement.
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 add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string name, const bool recursive=true)=0
add entities to finite element
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_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
constexpr auto field_name
PetscErrorCode shapeMat(int rank, unsigned int gg, DataForcesAndSurcesCore::EntData &col_data, MatrixDouble &N_mat)
MyTriFE(MoFEM::Interface &_mField)
OpDmatRhs(const string field_name, const string lagrang_field_name, RVEBC_Data &data, bool ho_geometry=false)
PetscErrorCode calculateDmat(int side, EntityType type, DataForcesAndSurcesCore::EntData &data)
\biref operator to calculate the LHS for the RVE bounary conditions
PetscErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSurcesCore::EntData &row_data, DataForcesAndSurcesCore::EntData &col_data)
calculate thermal convection term in the lhs of equations
OpRVEBCsLhs(const string field_name, const string lagrang_field_name, Mat aij, RVEBC_Data &data, bool ho_geometry=false)
\biref operator to calculate and assemble CU
PetscErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSurcesCore::EntData &row_data, DataForcesAndSurcesCore::EntData &col_data)
OpRVEBCsRhsForceExternal_CU(const string field_name, const string lagrang_field_name, Vec f, CommonFunctions &_common_functions, RVEBC_Data &data, bool ho_geometry=false)
\biref operator to calculate the RHS for the calculation of the homgoensied stiffness matrix
OpRVEBCsRhsHomoC(const string field_name, const string lagrang_field_name, vector< Vec > &f, RVEBC_Data &data, bool ho_geometry=false)
PetscErrorCode doWork(int side, EntityType type, DataForcesAndSurcesCore::EntData &data)
\biref operator to calculate the RHS of the constrain for the RVE boundary conditions
OpRVEBCsRhs(const string field_name, const string lagrang_field_name, Vec f, VectorDouble given_strain, boost::ptr_vector< MethodForForceScaling > &methods_op, RVEBC_Data &data, bool ho_geometry=false)
PetscErrorCode doWork(int side, EntityType type, DataForcesAndSurcesCore::EntData &data)
boost::ptr_vector< MethodForForceScaling > & methodsOp
\biref operator to calculate the RVE homogenised stress
PetscErrorCode doWork(int side, EntityType type, DataForcesAndSurcesCore::EntData &data)
OpRVEHomoStress(const string field_name, const string lagrang_field_name, Vec stress_homo, RVEBC_Data &data, bool ho_geometry=false)
map< int, RVEBC_Data > setOfRVEBC
maps side set id with appropriate FluxData
BCs_RVELagrange_Disp(MoFEM::Interface &m_field)
boost::ptr_vector< MethodForForceScaling > methodsOp
PetscErrorCode setRVEBCsOperatorsNonlinear(string field_name, string lagrang_field_name, string mesh_nodals_positions, Mat aij, vector< Vec > &fvec, Vec f, VectorDouble given_strain)
PetscErrorCode setRVEBCsHomoStressOperators(string field_name, string lagrang_field_name, string mesh_nodals_positions, Vec Stress_Homo)
PetscErrorCode setRVEBCsOperators(string field_name, string lagrang_field_name, string mesh_nodals_positions, Mat aij, vector< Vec > &fvec)
PetscErrorCode addLagrangiangElement(const string element_name, const string field_name, const string lagrang_field_name, const string mesh_nodals_positions)
static MoFEMErrorCode applyScale(const FEMethod *fe, boost::ptr_vector< MethodForForceScaling > &methods_op, VectorDouble &nf)
virtual moab::Interface & get_moab()=0
Deprecated interface functions.