137 {
138
140
141 try {
142
143 moab::Core mb_instance;
144 moab::Interface& moab = mb_instance;
145 int rank;
146 MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
147
148
149 PetscBool flg = PETSC_TRUE;
152 if(flg != PETSC_TRUE) {
153 SETERRQ(PETSC_COMM_SELF,1,"*** ERROR -my_file (MESH FILE NEEDED)");
154 }
157 if(flg != PETSC_TRUE) {
159 }
160
161
162 double myapplied_strain[6];
163 int nmax=6;
166 applied_strain.resize(6);
167 cblas_dcopy(6, &myapplied_strain[0], 1, &applied_strain(0), 1);
168
169
170
171
172 const char *option;
173 option = "";
175 ParallelComm* pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
176 if(pcomm == NULL) pcomm = new ParallelComm(&moab,PETSC_COMM_WORLD);
177
178
179 PetscLogDouble t1,t2;
180 PetscLogDouble v1,v2;
181 ierr = PetscTime(&v1); CHKERRQ(
ierr);
182 ierr = PetscGetCPUTime(&t1); CHKERRQ(
ierr);
183
184
187
188
190
191
193 bit_level0.set(0);
197 ierr = m_field.get_entities_by_ref_level(bit_level0,
BitRefLevel().set(),meshset_level0); CHKERRQ(
ierr);
198
199
200
201
202
203
205 ierr = m_field.get_cubit_msId_entities_by_dimension(101,
SIDESET,2,SurTrisNeg,
true); CHKERRQ(
ierr);
206 ierr = PetscPrintf(PETSC_COMM_WORLD,
"number of SideSet 101 = %d\n",SurTrisNeg.size()); CHKERRQ(
ierr);
208 double TriCen[3], coords_Tri[9];
209 for(Range::iterator it = SurTrisNeg.begin(); it!=SurTrisNeg.end(); it++) {
211
212
214
216
217
218 TriCen[0]= (coords_Tri[0]+coords_Tri[3]+coords_Tri[6])/3.0;
219 TriCen[1]= (coords_Tri[1]+coords_Tri[4]+coords_Tri[7])/3.0;
220 TriCen[2]= (coords_Tri[2]+coords_Tri[5]+coords_Tri[8])/3.0;
221
222
223 if(TriCen[0]>=0) TriCen[0]=
double(
int(TriCen[0]*1000.0+0.5))/1000.0;
else TriCen[0]=
double(
int(TriCen[0]*1000.0-0.5))/1000.0;
224 if(TriCen[1]>=0) TriCen[1]=
double(
int(TriCen[1]*1000.0+0.5))/1000.0;
else TriCen[1]=
double(
int(TriCen[1]*1000.0-0.5))/1000.0;
225 if(TriCen[2]>=0) TriCen[2]=
double(
int(TriCen[2]*1000.0+0.5))/1000.0;
else TriCen[2]=
double(
int(TriCen[2]*1000.0-0.5))/1000.0;
226
227
228
229 Face_CenPos_Handle_varNeg.insert(
Face_CenPos_Handle(TriCen[0], TriCen[1], TriCen[2], *it));
230
231
232 }
233
234
235
236
237
238
239
240
241
243 ierr = m_field.get_cubit_msId_entities_by_dimension(102,
SIDESET,2,SurTrisPos,
true); CHKERRQ(
ierr);
244 ierr = PetscPrintf(PETSC_COMM_WORLD,
"number of SideSet 102 = %d\n",SurTrisPos.size()); CHKERRQ(
ierr);
245 for(Range::iterator it = SurTrisPos.begin(); it!=SurTrisPos.end(); it++) {
247
248
250
252
253
254 TriCen[0]= (coords_Tri[0]+coords_Tri[3]+coords_Tri[6])/3.0;
255 TriCen[1]= (coords_Tri[1]+coords_Tri[4]+coords_Tri[7])/3.0;
256 TriCen[2]= (coords_Tri[2]+coords_Tri[5]+coords_Tri[8])/3.0;
257
258
259 if(TriCen[0]>=0) TriCen[0]=
double(
int(TriCen[0]*1000.0+0.5))/1000.0;
else TriCen[0]=
double(
int(TriCen[0]*1000.0-0.5))/1000.0;
260 if(TriCen[1]>=0) TriCen[1]=
double(
int(TriCen[1]*1000.0+0.5))/1000.0;
else TriCen[1]=
double(
int(TriCen[1]*1000.0-0.5))/1000.0;
261 if(TriCen[2]>=0) TriCen[2]=
double(
int(TriCen[2]*1000.0+0.5))/1000.0;
else TriCen[2]=
double(
int(TriCen[2]*1000.0-0.5))/1000.0;
262
263
264
265 Face_CenPos_Handle_varPos.insert(
Face_CenPos_Handle(TriCen[0], TriCen[1], TriCen[2], *it));
266 }
267
268
269 double XcoordMin, YcoordMin, ZcoordMin, XcoordMax, YcoordMax, ZcoordMax;
270 typedef Face_CenPos_Handle_multiIndex::index<xcoord_tag>::type::iterator Tri_Xcoord_iterator;
271 typedef Face_CenPos_Handle_multiIndex::index<ycoord_tag>::type::iterator Tri_Ycoord_iterator;
272 typedef Face_CenPos_Handle_multiIndex::index<zcoord_tag>::type::iterator Tri_Zcoord_iterator;
273 Tri_Xcoord_iterator XcoordMin_it, XcoordMax_it;
274 Tri_Ycoord_iterator YcoordMin_it, YcoordMax_it;
275 Tri_Zcoord_iterator ZcoordMin_it, ZcoordMax_it;
276
277
278 XcoordMin_it=Face_CenPos_Handle_varNeg.get<
xcoord_tag>().begin(); XcoordMin=XcoordMin_it->xcoord;
279 XcoordMax_it=Face_CenPos_Handle_varPos.get<
xcoord_tag>().end(); XcoordMax_it--; XcoordMax=XcoordMax_it->xcoord;
280 YcoordMin_it=Face_CenPos_Handle_varNeg.get<
ycoord_tag>().begin(); YcoordMin=YcoordMin_it->ycoord;
281 YcoordMax_it=Face_CenPos_Handle_varPos.get<
ycoord_tag>().end(); YcoordMax_it--; YcoordMax=YcoordMax_it->ycoord;
282 ZcoordMin_it=Face_CenPos_Handle_varNeg.get<
zcoord_tag>().begin(); ZcoordMin=ZcoordMin_it->zcoord;
283 ZcoordMax_it=Face_CenPos_Handle_varPos.get<
zcoord_tag>().end(); ZcoordMax_it--; ZcoordMax=ZcoordMax_it->zcoord;
284
285
286
287
288 double LxRVE, LyRVE, LzRVE;
289 LxRVE=XcoordMax-XcoordMin;
290 LyRVE=YcoordMax-YcoordMin;
291 LzRVE=ZcoordMax-ZcoordMin;
292
293
294
295 typedef Face_CenPos_Handle_multiIndex::index<Tri_Hand_tag>::type::iterator Tri_Hand_iterator;
296 Tri_Hand_iterator Tri_Neg;
297 typedef Face_CenPos_Handle_multiIndex::index<Composite_xyzcoord>::type::iterator xyzcoord_iterator;
298 xyzcoord_iterator Tri_Pos;
300 double XPos, YPos, ZPos;
301
302
303
304 for(Range::iterator it = SurTrisNeg.begin(); it!=SurTrisNeg.end(); it++) {
305
306 Tri_Neg=Face_CenPos_Handle_varNeg.get<
Tri_Hand_tag>().find(*it);
307
308
309
310 if(Tri_Neg->xcoord==XcoordMin){XPos=XcoordMax; YPos=Tri_Neg->ycoord; ZPos=Tri_Neg->zcoord;};
311 if(Tri_Neg->ycoord==YcoordMin){XPos=YPos=Tri_Neg->xcoord; YPos=YcoordMax; ZPos=Tri_Neg->zcoord;};
312 if(Tri_Neg->zcoord==ZcoordMin){XPos=YPos=Tri_Neg->xcoord; YPos=Tri_Neg->ycoord; ZPos=ZcoordMax; };
313 Tri_Pos=Face_CenPos_Handle_varPos.get<
Composite_xyzcoord>().find(boost::make_tuple(XPos, YPos, ZPos));
314
315
316
317
318
320 vector<EntityHandle> TriNodesNeg, TriNodesPos;
321 double CoordNodeNeg[9], CoordNodePos[9];
326 for(int ii=0; ii<3; ii++){
327 PrismNodes[ii]=TriNodesNeg[ii];
328 }
329
330
331
332
333
334
335
336
337 double XNodeNeg, YNodeNeg, ZNodeNeg, XNodePos, YNodePos, ZNodePos;
338 for(int ii=0; ii<3; ii++){
339 if(Tri_Neg->xcoord==XcoordMin){XNodeNeg=XcoordMax; YNodeNeg=CoordNodeNeg[3*ii+1]; ZNodeNeg=CoordNodeNeg[3*ii+2];};
340 if(Tri_Neg->ycoord==YcoordMin){XNodeNeg=CoordNodeNeg[3*ii]; YNodeNeg=YcoordMax; ZNodeNeg=CoordNodeNeg[3*ii+2];};
341 if(Tri_Neg->zcoord==ZcoordMin){XNodeNeg=CoordNodeNeg[3*ii]; YNodeNeg=CoordNodeNeg[3*ii+1]; ZNodeNeg=ZcoordMax;};
342 for(int jj=0; jj<3; jj++){
343
344
345 if(XNodeNeg>=0) XNodeNeg=
double(
int(XNodeNeg*1000.0+0.5))/1000.0;
else XNodeNeg=
double(
int(XNodeNeg*1000.0-0.5))/1000.0;
346 if(YNodeNeg>=0) YNodeNeg=
double(
int(YNodeNeg*1000.0+0.5))/1000.0;
else YNodeNeg=
double(
int(YNodeNeg*1000.0-0.5))/1000.0;
347 if(ZNodeNeg>=0) ZNodeNeg=
double(
int(ZNodeNeg*1000.0+0.5))/1000.0;
else ZNodeNeg=
double(
int(ZNodeNeg*1000.0-0.5))/1000.0;
348
349 XNodePos=CoordNodePos[3*jj]; YNodePos=CoordNodePos[3*jj+1]; ZNodePos=CoordNodePos[3*jj+2];
350 if(XNodePos>=0) XNodePos=
double(
int(XNodePos*1000.0+0.5))/1000.0;
else XNodePos=
double(
int(XNodePos*1000.0-0.5))/1000.0;
351 if(YNodePos>=0) YNodePos=
double(
int(YNodePos*1000.0+0.5))/1000.0;
else YNodePos=
double(
int(YNodePos*1000.0-0.5))/1000.0;
352 if(ZNodePos>=0) ZNodePos=
double(
int(ZNodePos*1000.0+0.5))/1000.0;
else ZNodePos=
double(
int(ZNodePos*1000.0-0.5))/1000.0;
353
354 if(XNodeNeg==XNodePos && YNodeNeg==YNodePos && ZNodeNeg==ZNodePos){
355 PrismNodes[3+ii]=TriNodesPos[jj];
356 break;
357 }
358 }
359 }
360
361 double CoordNodesPrisms[18];
363
364
365
366
367
370 PrismRange.insert(PeriodicPrism);
371
372
377 ierr = m_field.get_entities_by_ref_level(bit_level0,
BitRefLevel().set(),meshset_level0); CHKERRQ(
ierr);
378
379
380
381
382
383
384
385
386
387
388
389 }
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407 int field_rank=3;
412
413
414
417
418
419
424
425
430
435
436
440
441
442
443 boost::shared_ptr<Hooke<adouble> > hooke_adouble(
new Hooke<adouble>);
444 boost::shared_ptr<Hooke<double> > hooke_double(
new Hooke<double>);
446 ierr = elastic.setBlocks(hooke_double,hooke_adouble); CHKERRQ(
ierr);
447 ierr = elastic.addElement(
"ELASTIC",
"DISPLACEMENT"); CHKERRQ(
ierr);
448 ierr = elastic.setOperators(
"DISPLACEMENT",
"MESH_NODE_POSITIONS",
false,
true); CHKERRQ(
ierr);
449
452
453 lagrangian_element_periodic.addLagrangiangElement("LAGRANGE_ELEM","DISPLACEMENT","LAGRANGE_MUL_PERIODIC","MESH_NODE_POSITIONS",PrismRange);
454 lagrangian_element_trac.addLagrangiangElement("LAGRANGE_ELEM_TRANS","DISPLACEMENT","LAGRANGE_MUL_RIGID_TRANS","MESH_NODE_POSITIONS");
455
456
458
459
463
464
465
467
468
469
470
471
472
473
476 ierr = m_field.
loop_dofs(
"MESH_NODE_POSITIONS",ent_method_material); CHKERRQ(
ierr);
477
478
479
481
482
484
485
486 ierr = m_field.build_problems(); CHKERRQ(
ierr);
487
488
489
490
491
492 ierr = m_field.partition_problem(
"ELASTIC_MECHANICS"); CHKERRQ(
ierr);
493 ierr = m_field.partition_finite_elements(
"ELASTIC_MECHANICS"); CHKERRQ(
ierr);
494
495 ierr = m_field.partition_ghost_dofs(
"ELASTIC_MECHANICS"); CHKERRQ(
ierr);
496
497
498 ierr = m_field.print_cubit_displacement_set(); CHKERRQ(
ierr);
499 ierr = m_field.print_cubit_force_set(); CHKERRQ(
ierr);
500
501 ierr = m_field.print_cubit_materials_set(); CHKERRQ(
ierr);
502
503
506 ierr = m_field.VecCreateGhost(
"ELASTIC_MECHANICS",
ROW,&
F[0]); CHKERRQ(
ierr);
507 for(int ii = 1;ii<6;ii++) {
508 ierr = VecDuplicate(
F[0],&
F[ii]); CHKERRQ(
ierr);
509 }
510
511 ierr = m_field.VecCreateGhost(
"ELASTIC_MECHANICS",
COL,&
D); CHKERRQ(
ierr);
512 Mat Aij;
513 ierr = m_field.MatCreateMPIAIJWithArrays(
"ELASTIC_MECHANICS",&Aij); CHKERRQ(
ierr);
514
515 for(int ii = 0;ii<6;ii++) {
516 ierr = VecZeroEntries(
F[ii]); CHKERRQ(
ierr);
517 ierr = VecGhostUpdateBegin(
F[ii],INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
518 ierr = VecGhostUpdateEnd(
F[ii],INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
519 }
520
521 ierr = MatZeroEntries(Aij); CHKERRQ(
ierr);
522
523
524
525 elastic.getLoopFeLhs().snes_B = Aij;
527
528 lagrangian_element_periodic.setRVEBCsOperators(
"DISPLACEMENT",
"LAGRANGE_MUL_PERIODIC",
"MESH_NODE_POSITIONS",Aij,
F);
529 ierr = m_field.
loop_finite_elements(
"ELASTIC_MECHANICS",
"LAGRANGE_ELEM",lagrangian_element_periodic.getLoopFeRVEBCLhs()); CHKERRQ(
ierr);
530 ierr = m_field.
loop_finite_elements(
"ELASTIC_MECHANICS",
"LAGRANGE_ELEM",lagrangian_element_periodic.getLoopFeRVEBCRhs()); CHKERRQ(
ierr);
531
533 lagrangian_element_rigid_body_trans.setRVEBCsRigidBodyTranOperators("DISPLACEMENT","LAGRANGE_MUL_RIGID_TRANS",Aij, lagrangian_element_periodic.setOfRVEBC);
534 ierr = m_field.
loop_finite_elements(
"ELASTIC_MECHANICS",
"LAGRANGE_ELEM_TRANS",lagrangian_element_rigid_body_trans.getLoopFeRVEBCLhs()); CHKERRQ(
ierr);
535
536 for(int ii = 0;ii<6;ii++) {
537 ierr = VecGhostUpdateBegin(
F[ii],ADD_VALUES,SCATTER_REVERSE); CHKERRQ(
ierr);
538 ierr = VecGhostUpdateEnd(
F[ii],ADD_VALUES,SCATTER_REVERSE); CHKERRQ(
ierr);
539 ierr = VecAssemblyBegin(
F[ii]); CHKERRQ(
ierr);
540 ierr = VecAssemblyEnd(
F[ii]); CHKERRQ(
ierr);
541 }
542
543 ierr = MatAssemblyBegin(Aij,MAT_FINAL_ASSEMBLY); CHKERRQ(
ierr);
544 ierr = MatAssemblyEnd(Aij,MAT_FINAL_ASSEMBLY); CHKERRQ(
ierr);
545
546
547
549 Vec volume_vec;
550 int volume_vec_ghost[] = { 0 };
551 ierr = VecCreateGhost(
552 PETSC_COMM_WORLD,(!m_field.
get_comm_rank())?1:0,1,1,volume_vec_ghost,&volume_vec
554 ierr = VecZeroEntries(volume_vec); CHKERRQ(
ierr);
555 vol_elem.getOpPtrVector().push_back(
new VolumeCalculation(
"DISPLACEMENT",volume_vec));
556
558
559 ierr = VecAssemblyBegin(volume_vec); CHKERRQ(
ierr);
560 ierr = VecAssemblyEnd(volume_vec); CHKERRQ(
ierr);
561 double rve_volume;
562 ierr = VecSum(volume_vec,&rve_volume); CHKERRQ(
ierr);
563
564 ierr = VecView(volume_vec,PETSC_VIEWER_STDOUT_WORLD); CHKERRQ(
ierr);
565 ierr = PetscPrintf(PETSC_COMM_WORLD,
"RVE Volume %3.2g\n",rve_volume); CHKERRQ(
ierr);
566 ierr = VecDestroy(&volume_vec);
567
568
569
570
571
573 bool doPreProcess;
574 bool doPostProcess;
577 doPreProcess(true),
578 doPostProcess(true)
579 {}
580 void setDoPreProcess() { doPreProcess = true; }
581 void unSetDoPreProcess() { doPreProcess = false; }
582 void setDoPostProcess() { doPostProcess = true; }
583 void unSetDoPostProcess() { doPostProcess = false; }
584
585
586
588 PetscFunctionBegin;
589 if(doPreProcess) {
591 }
592 PetscFunctionReturn(0);
593 }
595 PetscFunctionBegin;
596 if(doPostProcess) {
598 }
599 PetscFunctionReturn(0);
600 }
601 };
602
604
605 ierr = post_proc.generateReferenceElementMesh(); CHKERRQ(
ierr);
606 ierr = post_proc.addFieldValuesPostProc(
"DISPLACEMENT"); CHKERRQ(
ierr);
607 ierr = post_proc.addFieldValuesGradientPostProc(
"DISPLACEMENT"); CHKERRQ(
ierr);
608 ierr = post_proc.addFieldValuesPostProc(
"MESH_NODE_POSITIONS"); CHKERRQ(
ierr);
609 ierr = post_proc.addFieldValuesGradientPostProc(
"MESH_NODE_POSITIONS"); CHKERRQ(
ierr);
610
611 for(
612 map<int,NonlinearElasticElement::BlockData>::iterator sit = elastic.setOfBlocks.begin();
613 sit != elastic.setOfBlocks.end(); sit++
614 ) {
615 post_proc.getOpPtrVector().push_back(
617 post_proc.postProcMesh,
618 post_proc.mapGaussPts,
619 "DISPLACEMENT",
620 sit->second,
621 post_proc.commonData,
622 false
623 )
624 );
625 }
626 ierr = VecGhostUpdateBegin(
D,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
627 ierr = VecGhostUpdateEnd(
D,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
628 ierr = m_field.set_global_ghost_vector(
629 "ELASTIC_MECHANICS",
ROW,
D,INSERT_VALUES,SCATTER_REVERSE
631
632
633
634
635 KSP solver;
636 ierr = KSPCreate(PETSC_COMM_WORLD,&solver); CHKERRQ(
ierr);
637 ierr = KSPSetOperators(solver,Aij,Aij); CHKERRQ(
ierr);
638 ierr = KSPSetFromOptions(solver); CHKERRQ(
ierr);
639 ierr = KSPSetUp(solver); CHKERRQ(
ierr);
640
642 Dmat.resize(6,6);
643 Dmat.clear();
644
645
646
647 Vec stress_homo;
648 int stress_homo_ghost[] = { 0,1,2,3,4,5,6 };
649 ierr = VecCreateGhost(
650 PETSC_COMM_WORLD,(!m_field.
get_comm_rank())?6:0,6,6,stress_homo_ghost,&stress_homo
652
653 lagrangian_element_periodic.setRVEBCsHomoStressOperators("DISPLACEMENT","LAGRANGE_MUL_PERIODIC","MESH_NODE_POSITIONS",stress_homo);
654
655 PetscScalar *avec;
656 ierr = VecGetArray(stress_homo,&avec); CHKERRQ(
ierr);
657 for(int ii = 0;ii<6;ii++) {
659 ierr = KSPSolve(solver,
F[ii],
D); CHKERRQ(
ierr);
660 ierr = VecGhostUpdateBegin(
D,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
661 ierr = VecGhostUpdateEnd(
D,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
662 ierr = m_field.set_global_ghost_vector(
663 "ELASTIC_MECHANICS",
ROW,
D,INSERT_VALUES,SCATTER_REVERSE
665
666
667 post_proc.setDoPreProcess();
668 post_proc.unSetDoPostProcess();
670 "ELASTIC_MECHANICS","ELASTIC",post_proc
672 post_proc.unSetDoPreProcess();
673 post_proc.setDoPostProcess();
674 {
675 ostringstream sss;
676 sss << "mode_" << "Disp" << "_" << ii << ".h5m";
677 rval = post_proc.postProcMesh.write_file(
678 sss.str().c_str(),"MOAB","PARALLEL=WRITE_PART"
680 }
681
682 ierr = VecZeroEntries(stress_homo); CHKERRQ(
ierr);
684 "ELASTIC_MECHANICS","LAGRANGE_ELEM",lagrangian_element_periodic.getLoopFeRVEBCStress()
687 PETSC_NULL,"-my_rve_volume",&rve_volume,PETSC_NULL
689 ierr = VecAssemblyBegin(stress_homo); CHKERRQ(
ierr);
690 ierr = VecAssemblyEnd(stress_homo); CHKERRQ(
ierr);
691 ierr = VecScale(stress_homo,1.0/rve_volume); CHKERRQ(
ierr);
692 ierr = VecGhostUpdateBegin(stress_homo,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
693 ierr = VecGhostUpdateEnd(stress_homo,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
694 for(int jj=0; jj<6; jj++) {
695 Dmat(jj,ii) = avec[jj];
696 }
697 }
698
699 ierr = VecRestoreArray(stress_homo,&avec); CHKERRQ(
ierr);
700 PetscPrintf(
701 PETSC_COMM_WORLD,"\nHomogenised Stiffens Matrix = \n\n"
702 );
703
704 for(int ii=0; ii<6; ii++) {
705 PetscPrintf(
706 PETSC_COMM_WORLD,
707 "stress %d\t\t%8.5e\t\t%8.5e\t\t%8.5e\t\t%8.5e\t\t%8.5e\t\t%8.5e\n",
708 ii,Dmat(ii,0),Dmat(ii,1),Dmat(ii,2),Dmat(ii,3),Dmat(ii,4),Dmat(ii,5)
709 );
710 }
711
712
713
714 ofstream myfile;
716
717
718 myfile << "<<<< Homonenised stress >>>>>" << endl;
719
720 if(pcomm->rank()==0){
721 for(int ii=0; ii<6; ii++){
722 myfile << boost::format(
"%.3lf") %
roundn(Dmat(ii,0)) << endl;
723 avec++;
724 }
725 }
726
727 myfile.close();
728
729
730
731
732 for(int ii = 0;ii<6;ii++) {
733 ierr = VecDestroy(&
F[ii]); CHKERRQ(
ierr);
734 }
736 ierr = MatDestroy(&Aij); CHKERRQ(
ierr);
737 ierr = KSPDestroy(&solver); CHKERRQ(
ierr);
738 ierr = VecDestroy(&stress_homo); CHKERRQ(
ierr);
739
740 ierr = PetscTime(&v2);CHKERRQ(
ierr);
741 ierr = PetscGetCPUTime(&t2);CHKERRQ(
ierr);
742
743 PetscSynchronizedPrintf(PETSC_COMM_WORLD,"Total Rank %d Time = %f CPU Time = %f\n",pcomm->rank(),v2-v1,t2-t1);
744
745 }
747
749
750}
DEPRECATED typedef PostProcStress PostPorcStress
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
@ NOFIELD
scalar or vector of scalars describe (no true field)
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERRQ_MOAB(a)
check error code of MoAB function
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
multi_index_container< Face_CenPos_Handle, indexed_by< ordered_non_unique< tag< xcoord_tag >, member< Face_CenPos_Handle, double,&Face_CenPos_Handle::xcoord > >, ordered_non_unique< tag< ycoord_tag >, member< Face_CenPos_Handle, double,&Face_CenPos_Handle::ycoord > >, ordered_non_unique< tag< zcoord_tag >, member< Face_CenPos_Handle, double,&Face_CenPos_Handle::zcoord > >, ordered_unique< tag< Tri_Hand_tag >, member< Face_CenPos_Handle, const EntityHandle,&Face_CenPos_Handle::Tri_Hand > >, ordered_unique< tag< Composite_xyzcoord >, composite_key< Face_CenPos_Handle, member< Face_CenPos_Handle, double,&Face_CenPos_Handle::xcoord >, member< Face_CenPos_Handle, double,&Face_CenPos_Handle::ycoord >, member< Face_CenPos_Handle, double,&Face_CenPos_Handle::zcoord > > > > > Face_CenPos_Handle_multiIndex
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetReal(PetscOptions *, const char pre[], const char name[], PetscReal *dval, PetscBool *set)
PetscErrorCode PetscOptionsGetRealArray(PetscOptions *, const char pre[], const char name[], PetscReal dval[], PetscInt *nmax, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
virtual MoFEMErrorCode add_field(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
virtual int get_comm_rank() const =0
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
DEPRECATED MoFEMErrorCode seed_ref_level_3D(const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
seed 2D entities in the meshset and their adjacencies (only TETs adjacencies) in a particular BitRefL...
Projection of edge entities with one mid-node on hierarchical basis.
Volume finite element base.
MoFEMErrorCode postProcess()
MoFEMErrorCode preProcess()
structure grouping operators and data used for calculation of nonlinear elastic element
MoFEMErrorCode preProcess()
MoFEMErrorCode postProcess()