15 #if !defined(KRATOS_PROPAGATE_FRACTURES_3D_UTILITIES )
16 #define KRATOS_PROPAGATE_FRACTURES_3D_UTILITIES
150 for(
unsigned int i = 0;
i < rParameters[
"fractures_list"].
size();
i++)
152 this->
CheckFracture(
i, PropagationData, AuxVariables, rParameters);
173 if(move_mesh_flag==
true)
190 const bool& move_mesh_flag)
196 if(move_mesh_flag==
true)
200 this->SetFracturePoints(rPropagationData, rAuxVariables, rParameters, rModelPart);
206 const unsigned int& itFracture,
216 for(
unsigned int i = 0;
i < 3;
i++)
218 AuxPropagationVariables.
TipCoordinates[
i] = rParameters[
"fractures_list"][itFracture][
"tip_point"][
"coordinates"][
i].
GetDouble();
219 LeftPointCoordinates[
i] = rParameters[
"fractures_list"][itFracture][
"left_point"][
"coordinates"][
i].
GetDouble();
220 RightPointCoordinates[
i] = rParameters[
"fractures_list"][itFracture][
"right_point"][
"coordinates"][
i].
GetDouble();
224 this->CalculateTipRotationMatrix(AuxPropagationVariables.
RotationMatrix,AuxPropagationVariables.
TipCoordinates,LeftPointCoordinates,RightPointCoordinates);
227 const double PropagationLength = rParameters[
"fracture_data"][
"propagation_length"].
GetDouble();
229 double X_left = AuxPropagationVariables.
TipCoordinates[0] - PropagationLength;
230 double X_right = AuxPropagationVariables.
TipCoordinates[0] + PropagationLength;
231 double Y_top = AuxPropagationVariables.
TipCoordinates[1] + PropagationLength;
232 double Y_bot = AuxPropagationVariables.
TipCoordinates[1] - PropagationLength;
233 double Z_back = AuxPropagationVariables.
TipCoordinates[2] - PropagationLength;
234 double Z_front = AuxPropagationVariables.
TipCoordinates[2] + PropagationLength;
243 if(Column_left < 0) Column_left = 0;
244 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
245 if(Row_top < 0) Row_top = 0;
246 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
247 if(Section_back < 0) Section_back = 0;
251 std::vector<FracturePoint*> TipNeighbours;
254 for(
int s = Section_back; s <= Section_front; s++)
256 for(
int i = Row_top;
i <= Row_bot;
i++)
258 for(
int j = Column_left;
j<= Column_right;
j++)
270 TipNeighbours.push_back(&rOtherPoint);
295 double NonlocalDamage = 0.0;
296 double WeightingFunctionDenominator = 0.0;
297 int NNeighbours = TipNeighbours.size();
299 #pragma omp parallel for reduction(+:NonlocalDamage,WeightingFunctionDenominator)
300 for(
int i = 0;
i < NNeighbours;
i++)
303 NonlocalDamage += (MyPoint.
Weight)*
306 WeightingFunctionDenominator += (MyPoint.
Weight)*exp(-4.0*(MyPoint.
TipDistance)*(MyPoint.
TipDistance)/(PropagationLength*PropagationLength));
309 if(WeightingFunctionDenominator > 1.0e-20)
310 NonlocalDamage = NonlocalDamage/WeightingFunctionDenominator;
312 NonlocalDamage = 0.0;
315 if(NonlocalDamage >= rParameters[
"fracture_data"][
"propagation_damage"].GetDouble())
316 this->PropagateFracture(itFracture,rPropagationData,AuxPropagationVariables,rParameters);
325 const bool& move_mesh_flag)
330 if(move_mesh_flag==
true)
347 std::fstream PropDataFile;
348 PropDataFile.open (
"PropagationData.tcl",
std::fstream::out | std::fstream::trunc);
349 PropDataFile.precision(12);
351 PropDataFile <<
"set PropagationData [list]" << std::endl;
354 PropDataFile <<
"lappend PropagationData \"" << rParameters[
"fracture_data"][
"gid_path"].
GetString() <<
"\"" << std::endl;
359 for(
unsigned int i = 0;
i < rParameters[
"body_volumes_list"].
size();
i++)
361 Id = rParameters[
"body_volumes_list"][
i][
"id"].
GetInt();
363 PropDataFile <<
"set Groups [list]" << std::endl;
364 for(
unsigned int j = 0;
j < rParameters[
"body_volumes_list"][
i][
"groups"].
size();
j++)
366 PropDataFile <<
"lappend Groups \"" << rParameters[
"body_volumes_list"][
i][
"groups"][
j].
GetString() <<
"\"" << std::endl;
368 PropDataFile <<
"dict set BodyVolumesDict " << Id <<
" Groups $Groups" << std::endl;
369 PropDataFile <<
"set Surfaces [list]" << std::endl;
370 for(
unsigned int j = 0;
j < rParameters[
"body_volumes_list"][
i][
"surfaces"].
size();
j++)
372 PropDataFile <<
"lappend Surfaces " << rParameters[
"body_volumes_list"][
i][
"surfaces"][
j].
GetInt() << std::endl;
374 PropDataFile <<
"dict set BodyVolumesDict " << Id <<
" Surfaces $Surfaces" << std::endl;
375 PropDataFile <<
"dict set BodyVolumesDict " << Id <<
" MeshSize " << rParameters[
"body_volumes_list"][
i][
"mesh_size"].
GetDouble() << std::endl;
377 PropDataFile <<
"lappend PropagationData $BodyVolumesDict" << std::endl;
380 for(
unsigned int i = 0;
i < rParameters[
"fractures_list"].
size();
i++)
382 Id = rParameters[
"fractures_list"][
i][
"id"].
GetInt();
385 PropDataFile <<
"dict set FracturesDict " << Id <<
" TipPoint Id "
386 << rParameters[
"fractures_list"][
i][
"tip_point"][
"id"].
GetInt() << std::endl;
387 PropDataFile <<
"set Coordinates \"" << rParameters[
"fractures_list"][
i][
"tip_point"][
"coordinates"][0].
GetDouble()
388 <<
" " << rParameters[
"fractures_list"][
i][
"tip_point"][
"coordinates"][1].
GetDouble() <<
" "
389 << rParameters[
"fractures_list"][
i][
"tip_point"][
"coordinates"][2].
GetDouble() <<
"\"" << std::endl;
390 PropDataFile <<
"dict set FracturesDict " << Id <<
" TipPoint Coordinates $Coordinates" << std::endl;
392 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopPoint Id "
393 << rParameters[
"fractures_list"][
i][
"top_point"][
"id"].
GetInt() << std::endl;
394 PropDataFile <<
"set Coordinates \"" << rParameters[
"fractures_list"][
i][
"top_point"][
"coordinates"][0].
GetDouble()
395 <<
" " << rParameters[
"fractures_list"][
i][
"top_point"][
"coordinates"][1].
GetDouble() <<
" "
396 << rParameters[
"fractures_list"][
i][
"top_point"][
"coordinates"][2].
GetDouble() <<
"\"" << std::endl;
397 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopPoint Coordinates $Coordinates" << std::endl;
399 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotPoint Id "
400 << rParameters[
"fractures_list"][
i][
"bot_point"][
"id"].
GetInt() << std::endl;
401 PropDataFile <<
"set Coordinates \"" << rParameters[
"fractures_list"][
i][
"bot_point"][
"coordinates"][0].
GetDouble()
402 <<
" " << rParameters[
"fractures_list"][
i][
"bot_point"][
"coordinates"][1].
GetDouble() <<
" "
403 << rParameters[
"fractures_list"][
i][
"bot_point"][
"coordinates"][2].
GetDouble() <<
"\"" << std::endl;
404 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotPoint Coordinates $Coordinates" << std::endl;
406 PropDataFile <<
"dict set FracturesDict " << Id <<
" LeftPoint Id "
407 << rParameters[
"fractures_list"][
i][
"left_point"][
"id"].
GetInt() << std::endl;
408 PropDataFile <<
"set Coordinates \"" << rParameters[
"fractures_list"][
i][
"left_point"][
"coordinates"][0].
GetDouble()
409 <<
" " << rParameters[
"fractures_list"][
i][
"left_point"][
"coordinates"][1].
GetDouble() <<
" "
410 << rParameters[
"fractures_list"][
i][
"left_point"][
"coordinates"][2].
GetDouble() <<
"\"" << std::endl;
411 PropDataFile <<
"dict set FracturesDict " << Id <<
" LeftPoint Coordinates $Coordinates" << std::endl;
413 PropDataFile <<
"dict set FracturesDict " << Id <<
" RightPoint Id "
414 << rParameters[
"fractures_list"][
i][
"right_point"][
"id"].
GetInt() << std::endl;
415 PropDataFile <<
"set Coordinates \"" << rParameters[
"fractures_list"][
i][
"right_point"][
"coordinates"][0].
GetDouble()
416 <<
" " << rParameters[
"fractures_list"][
i][
"right_point"][
"coordinates"][1].
GetDouble() <<
" "
417 << rParameters[
"fractures_list"][
i][
"right_point"][
"coordinates"][2].
GetDouble() <<
"\"" << std::endl;
418 PropDataFile <<
"dict set FracturesDict " << Id <<
" RightPoint Coordinates $Coordinates" << std::endl;
420 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopLine Id "
421 << rParameters[
"fractures_list"][
i][
"top_line"][
"id"].
GetInt() << std::endl;
423 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotLine Id "
424 << rParameters[
"fractures_list"][
i][
"bot_line"][
"id"].
GetInt() << std::endl;
426 PropDataFile <<
"dict set FracturesDict " << Id <<
" LeftLine Id "
427 << rParameters[
"fractures_list"][
i][
"left_line"][
"id"].
GetInt() << std::endl;
429 PropDataFile <<
"dict set FracturesDict " << Id <<
" RightLine Id "
430 << rParameters[
"fractures_list"][
i][
"right_line"][
"id"].
GetInt() << std::endl;
432 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopLeftSurface Id "
433 << rParameters[
"fractures_list"][
i][
"top_left_surface"][
"id"].
GetInt() << std::endl;
434 PropDataFile <<
"set Lines [list]" << std::endl;
435 for(
unsigned int j = 0;
j < rParameters[
"fractures_list"][
i][
"top_left_surface"][
"lines"].
size();
j++)
437 PropDataFile <<
"lappend Lines " << rParameters[
"fractures_list"][
i][
"top_left_surface"][
"lines"][
j].
GetInt() << std::endl;
439 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopLeftSurface Lines $Lines" << std::endl;
441 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopRightSurface Id "
442 << rParameters[
"fractures_list"][
i][
"top_right_surface"][
"id"].
GetInt() << std::endl;
443 PropDataFile <<
"set Lines [list]" << std::endl;
444 for(
unsigned int j = 0;
j < rParameters[
"fractures_list"][
i][
"top_right_surface"][
"lines"].
size();
j++)
446 PropDataFile <<
"lappend Lines " << rParameters[
"fractures_list"][
i][
"top_right_surface"][
"lines"][
j].
GetInt() << std::endl;
448 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopRightSurface Lines $Lines" << std::endl;
450 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotLeftSurface Id "
451 << rParameters[
"fractures_list"][
i][
"bot_left_surface"][
"id"].
GetInt() << std::endl;
452 PropDataFile <<
"set Lines [list]" << std::endl;
453 for(
unsigned int j = 0;
j < rParameters[
"fractures_list"][
i][
"bot_left_surface"][
"lines"].
size();
j++)
455 PropDataFile <<
"lappend Lines " << rParameters[
"fractures_list"][
i][
"bot_left_surface"][
"lines"][
j].
GetInt() << std::endl;
457 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotLeftSurface Lines $Lines" << std::endl;
459 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotRightSurface Id "
460 << rParameters[
"fractures_list"][
i][
"bot_right_surface"][
"id"].
GetInt() << std::endl;
461 PropDataFile <<
"set Lines [list]" << std::endl;
462 for(
unsigned int j = 0;
j < rParameters[
"fractures_list"][
i][
"bot_right_surface"][
"lines"].
size();
j++)
464 PropDataFile <<
"lappend Lines " << rParameters[
"fractures_list"][
i][
"bot_right_surface"][
"lines"][
j].
GetInt() << std::endl;
466 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotRightSurface Lines $Lines" << std::endl;
468 PropDataFile <<
"dict set FracturesDict " << Id <<
" LeftInterfaceVolume Id "
469 << rParameters[
"fractures_list"][
i][
"left_interface_volume"][
"id"].
GetInt() << std::endl;
470 PropDataFile <<
"dict set FracturesDict " << Id <<
" LeftInterfaceVolume Layer \""
471 << rParameters[
"fractures_list"][
i][
"left_interface_volume"][
"layer"].
GetString() <<
"\"" << std::endl;
472 PropDataFile <<
"set Groups [list]" << std::endl;
473 for(
unsigned int j = 0;
j < rParameters[
"fractures_list"][
i][
"left_interface_volume"][
"groups"].
size();
j++)
475 PropDataFile <<
"lappend Groups \"" << rParameters[
"fractures_list"][
i][
"left_interface_volume"][
"groups"][
j].
GetString() <<
"\"" << std::endl;
477 PropDataFile <<
"dict set FracturesDict " << Id <<
" LeftInterfaceVolume Groups $Groups" << std::endl;
479 PropDataFile <<
"dict set FracturesDict " << Id <<
" RightInterfaceVolume Id "
480 << rParameters[
"fractures_list"][
i][
"right_interface_volume"][
"id"].
GetInt() << std::endl;
481 PropDataFile <<
"dict set FracturesDict " << Id <<
" RightInterfaceVolume Layer \""
482 << rParameters[
"fractures_list"][
i][
"right_interface_volume"][
"layer"].
GetString() <<
"\"" << std::endl;
483 PropDataFile <<
"set Groups [list]" << std::endl;
484 for(
unsigned int j = 0;
j < rParameters[
"fractures_list"][
i][
"right_interface_volume"][
"groups"].
size();
j++)
486 PropDataFile <<
"lappend Groups \"" << rParameters[
"fractures_list"][
i][
"right_interface_volume"][
"groups"][
j].
GetString() <<
"\"" << std::endl;
488 PropDataFile <<
"dict set FracturesDict " << Id <<
" RightInterfaceVolume Groups $Groups" << std::endl;
490 PropDataFile <<
"set BodyVolumes [list]" << std::endl;
491 for(
unsigned int j = 0;
j < rParameters[
"fractures_list"][
i][
"body_volumes"].
size();
j++)
493 PropDataFile <<
"lappend BodyVolumes " << rParameters[
"fractures_list"][
i][
"body_volumes"][
j].
GetInt() << std::endl;
495 PropDataFile <<
"dict set FracturesDict " << Id <<
" BodyVolumes $BodyVolumes" << std::endl;
497 PropDataFile <<
"lappend PropagationData $FracturesDict" << std::endl;
500 PropDataFile <<
"set PropagationDict [dict create]" << std::endl;
503 PropDataFile <<
"dict set PropagationDict " <<
i <<
" MotherFractureId "
506 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].TopInitCoordinates[0]
509 PropDataFile <<
"dict set PropagationDict " <<
i <<
" TopInitCoordinates $Coordinates" << std::endl;
510 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].BotInitCoordinates[0]
513 PropDataFile <<
"dict set PropagationDict " <<
i <<
" BotInitCoordinates $Coordinates" << std::endl;
514 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].LeftInitCoordinates[0]
517 PropDataFile <<
"dict set PropagationDict " <<
i <<
" LeftInitCoordinates $Coordinates" << std::endl;
518 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].RightInitCoordinates[0]
521 PropDataFile <<
"dict set PropagationDict " <<
i <<
" RightInitCoordinates $Coordinates" << std::endl;
522 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].TopEndCoordinates[0]
525 PropDataFile <<
"dict set PropagationDict " <<
i <<
" TopEndCoordinates $Coordinates" << std::endl;
526 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].BotEndCoordinates[0]
529 PropDataFile <<
"dict set PropagationDict " <<
i <<
" BotEndCoordinates $Coordinates" << std::endl;
530 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].LeftEndCoordinates[0]
533 PropDataFile <<
"dict set PropagationDict " <<
i <<
" LeftEndCoordinates $Coordinates" << std::endl;
534 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].RightEndCoordinates[0]
537 PropDataFile <<
"dict set PropagationDict " <<
i <<
" RightEndCoordinates $Coordinates" << std::endl;
538 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].TipCoordinates[0]
541 PropDataFile <<
"dict set PropagationDict " <<
i <<
" TipCoordinates $Coordinates" << std::endl;
543 PropDataFile <<
"lappend PropagationData $PropagationDict" << std::endl;
546 PropDataFile <<
"set BifurcationDict [dict create]" << std::endl;
549 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" MotherFractureId "
552 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].TopInitCoordinates[0]
555 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" TopInitCoordinates $Coordinates" << std::endl;
556 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].BotInitCoordinates[0]
559 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" BotInitCoordinates $Coordinates" << std::endl;
560 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].LeftInitCoordinates[0]
563 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" LeftInitCoordinates $Coordinates" << std::endl;
564 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].RightInitCoordinates[0]
567 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" RightInitCoordinates $Coordinates" << std::endl;
568 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].TopTopEndCoordinates[0]
571 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" TopTopEndCoordinates $Coordinates" << std::endl;
572 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].TopBotEndCoordinates[0]
575 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" TopBotEndCoordinates $Coordinates" << std::endl;
576 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].TopLeftEndCoordinates[0]
578 << PropagationData.
BifurcationVector[
i].TopLeftEndCoordinates[2] <<
"\"" << std::endl;
579 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" TopLeftEndCoordinates $Coordinates" << std::endl;
580 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].TopRightEndCoordinates[0]
582 << PropagationData.
BifurcationVector[
i].TopRightEndCoordinates[2] <<
"\"" << std::endl;
583 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" TopRightEndCoordinates $Coordinates" << std::endl;
584 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].TopTipCoordinates[0]
587 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" TopTipCoordinates $Coordinates" << std::endl;
588 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].BotTopEndCoordinates[0]
591 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" BotTopEndCoordinates $Coordinates" << std::endl;
592 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].BotBotEndCoordinates[0]
595 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" BotBotEndCoordinates $Coordinates" << std::endl;
596 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].BotLeftEndCoordinates[0]
598 << PropagationData.
BifurcationVector[
i].BotLeftEndCoordinates[2] <<
"\"" << std::endl;
599 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" BotLeftEndCoordinates $Coordinates" << std::endl;
600 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].BotRightEndCoordinates[0]
602 << PropagationData.
BifurcationVector[
i].BotRightEndCoordinates[2] <<
"\"" << std::endl;
603 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" BotRightEndCoordinates $Coordinates" << std::endl;
604 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].BotTipCoordinates[0]
607 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" BotTipCoordinates $Coordinates" << std::endl;
609 PropDataFile <<
"lappend PropagationData $BifurcationDict" << std::endl;
611 PropDataFile <<
"return $PropagationData" << std::endl;
613 PropDataFile.close();
621 const bool& move_mesh_flag)
624 if(move_mesh_flag==
true)
627 this->ComputeCellMatrixDimensions(rAuxVariables,rModelPartNew);
639 std::vector< std::vector< std::vector< std::vector<Element::Pointer> > > > ElementOldCellMatrix;
640 ElementOldCellMatrix.resize(AuxVariables.
NRows);
641 for(
int i = 0;
i < AuxVariables.
NRows;
i++)
642 ElementOldCellMatrix[
i].resize(AuxVariables.
NColumns);
643 for(
int i = 0;
i < AuxVariables.
NRows;
i++)
647 ElementOldCellMatrix[
i][
j].resize(AuxVariables.
NSections);
657 unsigned int NumBodySubModelParts = rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"].
size();
660 for(
unsigned int m = 0;
m < NumBodySubModelParts;
m++)
662 ModelPart& SubModelPart = rModelPartOld.
GetSubModelPart(rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"][
m].GetString());
664 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
665 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
667 #pragma omp parallel for private(X_me,Y_me,Z_me,PointsNumber)
668 for(
int i = 0;
i < NElems;
i++)
670 ModelPart::ElementsContainerType::iterator itElemOld = el_begin +
i;
672 double X_left = itElemOld->GetGeometry().GetPoint(0).X0();
673 double X_right = X_left;
674 double Y_top = itElemOld->GetGeometry().GetPoint(0).Y0();
675 double Y_bot = Y_top;
676 double Z_back = itElemOld->GetGeometry().GetPoint(0).Z0();
677 double Z_front = Z_back;
678 PointsNumber = itElemOld->GetGeometry().PointsNumber();
680 for(
int j = 1;
j < PointsNumber;
j++)
682 X_me = itElemOld->GetGeometry().GetPoint(
j).X0();
683 Y_me = itElemOld->GetGeometry().GetPoint(
j).Y0();
684 Z_me = itElemOld->GetGeometry().GetPoint(
j).Z0();
686 if(X_me > X_right) X_right = X_me;
687 else if(X_me < X_left) X_left = X_me;
688 if(Y_me > Y_top) Y_top = Y_me;
689 else if(Y_me < Y_bot) Y_bot = Y_me;
690 if(Z_me > Z_front) Z_front = Z_me;
691 else if(Z_me < Z_back) Z_back = Z_me;
701 if(Column_left < 0) Column_left = 0;
702 else if(Column_left >= AuxVariables.
NColumns) Column_left = AuxVariables.
NColumns-1;
703 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
704 else if(Column_right < 0) Column_right = 0;
705 if(Row_top < 0) Row_top = 0;
706 else if(Row_top >= AuxVariables.
NRows) Row_top = AuxVariables.
NRows-1;
707 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
708 else if(Row_bot < 0) Row_bot = 0;
709 if(Section_back < 0) Section_back = 0;
710 else if(Section_back >= AuxVariables.
NSections) Section_back = AuxVariables.
NSections-1;
712 else if(Section_front < 0) Section_front = 0;
714 for(
int s = Section_back; s <= Section_front; s++)
716 for(
int k = Row_top;
k <= Row_bot;
k++)
718 for(
int l = Column_left;
l <= Column_right;
l++)
722 ElementOldCellMatrix[
k][
l][s].push_back((*(itElemOld.base())));
730 unsigned int NumInterfaceSubModelPartsOld = rParameters[
"fracture_data"][
"interface_domain_sub_model_part_old_list"].
size();
733 for(
unsigned int m = 0;
m < NumInterfaceSubModelPartsOld;
m++)
735 ModelPart& SubModelPart = rModelPartOld.
GetSubModelPart(rParameters[
"fracture_data"][
"interface_domain_sub_model_part_old_list"][
m].GetString());
737 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
738 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
740 #pragma omp parallel for private(X_me,Y_me,Z_me,PointsNumber)
741 for(
int i = 0;
i < NElems;
i++)
743 ModelPart::ElementsContainerType::iterator itElemOld = el_begin +
i;
745 double X_left = itElemOld->GetGeometry().GetPoint(0).X0();
746 double X_right = X_left;
747 double Y_top = itElemOld->GetGeometry().GetPoint(0).Y0();
748 double Y_bot = Y_top;
749 double Z_back = itElemOld->GetGeometry().GetPoint(0).Z0();
750 double Z_front = Z_back;
751 PointsNumber = itElemOld->GetGeometry().PointsNumber();
753 for(
int j = 1;
j < PointsNumber;
j++)
755 X_me = itElemOld->GetGeometry().GetPoint(
j).X0();
756 Y_me = itElemOld->GetGeometry().GetPoint(
j).Y0();
757 Z_me = itElemOld->GetGeometry().GetPoint(
j).Z0();
759 if(X_me > X_right) X_right = X_me;
760 else if(X_me < X_left) X_left = X_me;
761 if(Y_me > Y_top) Y_top = Y_me;
762 else if(Y_me < Y_bot) Y_bot = Y_me;
763 if(Z_me > Z_front) Z_front = Z_me;
764 else if(Z_me < Z_back) Z_back = Z_me;
774 if(Column_left < 0) Column_left = 0;
775 else if(Column_left >= AuxVariables.
NColumns) Column_left = AuxVariables.
NColumns-1;
776 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
777 else if(Column_right < 0) Column_right = 0;
778 if(Row_top < 0) Row_top = 0;
779 else if(Row_top >= AuxVariables.
NRows) Row_top = AuxVariables.
NRows-1;
780 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
781 else if(Row_bot < 0) Row_bot = 0;
782 if(Section_back < 0) Section_back = 0;
783 else if(Section_back >= AuxVariables.
NSections) Section_back = AuxVariables.
NSections-1;
785 else if(Section_front < 0) Section_front = 0;
787 for(
int s = Section_back; s <= Section_front; s++)
789 for(
int k = Row_top;
k <= Row_bot;
k++)
791 for(
int l = Column_left;
l <= Column_right;
l++)
795 ElementOldCellMatrix[
k][
l][s].push_back((*(itElemOld.base())));
804 const int NNodes =
static_cast<int>(rModelPartNew.
Nodes().size());
805 ModelPart::NodesContainerType::iterator node_begin = rModelPartNew.
NodesBegin();
810 #pragma omp parallel for private(X_me,Y_me,Z_me,PointsNumber,GlobalCoordinates,LocalCoordinates)
811 for(
int i = 0;
i < NNodes;
i++)
813 ModelPart::NodesContainerType::iterator itNodeNew = node_begin +
i;
815 X_me = itNodeNew->X0();
816 Y_me = itNodeNew->Y0();
817 Z_me = itNodeNew->Z0();
824 else if(Column < 0) Column = 0;
825 if(Row >= AuxVariables.
NRows) Row = AuxVariables.
NRows-1;
826 else if(Row < 0) Row = 0;
828 else if(Section < 0) Section = 0;
830 noalias(GlobalCoordinates) = itNodeNew->Coordinates();
831 bool IsInside =
false;
832 Element::Pointer pElementOld;
834 for(
unsigned int m = 0;
m < (ElementOldCellMatrix[Row][Column][Section]).size();
m++)
836 pElementOld = ElementOldCellMatrix[Row][Column][Section][
m];
837 IsInside = pElementOld->GetGeometry().IsInside(GlobalCoordinates,LocalCoordinates);
842 for(
unsigned int m = 0;
m < (ElementOldCellMatrix[Row][Column][Section]).size();
m++)
844 pElementOld = ElementOldCellMatrix[Row][Column][Section][
m];
845 IsInside = pElementOld->GetGeometry().IsInside(GlobalCoordinates,LocalCoordinates,1.0e-5);
849 if(IsInside ==
false)
850 std::cout <<
"ERROR!!, NONE OF THE OLD ELEMENTS CONTAINS NODE: " << itNodeNew->Id() << std::endl;
852 PointsNumber = pElementOld->GetGeometry().PointsNumber();
853 Vector ShapeFunctionsValuesVector(PointsNumber);
854 Vector NodalVariableVector(PointsNumber);
856 pElementOld->GetGeometry().ShapeFunctionsValues(ShapeFunctionsValuesVector,LocalCoordinates);
859 if( itNodeNew->IsFixed(DISPLACEMENT_X)==
false )
861 for(
int j = 0;
j < PointsNumber;
j++)
863 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(DISPLACEMENT_X);
865 itNodeNew->FastGetSolutionStepValue(DISPLACEMENT_X) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
867 if( itNodeNew->IsFixed(VELOCITY_X)==
false )
869 for(
int j = 0;
j < PointsNumber;
j++)
871 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(VELOCITY_X);
873 itNodeNew->FastGetSolutionStepValue(VELOCITY_X) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
875 if( itNodeNew->IsFixed(ACCELERATION_X)==
false )
877 for(
int j = 0;
j < PointsNumber;
j++)
879 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(ACCELERATION_X);
881 itNodeNew->FastGetSolutionStepValue(ACCELERATION_X) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
883 if( itNodeNew->IsFixed(DISPLACEMENT_Y)==
false )
885 for(
int j = 0;
j < PointsNumber;
j++)
887 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(DISPLACEMENT_Y);
889 itNodeNew->FastGetSolutionStepValue(DISPLACEMENT_Y) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
891 if( itNodeNew->IsFixed(VELOCITY_Y)==
false )
893 for(
int j = 0;
j < PointsNumber;
j++)
895 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(VELOCITY_Y);
897 itNodeNew->FastGetSolutionStepValue(VELOCITY_Y) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
899 if( itNodeNew->IsFixed(ACCELERATION_Y)==
false )
901 for(
int j = 0;
j < PointsNumber;
j++)
903 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(ACCELERATION_Y);
905 itNodeNew->FastGetSolutionStepValue(ACCELERATION_Y) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
907 if( itNodeNew->IsFixed(DISPLACEMENT_Z)==
false )
909 for(
int j = 0;
j < PointsNumber;
j++)
911 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(DISPLACEMENT_Z);
913 itNodeNew->FastGetSolutionStepValue(DISPLACEMENT_Z) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
915 if( itNodeNew->IsFixed(VELOCITY_Z)==
false )
917 for(
int j = 0;
j < PointsNumber;
j++)
919 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(VELOCITY_Z);
921 itNodeNew->FastGetSolutionStepValue(VELOCITY_Z) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
923 if( itNodeNew->IsFixed(ACCELERATION_Z)==
false )
925 for(
int j = 0;
j < PointsNumber;
j++)
927 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(ACCELERATION_Z);
929 itNodeNew->FastGetSolutionStepValue(ACCELERATION_Z) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
931 if( itNodeNew->IsFixed(WATER_PRESSURE)==
false )
933 for(
int j = 0;
j < PointsNumber;
j++)
935 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(WATER_PRESSURE);
937 itNodeNew->FastGetSolutionStepValue(WATER_PRESSURE) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
938 for(
int j = 0;
j < PointsNumber;
j++)
940 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(DT_WATER_PRESSURE);
942 itNodeNew->FastGetSolutionStepValue(DT_WATER_PRESSURE) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
956 std::vector< std::vector< std::vector< std::vector<GaussPointOld> > > > BodyGaussPointOldCellMatrix;
957 BodyGaussPointOldCellMatrix.resize(AuxVariables.
NRows);
958 for(
int i = 0;
i < AuxVariables.
NRows;
i++)
959 BodyGaussPointOldCellMatrix[
i].resize(AuxVariables.
NColumns);
960 for(
int i = 0;
i < AuxVariables.
NRows;
i++)
964 BodyGaussPointOldCellMatrix[
i][
j].resize(AuxVariables.
NSections);
968 std::vector< std::vector< std::vector< std::vector<GaussPointOld> > > > InterfaceGaussPointOldCellMatrix;
969 InterfaceGaussPointOldCellMatrix.resize(AuxVariables.
NRows);
970 for(
int i = 0;
i < AuxVariables.
NRows;
i++)
971 InterfaceGaussPointOldCellMatrix[
i].resize(AuxVariables.
NColumns);
972 for(
int i = 0;
i < AuxVariables.
NRows;
i++)
976 InterfaceGaussPointOldCellMatrix[
i][
j].resize(AuxVariables.
NSections);
986 unsigned int NumBodySubModelParts = rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"].
size();
989 for(
unsigned int i = 0;
i < NumBodySubModelParts;
i++)
991 ModelPart& SubModelPart = rModelPartOld.
GetSubModelPart(rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"][
i].GetString());
993 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
994 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
996 #pragma omp parallel for private(MyGaussPointOld,MyIntegrationMethod,AuxLocalCoordinates)
997 for(
int j = 0;
j < NElems;
j++)
999 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
1002 MyIntegrationMethod = itElem->GetIntegrationMethod();
1004 unsigned int NumGPoints = IntegrationPoints.size();
1005 Vector detJContainer(NumGPoints);
1007 std::vector<double> StateVariableVector(NumGPoints);
1008 itElem->CalculateOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfoOld);
1014 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
1017 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
1018 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
1019 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
1023 MyGaussPointOld.
Weight = detJContainer[GPoint]*IntegrationPoints[GPoint].Weight();
1026 MyGaussPointOld.
StateVariable = StateVariableVector[GPoint];
1032 #pragma omp critical
1034 BodyGaussPointOldCellMatrix[Row][Column][Section].push_back(MyGaussPointOld);
1040 unsigned int NumInterfaceSubModelPartsOld = rParameters[
"fracture_data"][
"interface_domain_sub_model_part_old_list"].
size();
1043 for(
unsigned int i = 0;
i < NumInterfaceSubModelPartsOld;
i++)
1045 ModelPart& SubModelPart = rModelPartOld.
GetSubModelPart(rParameters[
"fracture_data"][
"interface_domain_sub_model_part_old_list"][
i].GetString());
1047 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
1048 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
1050 #pragma omp parallel for private(MyGaussPointOld,MyIntegrationMethod,AuxLocalCoordinates)
1051 for(
int j = 0;
j < NElems;
j++)
1053 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
1058 unsigned int NumGPoints = IntegrationPoints.size();
1059 Vector detJContainer(NumGPoints);
1061 std::vector<double> StateVariableVector(NumGPoints);
1062 itElem->CalculateOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfoOld);
1068 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
1071 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
1072 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
1073 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
1077 MyGaussPointOld.
Weight = detJContainer[GPoint]*IntegrationPoints[GPoint].Weight();
1080 MyGaussPointOld.
StateVariable = StateVariableVector[GPoint];
1086 #pragma omp critical
1088 InterfaceGaussPointOldCellMatrix[Row][Column][Section].push_back(MyGaussPointOld);
1096 const double PropagationLength = rParameters[
"fracture_data"][
"propagation_length"].
GetDouble();
1100 for(
unsigned int i = 0;
i < NumBodySubModelParts;
i++)
1102 ModelPart& SubModelPart = rModelPartNew.
GetSubModelPart(rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"][
i].GetString());
1104 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
1105 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
1107 double DamageThreshold = el_begin->GetProperties()[DAMAGE_THRESHOLD];
1109 #pragma omp parallel for private(MyIntegrationMethod,AuxLocalCoordinates,AuxGlobalCoordinates)
1110 for(
int j = 0;
j < NElems;
j++)
1112 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
1115 MyIntegrationMethod = itElem->GetIntegrationMethod();
1117 unsigned int NumGPoints = IntegrationPoints.size();
1118 std::vector<double> StateVariableVector(NumGPoints);
1121 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
1124 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
1125 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
1126 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
1128 double X_me = AuxGlobalCoordinates[0];
1129 double Y_me = AuxGlobalCoordinates[1];
1130 double Z_me = AuxGlobalCoordinates[2];
1133 double X_left = X_me - PropagationLength;
1134 double X_right = X_me + PropagationLength;
1135 double Y_top = Y_me + PropagationLength;
1136 double Y_bot = Y_me - PropagationLength;
1137 double Z_back = Z_me - PropagationLength;
1138 double Z_front = Z_me + PropagationLength;
1147 if(Column_left < 0) Column_left = 0;
1148 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
1149 if(Row_top < 0) Row_top = 0;
1150 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
1151 if(Section_back < 0) Section_back = 0;
1152 if(Section_front >= AuxVariables.
NSections) Section_front = AuxVariables.
NSections-1;
1155 double Numerator = 0.0;
1156 double WeightingFunctionDenominator = 0.0;
1158 for(
int s = Section_back; s <= Section_front; s++)
1160 for(
int k = Row_top;
k <= Row_bot;
k++)
1162 for(
int l = Column_left;
l<= Column_right;
l++)
1164 for(
unsigned int m = 0;
m < BodyGaussPointOldCellMatrix[
k][
l][s].size();
m++)
1166 GaussPointOld& rOtherGaussPointOld = BodyGaussPointOldCellMatrix[
k][
l][s][
m];
1172 if(Distance <= PropagationLength)
1174 Numerator += rOtherGaussPointOld.
Weight
1175 *exp(-4.0*Distance*Distance/(PropagationLength*PropagationLength))
1177 WeightingFunctionDenominator += rOtherGaussPointOld.
Weight
1178 *exp(-4.0*Distance*Distance/(PropagationLength*PropagationLength));
1185 if(WeightingFunctionDenominator > 0.0)
1186 StateVariableVector[GPoint] = Numerator/WeightingFunctionDenominator;
1188 StateVariableVector[GPoint] = DamageThreshold;
1191 itElem->SetValuesOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfoNew);
1195 unsigned int NumInterfaceSubModelParts = rParameters[
"fracture_data"][
"interface_domain_sub_model_part_list"].
size();
1196 const double PropagationDamage = rParameters[
"fracture_data"][
"propagation_damage"].
GetDouble();
1199 for(
unsigned int i = 0;
i < NumInterfaceSubModelParts;
i++)
1201 ModelPart& SubModelPart = rModelPartNew.
GetSubModelPart(rParameters[
"fracture_data"][
"interface_domain_sub_model_part_list"][
i].GetString());
1203 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
1204 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
1208 #pragma omp parallel for private(MyIntegrationMethod,AuxLocalCoordinates,AuxGlobalCoordinates)
1209 for(
int j = 0;
j < NElems;
j++)
1211 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
1216 unsigned int NumGPoints = IntegrationPoints.size();
1217 std::vector<double> StateVariableVector(NumGPoints);
1220 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
1223 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
1224 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
1225 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
1227 double X_me = AuxGlobalCoordinates[0];
1228 double Y_me = AuxGlobalCoordinates[1];
1229 double Z_me = AuxGlobalCoordinates[2];
1232 double X_left = X_me - PropagationLength;
1233 double X_right = X_me + PropagationLength;
1234 double Y_top = Y_me + PropagationLength;
1235 double Y_bot = Y_me - PropagationLength;
1236 double Z_back = Z_me - PropagationLength;
1237 double Z_front = Z_me + PropagationLength;
1246 if(Column_left < 0) Column_left = 0;
1247 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
1248 if(Row_top < 0) Row_top = 0;
1249 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
1250 if(Section_back < 0) Section_back = 0;
1251 if(Section_front >= AuxVariables.
NSections) Section_front = AuxVariables.
NSections-1;
1254 double Numerator = 0.0;
1255 double WeightingFunctionDenominator = 0.0;
1257 for(
int s = Section_back; s <= Section_front; s++)
1259 for(
int k = Row_top;
k <= Row_bot;
k++)
1261 for(
int l = Column_left;
l<= Column_right;
l++)
1263 for(
unsigned int m = 0;
m < InterfaceGaussPointOldCellMatrix[
k][
l][s].size();
m++)
1265 GaussPointOld& rOtherGaussPointOld = InterfaceGaussPointOldCellMatrix[
k][
l][s][
m];
1271 if(Distance <= PropagationLength)
1273 Numerator += rOtherGaussPointOld.
Weight
1274 *exp(-4.0*Distance*Distance/(PropagationLength*PropagationLength))
1276 WeightingFunctionDenominator += rOtherGaussPointOld.
Weight
1277 *exp(-4.0*Distance*Distance/(PropagationLength*PropagationLength));
1285 if(WeightingFunctionDenominator > 0.0)
1287 StateVariableVector[GPoint] = Numerator/WeightingFunctionDenominator;
1288 if(StateVariableVector[GPoint] < PropagationDamage)
1290 StateVariableVector[GPoint] = PropagationDamage;
1294 StateVariableVector[GPoint] = PropagationDamage;
1297 itElem->SetValuesOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfoNew);
1307 const int NNodes =
static_cast<int>(rModelPart.
Nodes().size());
1308 ModelPart::NodesContainerType::iterator node_begin = rModelPart.
NodesBegin();
1310 #pragma omp parallel for
1311 for(
int i = 0;
i < NNodes;
i++)
1313 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
1315 itNode->X() = itNode->X0();
1316 itNode->Y() = itNode->Y0();
1317 itNode->Z() = itNode->Z0();
1326 const int NNodes =
static_cast<int>(rModelPart.
Nodes().size());
1327 ModelPart::NodesContainerType::iterator node_begin = rModelPart.
NodesBegin();
1329 #pragma omp parallel for
1330 for(
int i = 0;
i < NNodes;
i++)
1332 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
1334 itNode->X() = itNode->X0() + itNode->FastGetSolutionStepValue(DISPLACEMENT_X);
1335 itNode->Y() = itNode->Y0() + itNode->FastGetSolutionStepValue(DISPLACEMENT_Y);
1336 itNode->Z() = itNode->Z0() + itNode->FastGetSolutionStepValue(DISPLACEMENT_Z);
1344 void ComputeCellMatrixDimensions(
1345 UtilityVariables& rAuxVariables,
1350 std::vector<double> X_max_partition(NumThreads);
1351 std::vector<double> X_min_partition(NumThreads);
1352 std::vector<double> Y_max_partition(NumThreads);
1353 std::vector<double> Y_min_partition(NumThreads);
1354 std::vector<double> Z_max_partition(NumThreads);
1355 std::vector<double> Z_min_partition(NumThreads);
1357 const int NNodes =
static_cast<int>(rModelPart.
Nodes().size());
1358 ModelPart::NodesContainerType::iterator node_begin = rModelPart.
NodesBegin();
1360 #pragma omp parallel
1364 X_max_partition[
k] = node_begin->X();
1365 X_min_partition[
k] = X_max_partition[
k];
1366 Y_max_partition[
k] = node_begin->Y();
1367 Y_min_partition[
k] = Y_max_partition[
k];
1368 Z_max_partition[
k] = node_begin->Z();
1369 Z_min_partition[
k] = Z_max_partition[
k];
1371 double X_me, Y_me, Z_me;
1374 for(
int i = 0;
i < NNodes;
i++)
1376 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
1382 if( X_me > X_max_partition[
k] ) X_max_partition[
k] = X_me;
1383 else if( X_me < X_min_partition[
k] ) X_min_partition[
k] = X_me;
1385 if( Y_me > Y_max_partition[
k] ) Y_max_partition[
k] = Y_me;
1386 else if( Y_me < Y_min_partition[
k] ) Y_min_partition[
k] = Y_me;
1388 if( Z_me > Z_max_partition[
k] ) Z_max_partition[
k] = Z_me;
1389 else if( Z_me < Z_min_partition[
k] ) Z_min_partition[
k] = Z_me;
1393 rAuxVariables.X_max = X_max_partition[0];
1394 rAuxVariables.X_min = X_min_partition[0];
1395 rAuxVariables.Y_max = Y_max_partition[0];
1396 rAuxVariables.Y_min = Y_min_partition[0];
1397 rAuxVariables.Z_max = Z_max_partition[0];
1398 rAuxVariables.Z_min = Z_min_partition[0];
1400 for(
unsigned int i=1;
i < NumThreads;
i++)
1402 if(X_max_partition[
i] > rAuxVariables.X_max) rAuxVariables.X_max = X_max_partition[
i];
1403 if(X_min_partition[
i] < rAuxVariables.X_min) rAuxVariables.X_min = X_min_partition[
i];
1404 if(Y_max_partition[
i] > rAuxVariables.Y_max) rAuxVariables.Y_max = Y_max_partition[
i];
1405 if(Y_min_partition[
i] < rAuxVariables.Y_min) rAuxVariables.Y_min = Y_min_partition[
i];
1406 if(Z_max_partition[
i] > rAuxVariables.Z_max) rAuxVariables.Z_max = Z_max_partition[
i];
1407 if(Z_min_partition[
i] < rAuxVariables.Z_min) rAuxVariables.Z_min = Z_min_partition[
i];
1411 double AverageElementLength = 0.0;
1413 int NElems =
static_cast<int>(rModelPart.
Elements().size());
1414 ModelPart::ElementsContainerType::iterator el_begin = rModelPart.
ElementsBegin();
1416 #pragma omp parallel for reduction(+:AverageElementLength)
1417 for(
int i = 0;
i < NElems;
i++)
1419 ModelPart::ElementsContainerType::iterator itElem = el_begin +
i;
1421 AverageElementLength += itElem->GetGeometry().Length();
1424 AverageElementLength = AverageElementLength/NElems;
1427 rAuxVariables.NRows =
int((rAuxVariables.Y_max-rAuxVariables.Y_min)/AverageElementLength);
1428 rAuxVariables.NColumns =
int((rAuxVariables.X_max-rAuxVariables.X_min)/AverageElementLength);
1429 rAuxVariables.NSections =
int((rAuxVariables.Z_max-rAuxVariables.Z_min)/AverageElementLength);
1430 if(rAuxVariables.NRows <= 0) rAuxVariables.NRows = 1;
1431 if(rAuxVariables.NColumns <= 0) rAuxVariables.NColumns = 1;
1432 if(rAuxVariables.NSections <= 0) rAuxVariables.NSections = 1;
1433 rAuxVariables.RowSize = (rAuxVariables.Y_max-rAuxVariables.Y_min)/rAuxVariables.NRows;
1434 rAuxVariables.ColumnSize = (rAuxVariables.X_max-rAuxVariables.X_min)/rAuxVariables.NColumns;
1435 rAuxVariables.SectionSize = (rAuxVariables.Z_max-rAuxVariables.Z_min)/rAuxVariables.NSections;
1440 void SetFracturePoints(
1441 PropagationGlobalVariables& rPropagationData,
1442 UtilityVariables& rAuxVariables,
1443 Parameters& rParameters,
1444 ModelPart& rModelPart)
1447 this->ComputeCellMatrixDimensions(rAuxVariables,rModelPart);
1449 rPropagationData.FracturePointsCellMatrix.resize(rAuxVariables.NRows);
1450 for(
int i = 0;
i < rAuxVariables.NRows;
i++)
1451 rPropagationData.FracturePointsCellMatrix[
i].resize(rAuxVariables.NColumns);
1452 for(
int i = 0;
i < rAuxVariables.NRows;
i++)
1454 for(
int j = 0;
j < rAuxVariables.NColumns;
j++)
1456 rPropagationData.FracturePointsCellMatrix[
i][
j].resize(rAuxVariables.NSections);
1461 FracturePoint MyFracturePoint;
1463 const ProcessInfo& CurrentProcessInfo = rModelPart.GetProcessInfo();
1464 rPropagationData.pProcessInfo = rModelPart.pGetProcessInfo();
1465 array_1d<double,3> AuxLocalCoordinates;
1467 unsigned int NumBodySubModelParts = rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"].size();
1470 for(
unsigned int i = 0;
i < NumBodySubModelParts;
i++)
1472 ModelPart& BodySubModelPart = rModelPart.
GetSubModelPart(rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"][
i].GetString());
1474 int NElems =
static_cast<int>(BodySubModelPart.Elements().size());
1475 ModelPart::ElementsContainerType::iterator el_begin = BodySubModelPart.
ElementsBegin();
1478 #pragma omp parallel for private(MyFracturePoint,MyIntegrationMethod,AuxLocalCoordinates)
1479 for(
int j = 0;
j < NElems;
j++)
1481 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
1484 MyIntegrationMethod = itElem->GetIntegrationMethod();
1486 unsigned int NumGPoints = IntegrationPoints.size();
1487 Vector detJContainer(NumGPoints);
1488 rGeom.DeterminantOfJacobian(detJContainer,MyIntegrationMethod);
1489 std::vector<double> DamageVector(NumGPoints);
1490 itElem->CalculateOnIntegrationPoints(DAMAGE_VARIABLE,DamageVector,CurrentProcessInfo);
1496 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
1499 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
1500 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
1501 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
1502 rGeom.GlobalCoordinates(MyFracturePoint.Coordinates,AuxLocalCoordinates);
1505 MyFracturePoint.Weight = detJContainer[GPoint]*IntegrationPoints[GPoint].Weight();
1508 MyFracturePoint.Damage = DamageVector[GPoint];
1511 Row =
int((rAuxVariables.Y_max-MyFracturePoint.Coordinates[1])/rAuxVariables.RowSize);
1512 Column =
int((MyFracturePoint.Coordinates[0]-rAuxVariables.X_min)/rAuxVariables.ColumnSize);
1513 Section =
int((MyFracturePoint.Coordinates[2]-rAuxVariables.Z_min)/rAuxVariables.SectionSize);
1516 MyFracturePoint.pElement = (*(itElem.base()));
1518 #pragma omp critical
1520 rPropagationData.FracturePointsCellMatrix[Row][Column][Section].push_back(MyFracturePoint);
1529 void PropagateFracture(
1530 const unsigned int& itFracture,
1531 PropagationGlobalVariables& rPropagationData,
1532 PropagationLocalVariables& rAuxPropagationVariables,
1533 Parameters& rParameters)
1539 double TipDen = 0.0;
1541 #pragma omp parallel sections reduction(+:TipX,TipY,TipZ,TipDen)
1545 for(
unsigned int i = 0;
i < rAuxPropagationVariables.TopFrontFracturePoints.size();
i++)
1547 this->AverageTipCoordinates(TipX,TipY,TipZ,TipDen,*(rAuxPropagationVariables.TopFrontFracturePoints[
i]));
1552 for(
unsigned int i = 0;
i < rAuxPropagationVariables.BotFrontFracturePoints.size();
i++)
1554 this->AverageTipCoordinates(TipX,TipY,TipZ,TipDen,*(rAuxPropagationVariables.BotFrontFracturePoints[
i]));
1559 array_1d<double,3> AuxArray1;
1560 array_1d<double,3> AuxArray2;
1561 const double PropagationLength = rParameters[
"fracture_data"][
"propagation_length"].GetDouble();
1562 const double PropagationWidth = rParameters[
"fracture_data"][
"propagation_width"].GetDouble();
1563 const double PropagationHeight = rParameters[
"fracture_data"][
"propagation_height"].GetDouble();
1564 int MotherFractureId = rParameters[
"fractures_list"][itFracture][
"id"].GetInt();
1565 Propagation MyPropagation;
1567 MyPropagation.MotherFractureId = MotherFractureId;
1569 MyPropagation.TipCoordinates[0] = TipX/TipDen;
1570 MyPropagation.TipCoordinates[1] = TipY/TipDen;
1571 MyPropagation.TipCoordinates[2] = TipZ/TipDen;
1574 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1575 AuxArray1[1] += 0.5*PropagationHeight;
1576 noalias(MyPropagation.LeftInitCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1578 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1579 AuxArray1[1] -= 0.5*PropagationHeight;
1580 noalias(MyPropagation.RightInitCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1582 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1583 AuxArray1[2] += 0.5*PropagationWidth;
1584 noalias(MyPropagation.TopInitCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1586 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1587 AuxArray1[2] -= 0.5*PropagationWidth;
1588 noalias(MyPropagation.BotInitCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1591 const double CorrectionTol = rParameters[
"fracture_data"][
"correction_tolerance"].GetDouble();
1592 noalias(AuxArray2) = MyPropagation.TipCoordinates;
1593 noalias(AuxArray1) =
prod(rAuxPropagationVariables.RotationMatrix,AuxArray2);
1594 AuxArray1[1] = rAuxPropagationVariables.TipLocalCoordinates[1];
1595 AuxArray1[2] = rAuxPropagationVariables.TipLocalCoordinates[2];
1596 noalias(AuxArray2) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1598 double Distance = sqrt((MyPropagation.TipCoordinates[0]-AuxArray2[0])*(MyPropagation.TipCoordinates[0]-AuxArray2[0])+
1599 (MyPropagation.TipCoordinates[1]-AuxArray2[1])*(MyPropagation.TipCoordinates[1]-AuxArray2[1])+
1600 (MyPropagation.TipCoordinates[2]-AuxArray2[2])*(MyPropagation.TipCoordinates[2]-AuxArray2[2]));
1601 if (Distance <= PropagationLength*CorrectionTol)
1602 noalias(MyPropagation.TipCoordinates) = AuxArray2;
1605 array_1d<double,3> LocalCoordinates;
1606 Element::Pointer pElement;
1607 bool IsInside =
false;
1609 for(
unsigned int i = 0;
i < rAuxPropagationVariables.TopFrontFracturePoints.size();
i++)
1611 pElement = rAuxPropagationVariables.TopFrontFracturePoints[
i]->pElement;
1612 IsInside = pElement->GetGeometry().IsInside(MyPropagation.TipCoordinates,LocalCoordinates);
1615 if(IsInside ==
false)
1617 for(
unsigned int i = 0;
i < rAuxPropagationVariables.BotFrontFracturePoints.size();
i++)
1619 pElement = rAuxPropagationVariables.BotFrontFracturePoints[
i]->pElement;
1620 IsInside = pElement->GetGeometry().IsInside(MyPropagation.TipCoordinates,LocalCoordinates);
1625 double PropagationDistance = 0.1*PropagationLength;
1626 const double PropagationDamage = rParameters[
"fracture_data"][
"propagation_damage"].GetDouble();
1627 const ProcessInfo& CurrentProcessInfo = *(rPropagationData.pProcessInfo);
1629 if (IsInside ==
true)
1631 std::vector<double> DamageVector;
1632 pElement->CalculateOnIntegrationPoints(DAMAGE_VARIABLE,DamageVector,CurrentProcessInfo);
1633 unsigned int NumGPoints = DamageVector.size();
1634 double InvNumGPoints = 1.0/
static_cast<double>(NumGPoints);
1635 double ElementDamage = 0.0;
1636 for (
unsigned int i = 0;
i < NumGPoints;
i++)
1638 ElementDamage += DamageVector[
i];
1640 ElementDamage *= InvNumGPoints;
1641 if (ElementDamage >= 0.5*PropagationDamage)
1644 this->CalculateNewTipRotationMatrix(rAuxPropagationVariables,MyPropagation.TipCoordinates,
1645 MyPropagation.LeftInitCoordinates,PropagationDistance);
1647 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1648 AuxArray1[1] += 0.5*PropagationHeight;
1649 noalias(MyPropagation.LeftEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1651 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1652 AuxArray1[1] -= 0.5*PropagationHeight;
1653 noalias(MyPropagation.RightEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1655 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1656 AuxArray1[2] += 0.5*PropagationWidth;
1657 noalias(MyPropagation.TopEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1659 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1660 AuxArray1[2] -= 0.5*PropagationWidth;
1661 noalias(MyPropagation.BotEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1663 rPropagationData.PropagationVector.push_back(MyPropagation);
1664 rPropagationData.PropagateFractures =
true;
1670 bool PropagateTop =
false;
1671 bool PropagateBot =
false;
1672 double TopEndX = 0.0;
1673 double TopEndY = 0.0;
1674 double TopEndZ = 0.0;
1675 double TopEndDen = 0.0;
1676 double BotEndX = 0.0;
1677 double BotEndY = 0.0;
1678 double BotEndZ = 0.0;
1679 double BotEndDen = 0.0;
1680 array_1d<double,3> GlobalCoordinates;
1682 #pragma omp parallel sections private(GlobalCoordinates,LocalCoordinates,pElement,IsInside)
1686 for(
unsigned int i = 0;
i < rAuxPropagationVariables.TopFrontFracturePoints.size();
i++)
1688 this->AverageTipCoordinates(TopEndX,TopEndY,TopEndZ,TopEndDen,*(rAuxPropagationVariables.TopFrontFracturePoints[
i]));
1690 GlobalCoordinates[0] = TopEndX/TopEndDen;
1691 GlobalCoordinates[1] = TopEndY/TopEndDen;
1692 GlobalCoordinates[2] = TopEndZ/TopEndDen;
1696 for(
unsigned int i = 0;
i < rAuxPropagationVariables.TopFrontFracturePoints.size();
i++)
1698 pElement = rAuxPropagationVariables.TopFrontFracturePoints[
i]->pElement;
1699 IsInside = pElement->GetGeometry().IsInside(GlobalCoordinates,LocalCoordinates);
1703 if (IsInside ==
true)
1705 std::vector<double> DamageVector;
1706 pElement->CalculateOnIntegrationPoints(DAMAGE_VARIABLE,DamageVector,CurrentProcessInfo);
1707 unsigned int NumGPoints = DamageVector.size();
1708 double InvNumGPoints = 1.0/
static_cast<double>(NumGPoints);
1709 double ElementDamage = 0.0;
1710 for (
unsigned int i = 0;
i < NumGPoints;
i++)
1712 ElementDamage += DamageVector[
i];
1714 ElementDamage *= InvNumGPoints;
1715 if (ElementDamage >= PropagationDamage)
1716 PropagateTop =
true;
1721 for(
unsigned int i = 0;
i < rAuxPropagationVariables.BotFrontFracturePoints.size();
i++)
1723 this->AverageTipCoordinates(BotEndX,BotEndY,BotEndZ,BotEndDen,*(rAuxPropagationVariables.BotFrontFracturePoints[
i]));
1725 GlobalCoordinates[0] = BotEndX/BotEndDen;
1726 GlobalCoordinates[1] = BotEndY/BotEndDen;
1727 GlobalCoordinates[2] = BotEndZ/BotEndDen;
1731 for(
unsigned int i = 0;
i < rAuxPropagationVariables.BotFrontFracturePoints.size();
i++)
1733 pElement = rAuxPropagationVariables.BotFrontFracturePoints[
i]->pElement;
1734 IsInside = pElement->GetGeometry().IsInside(GlobalCoordinates,LocalCoordinates);
1738 if (IsInside ==
true)
1740 std::vector<double> DamageVector;
1741 pElement->CalculateOnIntegrationPoints(DAMAGE_VARIABLE,DamageVector,CurrentProcessInfo);
1742 unsigned int NumGPoints = DamageVector.size();
1743 double InvNumGPoints = 1.0/
static_cast<double>(NumGPoints);
1744 double ElementDamage = 0.0;
1745 for (
unsigned int i = 0;
i < NumGPoints;
i++)
1747 ElementDamage += DamageVector[
i];
1749 ElementDamage *= InvNumGPoints;
1750 if (ElementDamage >= PropagationDamage)
1751 PropagateBot =
true;
1756 if (PropagateTop ==
true && PropagateBot ==
true)
1758 Bifurcation MyBifurcation;
1759 MyBifurcation.MotherFractureId = MotherFractureId;
1761 MyBifurcation.TopTipCoordinates[0] = TopEndX/TopEndDen;
1762 MyBifurcation.TopTipCoordinates[1] = TopEndY/TopEndDen;
1763 MyBifurcation.TopTipCoordinates[2] = TopEndZ/TopEndDen;
1765 MyBifurcation.BotTipCoordinates[0] = BotEndX/BotEndDen;
1766 MyBifurcation.BotTipCoordinates[1] = BotEndY/BotEndDen;
1767 MyBifurcation.BotTipCoordinates[2] = BotEndZ/BotEndDen;
1770 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1771 AuxArray1[0] -= PropagationDistance;
1772 AuxArray1[1] += 0.5*PropagationHeight;
1773 noalias(MyBifurcation.LeftInitCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1775 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1776 AuxArray1[0] -= PropagationDistance;
1777 AuxArray1[1] -= 0.5*PropagationHeight;
1778 noalias(MyBifurcation.RightInitCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1780 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1781 AuxArray1[0] -= PropagationDistance;
1782 AuxArray1[2] += 0.5*PropagationWidth;
1783 noalias(MyBifurcation.TopInitCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1785 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1786 AuxArray1[0] -= PropagationDistance;
1787 AuxArray1[2] -= 0.5*PropagationWidth;
1788 noalias(MyBifurcation.BotInitCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1791 this->CalculateNewTipRotationMatrix(rAuxPropagationVariables,MyBifurcation.TopTipCoordinates,
1792 MyBifurcation.LeftInitCoordinates,PropagationDistance);
1794 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1795 AuxArray1[1] += 0.5*PropagationHeight;
1796 noalias(MyBifurcation.TopLeftEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1798 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1799 AuxArray1[1] -= 0.5*PropagationHeight;
1800 noalias(MyBifurcation.TopRightEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1802 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1803 AuxArray1[2] += 0.5*PropagationWidth;
1804 noalias(MyBifurcation.TopTopEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1806 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1807 AuxArray1[2] -= 0.5*PropagationWidth;
1808 noalias(MyBifurcation.TopBotEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1811 this->CalculateNewTipRotationMatrix(rAuxPropagationVariables,MyBifurcation.BotTipCoordinates,
1812 MyBifurcation.LeftInitCoordinates,PropagationDistance);
1814 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1815 AuxArray1[1] += 0.5*PropagationHeight;
1816 noalias(MyBifurcation.BotLeftEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1818 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1819 AuxArray1[1] -= 0.5*PropagationHeight;
1820 noalias(MyBifurcation.BotRightEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1822 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1823 AuxArray1[2] += 0.5*PropagationWidth;
1824 noalias(MyBifurcation.BotTopEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1826 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1827 AuxArray1[2] -= 0.5*PropagationWidth;
1828 noalias(MyBifurcation.BotBotEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1830 rPropagationData.BifurcationVector.push_back(MyBifurcation);
1831 rPropagationData.PropagateFractures =
true;
1834 else if (PropagateTop ==
true)
1836 MyPropagation.TipCoordinates[0] = TopEndX/TopEndDen;
1837 MyPropagation.TipCoordinates[1] = TopEndY/TopEndDen;
1838 MyPropagation.TipCoordinates[2] = TopEndZ/TopEndDen;
1841 this->CalculateNewTipRotationMatrix(rAuxPropagationVariables,MyPropagation.TipCoordinates,
1842 MyPropagation.LeftInitCoordinates,PropagationDistance);
1844 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1845 AuxArray1[1] += 0.5*PropagationHeight;
1846 noalias(MyPropagation.LeftEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1848 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1849 AuxArray1[1] -= 0.5*PropagationHeight;
1850 noalias(MyPropagation.RightEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1852 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1853 AuxArray1[2] += 0.5*PropagationWidth;
1854 noalias(MyPropagation.TopEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1856 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1857 AuxArray1[2] -= 0.5*PropagationWidth;
1858 noalias(MyPropagation.BotEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1860 rPropagationData.PropagationVector.push_back(MyPropagation);
1861 rPropagationData.PropagateFractures =
true;
1864 else if (PropagateBot ==
true)
1866 MyPropagation.TipCoordinates[0] = BotEndX/BotEndDen;
1867 MyPropagation.TipCoordinates[1] = BotEndY/BotEndDen;
1868 MyPropagation.TipCoordinates[2] = BotEndZ/BotEndDen;
1871 this->CalculateNewTipRotationMatrix(rAuxPropagationVariables,MyPropagation.TipCoordinates,
1872 MyPropagation.LeftInitCoordinates,PropagationDistance);
1874 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1875 AuxArray1[1] += 0.5*PropagationHeight;
1876 noalias(MyPropagation.LeftEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1878 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1879 AuxArray1[1] -= 0.5*PropagationHeight;
1880 noalias(MyPropagation.RightEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1882 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1883 AuxArray1[2] += 0.5*PropagationWidth;
1884 noalias(MyPropagation.TopEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1886 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1887 AuxArray1[2] -= 0.5*PropagationWidth;
1888 noalias(MyPropagation.BotEndCoordinates) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1890 rPropagationData.PropagationVector.push_back(MyPropagation);
1891 rPropagationData.PropagateFractures =
true;
1898 void CalculateTipRotationMatrix(
1899 BoundedMatrix<double,3,3>& rRotationMatrix,
1900 const array_1d<double,3>& TipPointCoordinates,
1901 const array_1d<double,3>& LeftPointCoordinates,
1902 const array_1d<double,3>& RightPointCoordinates)
1904 array_1d<double, 3> CenterPoint;
1905 noalias(CenterPoint) = 0.5 * (LeftPointCoordinates + RightPointCoordinates);
1908 array_1d<double, 3> Vx;
1909 noalias(Vx) = TipPointCoordinates - CenterPoint;
1910 double inv_norm = 1.0/
norm_2(Vx);
1916 array_1d<double, 3> Vy;
1917 noalias(Vy) = LeftPointCoordinates - CenterPoint;
1919 array_1d<double, 3> Vz;
1921 inv_norm = 1.0/
norm_2(Vz);
1930 rRotationMatrix(0,0) = Vx[0];
1931 rRotationMatrix(0,1) = Vx[1];
1932 rRotationMatrix(0,2) = Vx[2];
1934 rRotationMatrix(1,0) = Vy[0];
1935 rRotationMatrix(1,1) = Vy[1];
1936 rRotationMatrix(1,2) = Vy[2];
1938 rRotationMatrix(2,0) = Vz[0];
1939 rRotationMatrix(2,1) = Vz[1];
1940 rRotationMatrix(2,2) = Vz[2];
1945 void AverageTipCoordinates(
1949 double& rTipDenominator,
1950 const FracturePoint& MyFracturePoint)
1952 rTipX += MyFracturePoint.Weight * MyFracturePoint.Damage * (MyFracturePoint.Coordinates[0]);
1953 rTipY += MyFracturePoint.Weight * MyFracturePoint.Damage * (MyFracturePoint.Coordinates[1]);
1954 rTipZ += MyFracturePoint.Weight * MyFracturePoint.Damage * (MyFracturePoint.Coordinates[2]);
1955 rTipDenominator += MyFracturePoint.Weight * MyFracturePoint.Damage;
1960 void CalculateNewTipRotationMatrix(
1961 PropagationLocalVariables& rAuxPropagationVariables,
1962 const array_1d<double,3>& NewTipCoordinates,
1963 const array_1d<double,3>& LeftInitCoordinates,
1964 const double& PropagationDistance)
1967 array_1d<double,3> Vx;
1968 noalias(Vx) = NewTipCoordinates - rAuxPropagationVariables.TipCoordinates;
1969 double inv_norm = 1.0/
norm_2(Vx);
1974 array_1d<double,3> CenterPoint;
1975 noalias(CenterPoint) = rAuxPropagationVariables.TipCoordinates + PropagationDistance*(Vx);
1977 array_1d<double,3> LeftLine;
1978 noalias(LeftLine) = NewTipCoordinates - LeftInitCoordinates;
1980 const double Lambda = (Vx[0]*(CenterPoint[0]-LeftInitCoordinates[0])+Vx[1]*(CenterPoint[1]-LeftInitCoordinates[1])+
1981 Vx[2]*(CenterPoint[2]-LeftInitCoordinates[2]))/(LeftLine[0]*Vx[0]+LeftLine[1]*Vx[1]+LeftLine[2]*Vx[2]);
1983 array_1d<double,3> LeftPoint;
1984 noalias(LeftPoint) = LeftInitCoordinates + Lambda*LeftLine;
1987 array_1d<double,3> Vy;
1988 noalias(Vy) = LeftPoint - CenterPoint;
1990 array_1d<double,3> Vz;
1992 inv_norm = 1.0/
norm_2(Vz);
2001 rAuxPropagationVariables.RotationMatrix(0,0) = Vx[0];
2002 rAuxPropagationVariables.RotationMatrix(0,1) = Vx[1];
2003 rAuxPropagationVariables.RotationMatrix(0,2) = Vx[2];
2005 rAuxPropagationVariables.RotationMatrix(1,0) = Vy[0];
2006 rAuxPropagationVariables.RotationMatrix(1,1) = Vy[1];
2007 rAuxPropagationVariables.RotationMatrix(1,2) = Vy[2];
2009 rAuxPropagationVariables.RotationMatrix(2,0) = Vz[0];
2010 rAuxPropagationVariables.RotationMatrix(2,1) = Vz[1];
2011 rAuxPropagationVariables.RotationMatrix(2,2) = Vz[2];
2013 noalias(rAuxPropagationVariables.TipLocalCoordinates) =
prod(rAuxPropagationVariables.RotationMatrix,CenterPoint);
Geometry< NodeType > GeometryType
definition of the geometry type with given NodeType
Definition: element.h:83
Definition: fracture_propagation_3D_utilities.hpp:38
void MappingModelParts(Parameters &rParameters, ModelPart &rModelPartOld, ModelPart &rModelPartNew, const bool &move_mesh_flag)
Definition: fracture_propagation_3D_utilities.hpp:162
void CheckFracture(const unsigned int &itFracture, PropagationGlobalVariables &rPropagationData, const UtilityVariables &AuxVariables, Parameters &rParameters)
Definition: fracture_propagation_3D_utilities.hpp:205
void FinalizeCheckFracture(const PropagationGlobalVariables &PropagationData, Parameters &rParameters, ModelPart &rModelPart, const bool &move_mesh_flag)
Definition: fracture_propagation_3D_utilities.hpp:321
void WritePropagationData(const PropagationGlobalVariables &PropagationData, Parameters &rParameters)
Definition: fracture_propagation_3D_utilities.hpp:342
KRATOS_CLASS_POINTER_DEFINITION(FracturePropagation3DUtilities)
FracturePropagation3DUtilities()
Constructor.
Definition: fracture_propagation_3D_utilities.hpp:132
bool CheckFracturePropagation(Parameters &rParameters, ModelPart &rModelPart, const bool &move_mesh_flag)
Definition: fracture_propagation_3D_utilities.hpp:141
void ResetMeshPosition(ModelPart &rModelPart)
Common ----------------------------------------------------------------------------------------------...
Definition: fracture_propagation_3D_utilities.hpp:1304
void UpdateMeshPosition(ModelPart &rModelPart)
Definition: fracture_propagation_3D_utilities.hpp:1323
void InitializeCheckFracture(PropagationGlobalVariables &rPropagationData, UtilityVariables &rAuxVariables, Parameters &rParameters, ModelPart &rModelPart, const bool &move_mesh_flag)
Member Variables.
Definition: fracture_propagation_3D_utilities.hpp:185
void GaussPointStateVariableMapping(const UtilityVariables &AuxVariables, Parameters &rParameters, ModelPart &rModelPartOld, ModelPart &rModelPartNew)
Definition: fracture_propagation_3D_utilities.hpp:949
virtual ~FracturePropagation3DUtilities()
Destructor.
Definition: fracture_propagation_3D_utilities.hpp:137
void NodalVariablesMapping(const UtilityVariables &AuxVariables, Parameters &rParameters, ModelPart &rModelPartOld, ModelPart &rModelPartNew)
Definition: fracture_propagation_3D_utilities.hpp:632
void InitializeMapping(UtilityVariables &rAuxVariables, ModelPart &rModelPartNew, const bool &move_mesh_flag)
Mapping ---------------------------------------------------------------------------------------------...
Definition: fracture_propagation_3D_utilities.hpp:618
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
virtual CoordinatesArrayType & GlobalCoordinates(CoordinatesArrayType &rResult, CoordinatesArrayType const &LocalCoordinates) const
Definition: geometry.h:2377
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
Vector & DeterminantOfJacobian(Vector &rResult) const
Definition: geometry.h:3154
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry.h:2284
Definition: amatrix_interface.h:41
static T CrossProduct(const T &a, const T &b)
Performs the vector product of the two input vectors a,b.
Definition: math_utils.h:762
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
SizeType size() const
This method returns the total size of the current array parameter.
Definition: kratos_parameters.cpp:993
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
ProcessInfo
Definition: edgebased_PureConvection.py:116
out
Definition: isotropic_damage_automatic_differentiation.py:200
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int m
Definition: run_marine_rain_substepping.py:8
integer i
Definition: TensorModule.f:17
integer l
Definition: TensorModule.f:17
Definition: fracture_propagation_3D_utilities.hpp:79
array_1d< double, 3 > BotBotEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:91
array_1d< double, 3 > BotLeftEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:92
array_1d< double, 3 > TopLeftEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:87
array_1d< double, 3 > BotTipCoordinates
Definition: fracture_propagation_3D_utilities.hpp:94
array_1d< double, 3 > LeftInitCoordinates
Definition: fracture_propagation_3D_utilities.hpp:83
int MotherFractureId
Definition: fracture_propagation_3D_utilities.hpp:80
array_1d< double, 3 > TopTopEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:85
array_1d< double, 3 > TopBotEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:86
array_1d< double, 3 > TopTipCoordinates
Definition: fracture_propagation_3D_utilities.hpp:89
array_1d< double, 3 > BotInitCoordinates
Definition: fracture_propagation_3D_utilities.hpp:82
array_1d< double, 3 > TopInitCoordinates
Definition: fracture_propagation_3D_utilities.hpp:81
array_1d< double, 3 > TopRightEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:88
array_1d< double, 3 > BotRightEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:93
array_1d< double, 3 > RightInitCoordinates
Definition: fracture_propagation_3D_utilities.hpp:84
array_1d< double, 3 > BotTopEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:90
Structs for fracture propagation check --------------------------------------------------------------...
Definition: fracture_propagation_3D_utilities.hpp:54
double TipDistance
Definition: fracture_propagation_3D_utilities.hpp:56
double Weight
Definition: fracture_propagation_3D_utilities.hpp:56
double Damage
Definition: fracture_propagation_3D_utilities.hpp:56
array_1d< double, 3 > Coordinates
Definition: fracture_propagation_3D_utilities.hpp:55
Element::Pointer pElement
Definition: fracture_propagation_3D_utilities.hpp:57
Structs for mapping model parts ---------------------------------------------------------------------...
Definition: fracture_propagation_3D_utilities.hpp:122
array_1d< double, 3 > Coordinates
Definition: fracture_propagation_3D_utilities.hpp:123
double Weight
Definition: fracture_propagation_3D_utilities.hpp:124
double StateVariable
Definition: fracture_propagation_3D_utilities.hpp:124
Definition: fracture_propagation_3D_utilities.hpp:100
bool PropagateFractures
Definition: fracture_propagation_3D_utilities.hpp:103
std::vector< Propagation > PropagationVector
Definition: fracture_propagation_3D_utilities.hpp:104
std::vector< Bifurcation > BifurcationVector
Definition: fracture_propagation_3D_utilities.hpp:105
std::vector< std::vector< std::vector< std::vector< FracturePoint > > > > FracturePointsCellMatrix
Definition: fracture_propagation_3D_utilities.hpp:101
ProcessInfo::Pointer pProcessInfo
Definition: fracture_propagation_3D_utilities.hpp:102
Definition: fracture_propagation_3D_utilities.hpp:63
array_1d< double, 3 > RightInitCoordinates
Definition: fracture_propagation_3D_utilities.hpp:68
array_1d< double, 3 > BotInitCoordinates
Definition: fracture_propagation_3D_utilities.hpp:66
array_1d< double, 3 > TopInitCoordinates
Definition: fracture_propagation_3D_utilities.hpp:65
array_1d< double, 3 > BotEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:70
array_1d< double, 3 > RightEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:72
array_1d< double, 3 > TipCoordinates
Definition: fracture_propagation_3D_utilities.hpp:73
array_1d< double, 3 > TopEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:69
array_1d< double, 3 > LeftInitCoordinates
Definition: fracture_propagation_3D_utilities.hpp:67
int MotherFractureId
Definition: fracture_propagation_3D_utilities.hpp:64
array_1d< double, 3 > LeftEndCoordinates
Definition: fracture_propagation_3D_utilities.hpp:71
Definition: fracture_propagation_3D_utilities.hpp:111
std::vector< FracturePoint * > BotFrontFracturePoints
Definition: fracture_propagation_3D_utilities.hpp:116
array_1d< double, 3 > TipCoordinates
Definition: fracture_propagation_3D_utilities.hpp:113
array_1d< double, 3 > TipLocalCoordinates
Definition: fracture_propagation_3D_utilities.hpp:114
BoundedMatrix< double, 3, 3 > RotationMatrix
Definition: fracture_propagation_3D_utilities.hpp:112
std::vector< FracturePoint * > TopFrontFracturePoints
Definition: fracture_propagation_3D_utilities.hpp:115
Basic Structs for the utility -----------------------------------------------------------------------...
Definition: fracture_propagation_3D_utilities.hpp:45
double Y_min
Definition: fracture_propagation_3D_utilities.hpp:46
double RowSize
Definition: fracture_propagation_3D_utilities.hpp:48
double X_min
Definition: fracture_propagation_3D_utilities.hpp:46
int NColumns
Definition: fracture_propagation_3D_utilities.hpp:47
double Z_max
Definition: fracture_propagation_3D_utilities.hpp:46
double ColumnSize
Definition: fracture_propagation_3D_utilities.hpp:48
double SectionSize
Definition: fracture_propagation_3D_utilities.hpp:48
int NRows
Definition: fracture_propagation_3D_utilities.hpp:47
double Z_min
Definition: fracture_propagation_3D_utilities.hpp:46
int NSections
Definition: fracture_propagation_3D_utilities.hpp:47
double Y_max
Definition: fracture_propagation_3D_utilities.hpp:46
double X_max
Definition: fracture_propagation_3D_utilities.hpp:46