15 #if !defined(KRATOS_PROPAGATE_FRACTURES_2D_UTILITIES )
16 #define KRATOS_PROPAGATE_FRACTURES_2D_UTILITIES
134 for(
unsigned int i = 0;
i < rParameters[
"fractures_list"].
size();
i++)
136 this->
CheckFracture(
i, PropagationData, AuxVariables, rParameters);
157 if(move_mesh_flag==
true)
174 const bool& move_mesh_flag)
180 if(move_mesh_flag==
true)
184 this->SetFracturePoints(rPropagationData, rAuxVariables, rParameters, rModelPart);
190 const unsigned int& itFracture,
198 for(
unsigned int i = 0;
i < 2;
i++)
199 AuxPropagationVariables.
TipCoordinates[
i] = rParameters[
"fractures_list"][itFracture][
"tip_point"][
"coordinates"][
i].
GetDouble();
202 this->CalculateTipRotationMatrix(itFracture,AuxPropagationVariables.
RotationMatrix,rParameters);
205 const double PropagationLength = rParameters[
"fracture_data"][
"propagation_length"].
GetDouble();
207 double X_left = AuxPropagationVariables.
TipCoordinates[0] - PropagationLength;
208 double X_right = AuxPropagationVariables.
TipCoordinates[0] + PropagationLength;
209 double Y_top = AuxPropagationVariables.
TipCoordinates[1] + PropagationLength;
210 double Y_bot = AuxPropagationVariables.
TipCoordinates[1] - PropagationLength;
217 if(Column_left < 0) Column_left = 0;
218 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
219 if(Row_top < 0) Row_top = 0;
220 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
223 std::vector<FracturePoint*> TipNeighbours;
226 for(
int i = Row_top;
i <= Row_bot;
i++)
228 for(
int j = Column_left;
j<= Column_right;
j++)
239 TipNeighbours.push_back(&rOtherPoint);
263 double NonlocalDamage = 0.0;
264 double WeightingFunctionDenominator = 0.0;
265 int NNeighbours = TipNeighbours.size();
267 #pragma omp parallel for reduction(+:NonlocalDamage,WeightingFunctionDenominator)
268 for(
int i = 0;
i < NNeighbours;
i++)
271 NonlocalDamage += (MyPoint.
Weight)*
274 WeightingFunctionDenominator += (MyPoint.
Weight)*exp(-4.0*(MyPoint.
TipDistance)*(MyPoint.
TipDistance)/(PropagationLength*PropagationLength));
277 if(WeightingFunctionDenominator > 1.0e-20)
278 NonlocalDamage = NonlocalDamage/WeightingFunctionDenominator;
280 NonlocalDamage = 0.0;
283 if(NonlocalDamage >= rParameters[
"fracture_data"][
"propagation_damage"].GetDouble())
284 this->PropagateFracture(itFracture,rPropagationData,AuxPropagationVariables,rParameters);
293 const bool& move_mesh_flag)
298 if(move_mesh_flag==
true)
315 std::fstream PropDataFile;
316 PropDataFile.open (
"PropagationData.tcl",
std::fstream::out | std::fstream::trunc);
317 PropDataFile.precision(12);
319 PropDataFile <<
"set PropagationData [list]" << std::endl;
322 PropDataFile <<
"lappend PropagationData \"" << rParameters[
"fracture_data"][
"gid_path"].
GetString() <<
"\"" << std::endl;
327 for(
unsigned int i = 0;
i < rParameters[
"body_surfaces_list"].
size();
i++)
329 Id = rParameters[
"body_surfaces_list"][
i][
"id"].
GetInt();
331 PropDataFile <<
"set Groups [list]" << std::endl;
332 for(
unsigned int j = 0;
j < rParameters[
"body_surfaces_list"][
i][
"groups"].
size();
j++)
334 PropDataFile <<
"lappend Groups \"" << rParameters[
"body_surfaces_list"][
i][
"groups"][
j].
GetString() <<
"\"" << std::endl;
336 PropDataFile <<
"dict set BodySurfacesDict " << Id <<
" Groups $Groups" << std::endl;
338 PropDataFile <<
"set Lines [list]" << std::endl;
339 for(
unsigned int j = 0;
j < rParameters[
"body_surfaces_list"][
i][
"lines"].
size();
j++)
341 PropDataFile <<
"lappend Lines " << rParameters[
"body_surfaces_list"][
i][
"lines"][
j].
GetInt() << std::endl;
343 PropDataFile <<
"dict set BodySurfacesDict " << Id <<
" Lines $Lines" << std::endl;
344 PropDataFile <<
"dict set BodySurfacesDict " << Id <<
" ElemType " << rParameters[
"body_surfaces_list"][
i][
"elem_type"].
GetString() << std::endl;
345 PropDataFile <<
"dict set BodySurfacesDict " << Id <<
" MeshSize " << rParameters[
"body_surfaces_list"][
i][
"mesh_size"].
GetDouble() << std::endl;
347 PropDataFile <<
"lappend PropagationData $BodySurfacesDict" << std::endl;
350 for(
unsigned int i = 0;
i < rParameters[
"fractures_list"].
size();
i++)
352 Id = rParameters[
"fractures_list"][
i][
"id"].
GetInt();
355 PropDataFile <<
"dict set FracturesDict " << Id <<
" TipPoint Id "
356 << rParameters[
"fractures_list"][
i][
"tip_point"][
"id"].
GetInt() << std::endl;
357 PropDataFile <<
"set Coordinates \"" << rParameters[
"fractures_list"][
i][
"tip_point"][
"coordinates"][0].
GetDouble()
358 <<
" " << rParameters[
"fractures_list"][
i][
"tip_point"][
"coordinates"][1].
GetDouble() <<
" "
359 << rParameters[
"fractures_list"][
i][
"tip_point"][
"coordinates"][2].
GetDouble() <<
"\"" << std::endl;
360 PropDataFile <<
"dict set FracturesDict " << Id <<
" TipPoint Coordinates $Coordinates" << std::endl;
362 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopPoint Id "
363 << rParameters[
"fractures_list"][
i][
"top_point"][
"id"].
GetInt() << std::endl;
364 PropDataFile <<
"set Coordinates \"" << rParameters[
"fractures_list"][
i][
"top_point"][
"coordinates"][0].
GetDouble()
365 <<
" " << rParameters[
"fractures_list"][
i][
"top_point"][
"coordinates"][1].
GetDouble() <<
" "
366 << rParameters[
"fractures_list"][
i][
"top_point"][
"coordinates"][2].
GetDouble() <<
"\"" << std::endl;
367 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopPoint Coordinates $Coordinates" << std::endl;
369 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotPoint Id "
370 << rParameters[
"fractures_list"][
i][
"bot_point"][
"id"].
GetInt() << std::endl;
371 PropDataFile <<
"set Coordinates \"" << rParameters[
"fractures_list"][
i][
"bot_point"][
"coordinates"][0].
GetDouble()
372 <<
" " << rParameters[
"fractures_list"][
i][
"bot_point"][
"coordinates"][1].
GetDouble() <<
" "
373 << rParameters[
"fractures_list"][
i][
"bot_point"][
"coordinates"][2].
GetDouble() <<
"\"" << std::endl;
374 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotPoint Coordinates $Coordinates" << std::endl;
376 PropDataFile <<
"dict set FracturesDict " << Id <<
" TopLine Id "
377 << rParameters[
"fractures_list"][
i][
"top_line"][
"id"].
GetInt() << std::endl;
379 PropDataFile <<
"dict set FracturesDict " << Id <<
" BotLine Id "
380 << rParameters[
"fractures_list"][
i][
"bot_line"][
"id"].
GetInt() << std::endl;
382 PropDataFile <<
"dict set FracturesDict " << Id <<
" InterfaceSurface Id "
383 << rParameters[
"fractures_list"][
i][
"interface_surface"][
"id"].
GetInt() << std::endl;
384 PropDataFile <<
"dict set FracturesDict " << Id <<
" InterfaceSurface Layer \""
385 << rParameters[
"fractures_list"][
i][
"interface_surface"][
"layer"].
GetString() <<
"\"" << std::endl;
386 PropDataFile <<
"set Groups [list]" << std::endl;
387 for(
unsigned int j = 0;
j < rParameters[
"fractures_list"][
i][
"interface_surface"][
"groups"].
size();
j++)
389 PropDataFile <<
"lappend Groups \"" << rParameters[
"fractures_list"][
i][
"interface_surface"][
"groups"][
j].
GetString() <<
"\"" << std::endl;
391 PropDataFile <<
"dict set FracturesDict " << Id <<
" InterfaceSurface Groups $Groups" << std::endl;
393 PropDataFile <<
"set BodySurfaces [list]" << std::endl;
394 for(
unsigned int j = 0;
j < rParameters[
"fractures_list"][
i][
"body_surfaces"].
size();
j++)
396 PropDataFile <<
"lappend BodySurfaces " << rParameters[
"fractures_list"][
i][
"body_surfaces"][
j].
GetInt() << std::endl;
398 PropDataFile <<
"dict set FracturesDict " << Id <<
" BodySurfaces $BodySurfaces" << std::endl;
400 PropDataFile <<
"lappend PropagationData $FracturesDict" << std::endl;
403 PropDataFile <<
"set PropagationDict [dict create]" << std::endl;
406 PropDataFile <<
"dict set PropagationDict " <<
i <<
" MotherFractureId "
409 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].TopInitCoordinates[0]
412 PropDataFile <<
"dict set PropagationDict " <<
i <<
" TopInitCoordinates $Coordinates" << std::endl;
414 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].BotInitCoordinates[0]
417 PropDataFile <<
"dict set PropagationDict " <<
i <<
" BotInitCoordinates $Coordinates" << std::endl;
419 PropDataFile <<
"set Coordinates \"" << PropagationData.
PropagationVector[
i].TipCoordinates[0]
422 PropDataFile <<
"dict set PropagationDict " <<
i <<
" TipCoordinates $Coordinates" << std::endl;
424 PropDataFile <<
"lappend PropagationData $PropagationDict" << std::endl;
427 PropDataFile <<
"set BifurcationDict [dict create]" << std::endl;
430 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" MotherFractureId "
433 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].TopInitCoordinates[0]
436 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" TopInitCoordinates $Coordinates" << std::endl;
438 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].BotInitCoordinates[0]
441 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" BotInitCoordinates $Coordinates" << std::endl;
443 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].TopTipCoordinates[0]
446 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" TopTipCoordinates $Coordinates" << std::endl;
448 PropDataFile <<
"set Coordinates \"" << PropagationData.
BifurcationVector[
i].BotTipCoordinates[0]
451 PropDataFile <<
"dict set BifurcationDict " <<
i <<
" BotTipCoordinates $Coordinates" << std::endl;
453 PropDataFile <<
"lappend PropagationData $BifurcationDict" << std::endl;
455 PropDataFile <<
"return $PropagationData" << std::endl;
457 PropDataFile.close();
465 const bool& move_mesh_flag)
468 if(move_mesh_flag==
true)
471 this->ComputeCellMatrixDimensions(rAuxVariables,rModelPartNew);
483 std::vector< std::vector< std::vector<Element::Pointer> > > ElementOldCellMatrix;
484 ElementOldCellMatrix.resize(AuxVariables.
NRows);
485 for(
int i = 0;
i < AuxVariables.
NRows;
i++) ElementOldCellMatrix[
i].resize(AuxVariables.
NColumns);
492 unsigned int NumBodySubModelParts = rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"].
size();
495 for(
unsigned int m = 0;
m < NumBodySubModelParts;
m++)
497 ModelPart& SubModelPart = rModelPartOld.
GetSubModelPart(rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"][
m].GetString());
499 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
500 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
502 #pragma omp parallel for private(X_me,Y_me,PointsNumber)
503 for(
int i = 0;
i < NElems;
i++)
505 ModelPart::ElementsContainerType::iterator itElemOld = el_begin +
i;
507 double X_left = itElemOld->GetGeometry().GetPoint(0).X0();
508 double X_right = X_left;
509 double Y_top = itElemOld->GetGeometry().GetPoint(0).Y0();
510 double Y_bot = Y_top;
511 PointsNumber = itElemOld->GetGeometry().PointsNumber();
513 for(
int j = 1;
j < PointsNumber;
j++)
515 X_me = itElemOld->GetGeometry().GetPoint(
j).X0();
516 Y_me = itElemOld->GetGeometry().GetPoint(
j).Y0();
518 if(X_me > X_right) X_right = X_me;
519 else if(X_me < X_left) X_left = X_me;
520 if(Y_me > Y_top) Y_top = Y_me;
521 else if(Y_me < Y_bot) Y_bot = Y_me;
529 if(Column_left < 0) Column_left = 0;
530 else if(Column_left >= AuxVariables.
NColumns) Column_left = AuxVariables.
NColumns-1;
531 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
532 else if(Column_right < 0) Column_right = 0;
534 if(Row_top < 0) Row_top = 0;
535 else if(Row_top >= AuxVariables.
NRows) Row_top = AuxVariables.
NRows-1;
536 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
537 else if(Row_bot < 0) Row_bot = 0;
539 for(
int k = Row_top;
k <= Row_bot;
k++)
541 for(
int l = Column_left;
l <= Column_right;
l++)
545 ElementOldCellMatrix[
k][
l].push_back((*(itElemOld.base())));
552 unsigned int NumInterfaceSubModelPartsOld = rParameters[
"fracture_data"][
"interface_domain_sub_model_part_old_list"].
size();
555 for(
unsigned int m = 0;
m < NumInterfaceSubModelPartsOld;
m++)
557 ModelPart& SubModelPart = rModelPartOld.
GetSubModelPart(rParameters[
"fracture_data"][
"interface_domain_sub_model_part_old_list"][
m].GetString());
559 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
560 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
562 #pragma omp parallel for private(X_me,Y_me,PointsNumber)
563 for(
int i = 0;
i < NElems;
i++)
565 ModelPart::ElementsContainerType::iterator itElemOld = el_begin +
i;
567 double X_left = itElemOld->GetGeometry().GetPoint(0).X0();
568 double X_right = X_left;
569 double Y_top = itElemOld->GetGeometry().GetPoint(0).Y0();
570 double Y_bot = Y_top;
571 PointsNumber = itElemOld->GetGeometry().PointsNumber();
573 for(
int j = 1;
j < PointsNumber;
j++)
575 X_me = itElemOld->GetGeometry().GetPoint(
j).X0();
576 Y_me = itElemOld->GetGeometry().GetPoint(
j).Y0();
578 if(X_me > X_right) X_right = X_me;
579 else if(X_me < X_left) X_left = X_me;
580 if(Y_me > Y_top) Y_top = Y_me;
581 else if(Y_me < Y_bot) Y_bot = Y_me;
589 if(Column_left < 0) Column_left = 0;
590 else if(Column_left >= AuxVariables.
NColumns) Column_left = AuxVariables.
NColumns-1;
591 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
592 else if(Column_right < 0) Column_right = 0;
594 if(Row_top < 0) Row_top = 0;
595 else if(Row_top >= AuxVariables.
NRows) Row_top = AuxVariables.
NRows-1;
596 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
597 else if(Row_bot < 0) Row_bot = 0;
599 for(
int k = Row_top;
k <= Row_bot;
k++)
601 for(
int l = Column_left;
l <= Column_right;
l++)
605 ElementOldCellMatrix[
k][
l].push_back((*(itElemOld.base())));
613 const int NNodes =
static_cast<int>(rModelPartNew.
Nodes().size());
614 ModelPart::NodesContainerType::iterator node_begin = rModelPartNew.
NodesBegin();
619 #pragma omp parallel for private(X_me,Y_me,PointsNumber,GlobalCoordinates,LocalCoordinates)
620 for(
int i = 0;
i < NNodes;
i++)
622 ModelPart::NodesContainerType::iterator itNodeNew = node_begin +
i;
624 X_me = itNodeNew->X0();
625 Y_me = itNodeNew->Y0();
631 else if(Column < 0) Column = 0;
632 if(Row >= AuxVariables.
NRows) Row = AuxVariables.
NRows-1;
633 else if(Row < 0) Row = 0;
635 noalias(GlobalCoordinates) = itNodeNew->Coordinates();
636 bool IsInside =
false;
637 Element::Pointer pElementOld;
639 for(
unsigned int m = 0;
m < (ElementOldCellMatrix[Row][Column]).size();
m++)
641 pElementOld = ElementOldCellMatrix[Row][Column][
m];
642 IsInside = pElementOld->GetGeometry().IsInside(GlobalCoordinates,LocalCoordinates);
647 for(
unsigned int m = 0;
m < (ElementOldCellMatrix[Row][Column]).size();
m++)
649 pElementOld = ElementOldCellMatrix[Row][Column][
m];
650 IsInside = pElementOld->GetGeometry().IsInside(GlobalCoordinates,LocalCoordinates,1.0e-5);
654 if(IsInside ==
false)
655 std::cout <<
"ERROR!!, NONE OF THE OLD ELEMENTS CONTAINS NODE: " << itNodeNew->Id() << std::endl;
657 PointsNumber = pElementOld->GetGeometry().PointsNumber();
658 Vector ShapeFunctionsValuesVector(PointsNumber);
659 Vector NodalVariableVector(PointsNumber);
661 pElementOld->GetGeometry().ShapeFunctionsValues(ShapeFunctionsValuesVector,LocalCoordinates);
664 if( itNodeNew->IsFixed(DISPLACEMENT_X)==
false )
666 for(
int j = 0;
j < PointsNumber;
j++)
668 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(DISPLACEMENT_X);
670 itNodeNew->FastGetSolutionStepValue(DISPLACEMENT_X) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
672 if( itNodeNew->IsFixed(VELOCITY_X)==
false )
674 for(
int j = 0;
j < PointsNumber;
j++)
676 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(VELOCITY_X);
678 itNodeNew->FastGetSolutionStepValue(VELOCITY_X) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
680 if( itNodeNew->IsFixed(ACCELERATION_X)==
false )
682 for(
int j = 0;
j < PointsNumber;
j++)
684 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(ACCELERATION_X);
686 itNodeNew->FastGetSolutionStepValue(ACCELERATION_X) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
688 if( itNodeNew->IsFixed(DISPLACEMENT_Y)==
false )
690 for(
int j = 0;
j < PointsNumber;
j++)
692 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(DISPLACEMENT_Y);
694 itNodeNew->FastGetSolutionStepValue(DISPLACEMENT_Y) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
696 if( itNodeNew->IsFixed(VELOCITY_Y)==
false )
698 for(
int j = 0;
j < PointsNumber;
j++)
700 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(VELOCITY_Y);
702 itNodeNew->FastGetSolutionStepValue(VELOCITY_Y) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
704 if( itNodeNew->IsFixed(ACCELERATION_Y)==
false )
706 for(
int j = 0;
j < PointsNumber;
j++)
708 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(ACCELERATION_Y);
710 itNodeNew->FastGetSolutionStepValue(ACCELERATION_Y) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
712 if( itNodeNew->IsFixed(WATER_PRESSURE)==
false )
714 for(
int j = 0;
j < PointsNumber;
j++)
716 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(WATER_PRESSURE);
718 itNodeNew->FastGetSolutionStepValue(WATER_PRESSURE) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
719 for(
int j = 0;
j < PointsNumber;
j++)
721 NodalVariableVector[
j] = pElementOld->GetGeometry().GetPoint(
j).FastGetSolutionStepValue(DT_WATER_PRESSURE);
723 itNodeNew->FastGetSolutionStepValue(DT_WATER_PRESSURE) =
inner_prod(ShapeFunctionsValuesVector,NodalVariableVector);
737 std::vector< std::vector< std::vector<GaussPointOld> > > BodyGaussPointOldCellMatrix;
738 BodyGaussPointOldCellMatrix.resize(AuxVariables.
NRows);
739 for(
int i = 0;
i < AuxVariables.
NRows;
i++) BodyGaussPointOldCellMatrix[
i].resize(AuxVariables.
NColumns);
741 std::vector< std::vector< std::vector<GaussPointOld> > > InterfaceGaussPointOldCellMatrix;
742 InterfaceGaussPointOldCellMatrix.resize(AuxVariables.
NRows);
743 for(
int i = 0;
i < AuxVariables.
NRows;
i++) InterfaceGaussPointOldCellMatrix[
i].resize(AuxVariables.
NColumns);
751 unsigned int NumBodySubModelParts = rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"].
size();
754 for(
unsigned int i = 0;
i < NumBodySubModelParts;
i++)
756 ModelPart& SubModelPart = rModelPartOld.
GetSubModelPart(rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"][
i].GetString());
758 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
759 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
761 #pragma omp parallel for private(MyGaussPointOld,MyIntegrationMethod,AuxLocalCoordinates)
762 for(
int j = 0;
j < NElems;
j++)
764 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
767 MyIntegrationMethod = itElem->GetIntegrationMethod();
769 unsigned int NumGPoints = IntegrationPoints.size();
770 Vector detJContainer(NumGPoints);
772 std::vector<double> StateVariableVector(NumGPoints);
773 itElem->CalculateOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfoOld);
778 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
781 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
782 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
783 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
787 MyGaussPointOld.
Weight = detJContainer[GPoint]*IntegrationPoints[GPoint].Weight();
797 BodyGaussPointOldCellMatrix[Row][Column].push_back(MyGaussPointOld);
803 unsigned int NumInterfaceSubModelPartsOld = rParameters[
"fracture_data"][
"interface_domain_sub_model_part_old_list"].
size();
806 for(
unsigned int i = 0;
i < NumInterfaceSubModelPartsOld;
i++)
808 ModelPart& SubModelPart = rModelPartOld.
GetSubModelPart(rParameters[
"fracture_data"][
"interface_domain_sub_model_part_old_list"][
i].GetString());
810 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
811 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
813 #pragma omp parallel for private(MyGaussPointOld,MyIntegrationMethod,AuxLocalCoordinates)
814 for(
int j = 0;
j < NElems;
j++)
816 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
821 unsigned int NumGPoints = IntegrationPoints.size();
822 Vector detJContainer(NumGPoints);
824 std::vector<double> StateVariableVector(NumGPoints);
825 itElem->CalculateOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfoOld);
830 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
833 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
834 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
835 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
839 MyGaussPointOld.
Weight = detJContainer[GPoint]*IntegrationPoints[GPoint].Weight();
849 InterfaceGaussPointOldCellMatrix[Row][Column].push_back(MyGaussPointOld);
857 const double PropagationLength = rParameters[
"fracture_data"][
"propagation_length"].
GetDouble();
861 for(
unsigned int i = 0;
i < NumBodySubModelParts;
i++)
863 ModelPart& SubModelPart = rModelPartNew.
GetSubModelPart(rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"][
i].GetString());
865 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
866 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
868 double DamageThreshold = el_begin->GetProperties()[DAMAGE_THRESHOLD];
870 #pragma omp parallel for private(MyIntegrationMethod,AuxLocalCoordinates,AuxGlobalCoordinates)
871 for(
int j = 0;
j < NElems;
j++)
873 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
876 MyIntegrationMethod = itElem->GetIntegrationMethod();
878 unsigned int NumGPoints = IntegrationPoints.size();
879 std::vector<double> StateVariableVector(NumGPoints);
882 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
885 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
886 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
887 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
889 double X_me = AuxGlobalCoordinates[0];
890 double Y_me = AuxGlobalCoordinates[1];
893 double X_left = X_me - PropagationLength;
894 double X_right = X_me + PropagationLength;
895 double Y_top = Y_me + PropagationLength;
896 double Y_bot = Y_me - PropagationLength;
903 if(Column_left < 0) Column_left = 0;
904 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
905 if(Row_top < 0) Row_top = 0;
906 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
909 double Numerator = 0.0;
910 double WeightingFunctionDenominator = 0.0;
912 for(
int k = Row_top;
k <= Row_bot;
k++)
914 for(
int l = Column_left;
l<= Column_right;
l++)
916 for(
unsigned int m = 0;
m < BodyGaussPointOldCellMatrix[
k][
l].size();
m++)
923 if(Distance <= PropagationLength)
925 Numerator += rOtherGaussPointOld.
Weight
926 *exp(-4.0*Distance*Distance/(PropagationLength*PropagationLength))
928 WeightingFunctionDenominator += rOtherGaussPointOld.
Weight
929 *exp(-4.0*Distance*Distance/(PropagationLength*PropagationLength));
936 if(WeightingFunctionDenominator > 0.0)
937 StateVariableVector[GPoint] = Numerator/WeightingFunctionDenominator;
939 StateVariableVector[GPoint] = DamageThreshold;
942 itElem->SetValuesOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfoNew);
946 unsigned int NumInterfaceSubModelParts = rParameters[
"fracture_data"][
"interface_domain_sub_model_part_list"].
size();
947 const double PropagationDamage = rParameters[
"fracture_data"][
"propagation_damage"].
GetDouble();
950 for(
unsigned int i = 0;
i < NumInterfaceSubModelParts;
i++)
952 ModelPart& SubModelPart = rModelPartNew.
GetSubModelPart(rParameters[
"fracture_data"][
"interface_domain_sub_model_part_list"][
i].GetString());
954 int NElems =
static_cast<int>(SubModelPart.
Elements().size());
955 ModelPart::ElementsContainerType::iterator el_begin = SubModelPart.
ElementsBegin();
959 #pragma omp parallel for private(MyIntegrationMethod,AuxLocalCoordinates,AuxGlobalCoordinates)
960 for(
int j = 0;
j < NElems;
j++)
962 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
967 unsigned int NumGPoints = IntegrationPoints.size();
968 std::vector<double> StateVariableVector(NumGPoints);
971 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
974 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
975 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
976 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
978 double X_me = AuxGlobalCoordinates[0];
979 double Y_me = AuxGlobalCoordinates[1];
982 double X_left = X_me - PropagationLength;
983 double X_right = X_me + PropagationLength;
984 double Y_top = Y_me + PropagationLength;
985 double Y_bot = Y_me - PropagationLength;
992 if(Column_left < 0) Column_left = 0;
993 if(Column_right >= AuxVariables.
NColumns) Column_right = AuxVariables.
NColumns-1;
994 if(Row_top < 0) Row_top = 0;
995 if(Row_bot >= AuxVariables.
NRows) Row_bot = AuxVariables.
NRows-1;
998 double Numerator = 0.0;
999 double WeightingFunctionDenominator = 0.0;
1001 for(
int k = Row_top;
k <= Row_bot;
k++)
1003 for(
int l = Column_left;
l<= Column_right;
l++)
1005 for(
unsigned int m = 0;
m < InterfaceGaussPointOldCellMatrix[
k][
l].size();
m++)
1007 GaussPointOld& rOtherGaussPointOld = InterfaceGaussPointOldCellMatrix[
k][
l][
m];
1012 if(Distance <= PropagationLength)
1014 Numerator += rOtherGaussPointOld.
Weight
1015 *exp(-4.0*Distance*Distance/(PropagationLength*PropagationLength))
1017 WeightingFunctionDenominator += rOtherGaussPointOld.
Weight
1018 *exp(-4.0*Distance*Distance/(PropagationLength*PropagationLength));
1025 if(WeightingFunctionDenominator > 0.0)
1027 StateVariableVector[GPoint] = Numerator/WeightingFunctionDenominator;
1028 if(StateVariableVector[GPoint] < PropagationDamage)
1030 StateVariableVector[GPoint] = PropagationDamage;
1034 StateVariableVector[GPoint] = PropagationDamage;
1037 itElem->SetValuesOnIntegrationPoints(STATE_VARIABLE,StateVariableVector,CurrentProcessInfoNew);
1047 const int NNodes =
static_cast<int>(rModelPart.
Nodes().size());
1048 ModelPart::NodesContainerType::iterator node_begin = rModelPart.
NodesBegin();
1050 #pragma omp parallel for
1051 for(
int i = 0;
i < NNodes;
i++)
1053 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
1055 itNode->X() = itNode->X0();
1056 itNode->Y() = itNode->Y0();
1057 itNode->Z() = itNode->Z0();
1066 const int NNodes =
static_cast<int>(rModelPart.
Nodes().size());
1067 ModelPart::NodesContainerType::iterator node_begin = rModelPart.
NodesBegin();
1069 #pragma omp parallel for
1070 for(
int i = 0;
i < NNodes;
i++)
1072 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
1074 itNode->X() = itNode->X0() + itNode->FastGetSolutionStepValue(DISPLACEMENT_X);
1075 itNode->Y() = itNode->Y0() + itNode->FastGetSolutionStepValue(DISPLACEMENT_Y);
1076 itNode->Z() = itNode->Z0() + itNode->FastGetSolutionStepValue(DISPLACEMENT_Z);
1084 void ComputeCellMatrixDimensions(
1085 UtilityVariables& rAuxVariables,
1090 std::vector<double> X_max_partition(NumThreads);
1091 std::vector<double> X_min_partition(NumThreads);
1092 std::vector<double> Y_max_partition(NumThreads);
1093 std::vector<double> Y_min_partition(NumThreads);
1095 const int NNodes =
static_cast<int>(rModelPart.
Nodes().size());
1096 ModelPart::NodesContainerType::iterator node_begin = rModelPart.
NodesBegin();
1098 #pragma omp parallel
1102 X_max_partition[
k] = node_begin->X();
1103 X_min_partition[
k] = X_max_partition[
k];
1104 Y_max_partition[
k] = node_begin->Y();
1105 Y_min_partition[
k] = Y_max_partition[
k];
1110 for(
int i = 0;
i < NNodes;
i++)
1112 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
1117 if( X_me > X_max_partition[
k] ) X_max_partition[
k] = X_me;
1118 else if( X_me < X_min_partition[
k] ) X_min_partition[
k] = X_me;
1120 if( Y_me > Y_max_partition[
k] ) Y_max_partition[
k] = Y_me;
1121 else if( Y_me < Y_min_partition[
k] ) Y_min_partition[
k] = Y_me;
1125 rAuxVariables.X_max = X_max_partition[0];
1126 rAuxVariables.X_min = X_min_partition[0];
1127 rAuxVariables.Y_max = Y_max_partition[0];
1128 rAuxVariables.Y_min = Y_min_partition[0];
1130 for(
unsigned int i=1;
i < NumThreads;
i++)
1132 if(X_max_partition[
i] > rAuxVariables.X_max) rAuxVariables.X_max = X_max_partition[
i];
1133 if(X_min_partition[
i] < rAuxVariables.X_min) rAuxVariables.X_min = X_min_partition[
i];
1134 if(Y_max_partition[
i] > rAuxVariables.Y_max) rAuxVariables.Y_max = Y_max_partition[
i];
1135 if(Y_min_partition[
i] < rAuxVariables.Y_min) rAuxVariables.Y_min = Y_min_partition[
i];
1139 double AverageElementLength = 0.0;
1141 int NElems =
static_cast<int>(rModelPart.
Elements().size());
1142 ModelPart::ElementsContainerType::iterator el_begin = rModelPart.
ElementsBegin();
1144 #pragma omp parallel for reduction(+:AverageElementLength)
1145 for(
int i = 0;
i < NElems;
i++)
1147 ModelPart::ElementsContainerType::iterator itElem = el_begin +
i;
1149 AverageElementLength += itElem->GetGeometry().Length();
1152 AverageElementLength = AverageElementLength/NElems;
1155 rAuxVariables.NRows =
int((rAuxVariables.Y_max-rAuxVariables.Y_min)/(AverageElementLength));
1156 rAuxVariables.NColumns =
int((rAuxVariables.X_max-rAuxVariables.X_min)/(AverageElementLength));
1157 if(rAuxVariables.NRows <= 0) rAuxVariables.NRows = 1;
1158 if(rAuxVariables.NColumns <= 0) rAuxVariables.NColumns = 1;
1159 rAuxVariables.RowSize = (rAuxVariables.Y_max-rAuxVariables.Y_min)/rAuxVariables.NRows;
1160 rAuxVariables.ColumnSize = (rAuxVariables.X_max-rAuxVariables.X_min)/rAuxVariables.NColumns;
1165 void SetFracturePoints(
1166 PropagationGlobalVariables& rPropagationData,
1167 UtilityVariables& rAuxVariables,
1168 Parameters& rParameters,
1169 ModelPart& rModelPart)
1172 this->ComputeCellMatrixDimensions(rAuxVariables,rModelPart);
1174 rPropagationData.FracturePointsCellMatrix.resize(rAuxVariables.NRows);
1175 for(
int i = 0;
i < rAuxVariables.NRows;
i++) rPropagationData.FracturePointsCellMatrix[
i].resize(rAuxVariables.NColumns);
1178 FracturePoint MyFracturePoint;
1180 const ProcessInfo& CurrentProcessInfo = rModelPart.GetProcessInfo();
1181 rPropagationData.pProcessInfo = rModelPart.pGetProcessInfo();
1182 array_1d<double,3> AuxLocalCoordinates;
1183 array_1d<double,3> AuxGlobalCoordinates;
1185 unsigned int NumBodySubModelParts = rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"].size();
1188 for(
unsigned int i = 0;
i < NumBodySubModelParts;
i++)
1190 ModelPart& BodySubModelPart = rModelPart.
GetSubModelPart(rParameters[
"fracture_data"][
"body_domain_sub_model_part_list"][
i].GetString());
1192 int NElems =
static_cast<int>(BodySubModelPart.Elements().size());
1193 ModelPart::ElementsContainerType::iterator el_begin = BodySubModelPart.
ElementsBegin();
1196 #pragma omp parallel for private(MyFracturePoint,MyIntegrationMethod,AuxLocalCoordinates,AuxGlobalCoordinates)
1197 for(
int j = 0;
j < NElems;
j++)
1199 ModelPart::ElementsContainerType::iterator itElem = el_begin +
j;
1202 MyIntegrationMethod = itElem->GetIntegrationMethod();
1204 unsigned int NumGPoints = IntegrationPoints.size();
1205 Vector detJContainer(NumGPoints);
1206 rGeom.DeterminantOfJacobian(detJContainer,MyIntegrationMethod);
1207 std::vector<double> DamageVector(NumGPoints);
1208 itElem->CalculateOnIntegrationPoints(DAMAGE_VARIABLE,DamageVector,CurrentProcessInfo);
1213 for (
unsigned int GPoint = 0; GPoint < NumGPoints; GPoint++ )
1216 AuxLocalCoordinates[0] = IntegrationPoints[GPoint][0];
1217 AuxLocalCoordinates[1] = IntegrationPoints[GPoint][1];
1218 AuxLocalCoordinates[2] = IntegrationPoints[GPoint][2];
1219 rGeom.GlobalCoordinates(AuxGlobalCoordinates,AuxLocalCoordinates);
1220 MyFracturePoint.Coordinates[0] = AuxGlobalCoordinates[0];
1221 MyFracturePoint.Coordinates[1] = AuxGlobalCoordinates[1];
1224 MyFracturePoint.Weight = detJContainer[GPoint]*IntegrationPoints[GPoint].Weight();
1227 MyFracturePoint.Damage = DamageVector[GPoint];
1230 Row =
int((rAuxVariables.Y_max-MyFracturePoint.Coordinates[1])/rAuxVariables.RowSize);
1231 Column =
int((MyFracturePoint.Coordinates[0]-rAuxVariables.X_min)/rAuxVariables.ColumnSize);
1234 MyFracturePoint.pElement = (*(itElem.base()));
1236 #pragma omp critical
1238 rPropagationData.FracturePointsCellMatrix[Row][Column].push_back(MyFracturePoint);
1247 void PropagateFracture(
1248 const unsigned int& itFracture,
1249 PropagationGlobalVariables& rPropagationData,
1250 PropagationLocalVariables& rAuxPropagationVariables,
1251 Parameters& rParameters)
1256 double TipDen = 0.0;
1258 #pragma omp parallel sections reduction(+:TipX,TipY,TipDen)
1262 for(
unsigned int i = 0;
i < rAuxPropagationVariables.TopFrontFracturePoints.size();
i++)
1264 this->AverageTipCoordinates(TipX,TipY,TipDen,*(rAuxPropagationVariables.TopFrontFracturePoints[
i]));
1269 for(
unsigned int i = 0;
i < rAuxPropagationVariables.BotFrontFracturePoints.size();
i++)
1271 this->AverageTipCoordinates(TipX,TipY,TipDen,*(rAuxPropagationVariables.BotFrontFracturePoints[
i]));
1276 array_1d<double,2> AuxArray1;
1277 array_1d<double,2> AuxArray2;
1278 const double PropagationWidth = rParameters[
"fracture_data"][
"propagation_width"].GetDouble();
1279 int MotherFractureId = rParameters[
"fractures_list"][itFracture][
"id"].GetInt();
1280 Propagation MyPropagation;
1282 MyPropagation.MotherFractureId = MotherFractureId;
1284 MyPropagation.TipCoordinates[0] = TipX/TipDen;
1285 MyPropagation.TipCoordinates[1] = TipY/TipDen;
1286 MyPropagation.TipCoordinates[2] = 0.0;
1288 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1289 AuxArray1[1] += 0.5*PropagationWidth;
1290 noalias(AuxArray2) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1291 MyPropagation.TopInitCoordinates[0] = AuxArray2[0];
1292 MyPropagation.TopInitCoordinates[1] = AuxArray2[1];
1293 MyPropagation.TopInitCoordinates[2] = 0.0;
1295 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1296 AuxArray1[1] -= 0.5*PropagationWidth;
1297 noalias(AuxArray2) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1298 MyPropagation.BotInitCoordinates[0] = AuxArray2[0];
1299 MyPropagation.BotInitCoordinates[1] = AuxArray2[1];
1300 MyPropagation.BotInitCoordinates[2] = 0.0;
1303 const double PropagationLength = rParameters[
"fracture_data"][
"propagation_length"].GetDouble();
1304 const double CorrectionTol = rParameters[
"fracture_data"][
"correction_tolerance"].GetDouble();
1305 AuxArray2[0] = MyPropagation.TipCoordinates[0];
1306 AuxArray2[1] = MyPropagation.TipCoordinates[1];
1307 noalias(AuxArray1) =
prod(rAuxPropagationVariables.RotationMatrix,AuxArray2);
1308 AuxArray1[1] = rAuxPropagationVariables.TipLocalCoordinates[1];
1309 noalias(AuxArray2) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1310 double Distance = sqrt((MyPropagation.TipCoordinates[0]-AuxArray2[0])*(MyPropagation.TipCoordinates[0]-AuxArray2[0])+
1311 (MyPropagation.TipCoordinates[1]-AuxArray2[1])*(MyPropagation.TipCoordinates[1]-AuxArray2[1]));
1312 if (Distance <= PropagationLength*CorrectionTol)
1314 MyPropagation.TipCoordinates[0] = AuxArray2[0];
1315 MyPropagation.TipCoordinates[1] = AuxArray2[1];
1319 array_1d<double,3> LocalCoordinates;
1320 Element::Pointer pElement;
1321 bool IsInside =
false;
1323 for(
unsigned int i = 0;
i < rAuxPropagationVariables.TopFrontFracturePoints.size();
i++)
1325 pElement = rAuxPropagationVariables.TopFrontFracturePoints[
i]->pElement;
1326 IsInside = pElement->GetGeometry().IsInside(MyPropagation.TipCoordinates,LocalCoordinates);
1329 if(IsInside ==
false)
1331 for(
unsigned int i = 0;
i < rAuxPropagationVariables.BotFrontFracturePoints.size();
i++)
1333 pElement = rAuxPropagationVariables.BotFrontFracturePoints[
i]->pElement;
1334 IsInside = pElement->GetGeometry().IsInside(MyPropagation.TipCoordinates,LocalCoordinates);
1339 const double PropagationDamage = rParameters[
"fracture_data"][
"propagation_damage"].GetDouble();
1340 const ProcessInfo& CurrentProcessInfo = *(rPropagationData.pProcessInfo);
1342 if (IsInside ==
true)
1344 std::vector<double> DamageVector;
1345 pElement->CalculateOnIntegrationPoints(DAMAGE_VARIABLE,DamageVector,CurrentProcessInfo);
1346 unsigned int NumGPoints = DamageVector.size();
1347 double InvNumGPoints = 1.0/
static_cast<double>(NumGPoints);
1348 double ElementDamage = 0.0;
1349 for (
unsigned int i = 0;
i < NumGPoints;
i++)
1351 ElementDamage += DamageVector[
i];
1353 ElementDamage *= InvNumGPoints;
1354 if (ElementDamage >= 0.5*PropagationDamage)
1356 rPropagationData.PropagationVector.push_back(MyPropagation);
1357 rPropagationData.PropagateFractures =
true;
1363 bool PropagateTop =
false;
1364 bool PropagateBot =
false;
1365 double TopEndX = 0.0;
1366 double TopEndY = 0.0;
1367 double TopEndDen = 0.0;
1368 double BotEndX = 0.0;
1369 double BotEndY = 0.0;
1370 double BotEndDen = 0.0;
1371 array_1d<double,3> GlobalCoordinates;
1373 #pragma omp parallel sections private(GlobalCoordinates,LocalCoordinates,pElement,IsInside)
1377 for(
unsigned int i = 0;
i < rAuxPropagationVariables.TopFrontFracturePoints.size();
i++)
1379 this->AverageTipCoordinates(TopEndX,TopEndY,TopEndDen,*(rAuxPropagationVariables.TopFrontFracturePoints[
i]));
1381 GlobalCoordinates[0] = TopEndX/TopEndDen;
1382 GlobalCoordinates[1] = TopEndY/TopEndDen;
1383 GlobalCoordinates[2] = 0.0;
1387 for(
unsigned int i = 0;
i < rAuxPropagationVariables.TopFrontFracturePoints.size();
i++)
1389 pElement = rAuxPropagationVariables.TopFrontFracturePoints[
i]->pElement;
1390 IsInside = pElement->GetGeometry().IsInside(GlobalCoordinates,LocalCoordinates);
1394 if (IsInside ==
true)
1396 std::vector<double> DamageVector;
1397 pElement->CalculateOnIntegrationPoints(DAMAGE_VARIABLE,DamageVector,CurrentProcessInfo);
1398 unsigned int NumGPoints = DamageVector.size();
1399 double InvNumGPoints = 1.0/
static_cast<double>(NumGPoints);
1400 double ElementDamage = 0.0;
1401 for (
unsigned int i = 0;
i < NumGPoints;
i++)
1403 ElementDamage += DamageVector[
i];
1405 ElementDamage *= InvNumGPoints;
1406 if (ElementDamage >= PropagationDamage)
1407 PropagateTop =
true;
1412 for(
unsigned int i = 0;
i < rAuxPropagationVariables.BotFrontFracturePoints.size();
i++)
1414 this->AverageTipCoordinates(BotEndX,BotEndY,BotEndDen,*(rAuxPropagationVariables.BotFrontFracturePoints[
i]));
1416 GlobalCoordinates[0] = BotEndX/BotEndDen;
1417 GlobalCoordinates[1] = BotEndY/BotEndDen;
1418 GlobalCoordinates[2] = 0.0;
1422 for(
unsigned int i = 0;
i < rAuxPropagationVariables.BotFrontFracturePoints.size();
i++)
1424 pElement = rAuxPropagationVariables.BotFrontFracturePoints[
i]->pElement;
1425 IsInside = pElement->GetGeometry().IsInside(GlobalCoordinates,LocalCoordinates);
1429 if (IsInside ==
true)
1431 std::vector<double> DamageVector;
1432 pElement->CalculateOnIntegrationPoints(DAMAGE_VARIABLE,DamageVector,CurrentProcessInfo);
1433 unsigned int NumGPoints = DamageVector.size();
1434 double InvNumGPoints = 1.0/
static_cast<double>(NumGPoints);
1435 double ElementDamage = 0.0;
1436 for (
unsigned int i = 0;
i < NumGPoints;
i++)
1438 ElementDamage += DamageVector[
i];
1440 ElementDamage *= InvNumGPoints;
1441 if (ElementDamage >= PropagationDamage)
1442 PropagateBot =
true;
1447 if (PropagateTop ==
true && PropagateBot ==
true)
1449 Bifurcation MyBifurcation;
1450 MyBifurcation.MotherFractureId = MotherFractureId;
1452 MyBifurcation.TopTipCoordinates[0] = TopEndX/TopEndDen;
1453 MyBifurcation.TopTipCoordinates[1] = TopEndY/TopEndDen;
1454 MyBifurcation.TopTipCoordinates[2] = 0.0;
1456 MyBifurcation.BotTipCoordinates[0] = BotEndX/BotEndDen;
1457 MyBifurcation.BotTipCoordinates[1] = BotEndY/BotEndDen;
1458 MyBifurcation.BotTipCoordinates[2] = 0.0;
1460 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1461 AuxArray1[0] -= PropagationWidth;
1462 AuxArray1[1] += 0.5*PropagationWidth;
1463 noalias(AuxArray2) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1464 MyBifurcation.TopInitCoordinates[0] = AuxArray2[0];
1465 MyBifurcation.TopInitCoordinates[1] = AuxArray2[1];
1466 MyBifurcation.TopInitCoordinates[2] = 0.0;
1468 noalias(AuxArray1) = rAuxPropagationVariables.TipLocalCoordinates;
1469 AuxArray1[0] -= PropagationWidth;
1470 AuxArray1[1] -= 0.5*PropagationWidth;
1471 noalias(AuxArray2) =
prod(
trans(rAuxPropagationVariables.RotationMatrix),AuxArray1);
1472 MyBifurcation.BotInitCoordinates[0] = AuxArray2[0];
1473 MyBifurcation.BotInitCoordinates[1] = AuxArray2[1];
1474 MyBifurcation.BotInitCoordinates[2] = 0.0;
1476 rPropagationData.BifurcationVector.push_back(MyBifurcation);
1477 rPropagationData.PropagateFractures =
true;
1480 else if (PropagateTop ==
true)
1482 MyPropagation.TipCoordinates[0] = TopEndX/TopEndDen;
1483 MyPropagation.TipCoordinates[1] = TopEndY/TopEndDen;
1484 MyPropagation.TipCoordinates[2] = 0.0;
1486 rPropagationData.PropagationVector.push_back(MyPropagation);
1487 rPropagationData.PropagateFractures =
true;
1490 else if (PropagateBot ==
true)
1492 MyPropagation.TipCoordinates[0] = BotEndX/BotEndDen;
1493 MyPropagation.TipCoordinates[1] = BotEndY/BotEndDen;
1494 MyPropagation.TipCoordinates[2] = 0.0;
1496 rPropagationData.PropagationVector.push_back(MyPropagation);
1497 rPropagationData.PropagateFractures =
true;
1504 void CalculateTipRotationMatrix(
1505 const unsigned int& itFracture,
1506 BoundedMatrix<double,2,2>& rRotationMatrix,
1507 Parameters& rParameters)
1509 array_1d<double,3> TipPointCoordinates;
1510 array_1d<double,3> TopPointCoordinates;
1511 array_1d<double,3> BotPointCoordinates;
1512 for(
unsigned int i = 0;
i < 3;
i++)
1514 TipPointCoordinates[
i] = rParameters[
"fractures_list"][itFracture][
"tip_point"][
"coordinates"][
i].GetDouble();
1515 TopPointCoordinates[
i] = rParameters[
"fractures_list"][itFracture][
"top_point"][
"coordinates"][
i].GetDouble();
1516 BotPointCoordinates[
i] = rParameters[
"fractures_list"][itFracture][
"bot_point"][
"coordinates"][
i].GetDouble();
1519 array_1d<double, 3> pmid0;
1520 noalias(pmid0) = 0.5 * (TopPointCoordinates + BotPointCoordinates);
1522 array_1d<double, 3> Vx;
1523 noalias(Vx) = TipPointCoordinates - pmid0;
1524 double inv_norm_x = 1.0/
norm_2(Vx);
1525 Vx[0] *= inv_norm_x;
1526 Vx[1] *= inv_norm_x;
1530 rRotationMatrix(0,0) = Vx[0];
1531 rRotationMatrix(0,1) = Vx[1];
1535 rRotationMatrix(1,0) = -Vx[1];
1536 rRotationMatrix(1,1) = Vx[0];
1548 void AverageTipCoordinates(
1551 double& rTipDenominator,
1552 const FracturePoint& MyFracturePoint)
1554 rTipX += MyFracturePoint.Weight * MyFracturePoint.Damage * (MyFracturePoint.Coordinates[0]);
1555 rTipY += MyFracturePoint.Weight * MyFracturePoint.Damage * (MyFracturePoint.Coordinates[1]);
1556 rTipDenominator += MyFracturePoint.Weight * MyFracturePoint.Damage;
Geometry< NodeType > GeometryType
definition of the geometry type with given NodeType
Definition: element.h:83
Definition: fracture_propagation_2D_utilities.hpp:38
bool CheckFracturePropagation(Parameters &rParameters, ModelPart &rModelPart, const bool &move_mesh_flag)
Definition: fracture_propagation_2D_utilities.hpp:125
void InitializeMapping(UtilityVariables &rAuxVariables, ModelPart &rModelPartNew, const bool &move_mesh_flag)
Mapping ---------------------------------------------------------------------------------------------...
Definition: fracture_propagation_2D_utilities.hpp:462
virtual ~FracturePropagation2DUtilities()
Destructor.
Definition: fracture_propagation_2D_utilities.hpp:121
void CheckFracture(const unsigned int &itFracture, PropagationGlobalVariables &rPropagationData, const UtilityVariables &AuxVariables, Parameters &rParameters)
Definition: fracture_propagation_2D_utilities.hpp:189
void InitializeCheckFracture(PropagationGlobalVariables &rPropagationData, UtilityVariables &rAuxVariables, Parameters &rParameters, ModelPart &rModelPart, const bool &move_mesh_flag)
Member Variables.
Definition: fracture_propagation_2D_utilities.hpp:169
void ResetMeshPosition(ModelPart &rModelPart)
Common ----------------------------------------------------------------------------------------------...
Definition: fracture_propagation_2D_utilities.hpp:1044
void GaussPointStateVariableMapping(const UtilityVariables &AuxVariables, Parameters &rParameters, ModelPart &rModelPartOld, ModelPart &rModelPartNew)
Definition: fracture_propagation_2D_utilities.hpp:730
FracturePropagation2DUtilities()
Constructor.
Definition: fracture_propagation_2D_utilities.hpp:116
void WritePropagationData(const PropagationGlobalVariables &PropagationData, Parameters &rParameters)
Definition: fracture_propagation_2D_utilities.hpp:310
void MappingModelParts(Parameters &rParameters, ModelPart &rModelPartOld, ModelPart &rModelPartNew, const bool &move_mesh_flag)
Definition: fracture_propagation_2D_utilities.hpp:146
void FinalizeCheckFracture(const PropagationGlobalVariables &PropagationData, Parameters &rParameters, ModelPart &rModelPart, const bool &move_mesh_flag)
Definition: fracture_propagation_2D_utilities.hpp:289
void NodalVariablesMapping(const UtilityVariables &AuxVariables, Parameters &rParameters, ModelPart &rModelPartOld, ModelPart &rModelPartNew)
Definition: fracture_propagation_2D_utilities.hpp:476
void UpdateMeshPosition(ModelPart &rModelPart)
Definition: fracture_propagation_2D_utilities.hpp:1063
KRATOS_CLASS_POINTER_DEFINITION(FracturePropagation2DUtilities)
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
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_2D_utilities.hpp:73
int MotherFractureId
Definition: fracture_propagation_2D_utilities.hpp:74
array_1d< double, 3 > TopTipCoordinates
Definition: fracture_propagation_2D_utilities.hpp:77
array_1d< double, 3 > BotInitCoordinates
Definition: fracture_propagation_2D_utilities.hpp:76
array_1d< double, 3 > TopInitCoordinates
Definition: fracture_propagation_2D_utilities.hpp:75
array_1d< double, 3 > BotTipCoordinates
Definition: fracture_propagation_2D_utilities.hpp:78
Structs for fracture propagation check --------------------------------------------------------------...
Definition: fracture_propagation_2D_utilities.hpp:54
double TipDistance
Definition: fracture_propagation_2D_utilities.hpp:56
array_1d< double, 2 > Coordinates
Definition: fracture_propagation_2D_utilities.hpp:55
double Weight
Definition: fracture_propagation_2D_utilities.hpp:56
double Damage
Definition: fracture_propagation_2D_utilities.hpp:56
Element::Pointer pElement
Definition: fracture_propagation_2D_utilities.hpp:57
Structs for mapping model parts ---------------------------------------------------------------------...
Definition: fracture_propagation_2D_utilities.hpp:106
array_1d< double, 3 > Coordinates
Definition: fracture_propagation_2D_utilities.hpp:107
double StateVariable
Definition: fracture_propagation_2D_utilities.hpp:108
double Weight
Definition: fracture_propagation_2D_utilities.hpp:108
Definition: fracture_propagation_2D_utilities.hpp:84
std::vector< Bifurcation > BifurcationVector
Definition: fracture_propagation_2D_utilities.hpp:89
std::vector< Propagation > PropagationVector
Definition: fracture_propagation_2D_utilities.hpp:88
bool PropagateFractures
Definition: fracture_propagation_2D_utilities.hpp:87
std::vector< std::vector< std::vector< FracturePoint > > > FracturePointsCellMatrix
Definition: fracture_propagation_2D_utilities.hpp:85
ProcessInfo::Pointer pProcessInfo
Definition: fracture_propagation_2D_utilities.hpp:86
Definition: fracture_propagation_2D_utilities.hpp:63
array_1d< double, 3 > TopInitCoordinates
Definition: fracture_propagation_2D_utilities.hpp:65
array_1d< double, 3 > BotInitCoordinates
Definition: fracture_propagation_2D_utilities.hpp:66
int MotherFractureId
Definition: fracture_propagation_2D_utilities.hpp:64
array_1d< double, 3 > TipCoordinates
Definition: fracture_propagation_2D_utilities.hpp:67
Definition: fracture_propagation_2D_utilities.hpp:95
array_1d< double, 2 > TipCoordinates
Definition: fracture_propagation_2D_utilities.hpp:97
BoundedMatrix< double, 2, 2 > RotationMatrix
Definition: fracture_propagation_2D_utilities.hpp:96
std::vector< FracturePoint * > BotFrontFracturePoints
Definition: fracture_propagation_2D_utilities.hpp:100
std::vector< FracturePoint * > TopFrontFracturePoints
Definition: fracture_propagation_2D_utilities.hpp:99
array_1d< double, 2 > TipLocalCoordinates
Definition: fracture_propagation_2D_utilities.hpp:98
Basic Structs for the utility -----------------------------------------------------------------------...
Definition: fracture_propagation_2D_utilities.hpp:45
double RowSize
Definition: fracture_propagation_2D_utilities.hpp:48
double Y_min
Definition: fracture_propagation_2D_utilities.hpp:46
double X_min
Definition: fracture_propagation_2D_utilities.hpp:46
int NRows
Definition: fracture_propagation_2D_utilities.hpp:47
double ColumnSize
Definition: fracture_propagation_2D_utilities.hpp:48
double X_max
Definition: fracture_propagation_2D_utilities.hpp:46
int NColumns
Definition: fracture_propagation_2D_utilities.hpp:47
double Y_max
Definition: fracture_propagation_2D_utilities.hpp:46