10 #if !defined(KRATOS_COMPOUND_NOSES_BOUNDING_BOX_H_INCLUDED )
11 #define KRATOS_COMPOUND_NOSES_BOUNDING_BOX_H_INCLUDED
76 enum ContactFace{ FreeSurface=0, RakeSurface=1, TipSurface=2, ClearanceSurface=3 };
141 std::cout<<
"Calling Rigid Nose Wall BBX empty constructor" <<std::endl;
156 "parameters_list": [],
157 "velocity": [0.0, 0.0, 0.0],
158 "angular_velocity": [0.0, 0.0, 0.0],
160 "local_axes":[ [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0] ]
174 unsigned int list_size = CustomParameters[
"parameters_list"].
size();
176 Vector Radius (list_size);
177 Matrix Centers (list_size,3);
178 Vector RakeAngles (list_size);
179 Vector ClearanceAngles(list_size);
180 Vector Convexities (list_size);
182 for(
unsigned int i=0;
i<list_size;
i++ )
184 Parameters NoseParameters = CustomParameters[
"parameters_list"][
i];
186 Radius[
i] = NoseParameters[
"radius"].
GetDouble();
188 Centers(
i,0) = NoseParameters[
"center"][0].
GetDouble();
189 Centers(
i,1) = NoseParameters[
"center"][1].
GetDouble();
190 Centers(
i,2) = NoseParameters[
"center"][2].
GetDouble();
192 RakeAngles[
i] = NoseParameters[
"rake_angle"].
GetDouble();
193 ClearanceAngles[
i] = NoseParameters[
"clearance_angle"].
GetDouble();
194 Convexities[
i] = NoseParameters[
"convexity"].
GetInt();
198 Velocity[0] = CustomParameters[
"velocity"][0].
GetDouble();
199 Velocity[1] = CustomParameters[
"velocity"][1].
GetDouble();
200 Velocity[2] = CustomParameters[
"velocity"][2].
GetDouble();
202 Vector AngularVelocity(3);
203 AngularVelocity[0] = CustomParameters[
"angular_velocity"][0].
GetDouble();
204 AngularVelocity[1] = CustomParameters[
"angular_velocity"][1].
GetDouble();
205 AngularVelocity[2] = CustomParameters[
"angular_velocity"][2].
GetDouble();
212 for(
unsigned int i=0;
i<3;
i++)
215 LowerPoint[
i] = -1.0;
223 if( list_size == 1 ){
224 for(
unsigned int i=0;
i<3;
i++)
226 UpperPoint[
i] += Centers(0,
i);
227 LowerPoint[
i] += Centers(0,
i);
230 else if( Centers(0, v_axis) > Centers(list_size-1, v_axis) ){
231 for(
unsigned int i=0;
i<3;
i++)
233 UpperPoint[
i] += Centers(0,
i);
234 LowerPoint[
i] += Centers(list_size-1,
i);
238 for(
unsigned int i=0;
i<3;
i++)
240 UpperPoint[
i] += Centers(list_size-1,
i);
241 LowerPoint[
i] += Centers(0,
i);
248 unsigned int size = CustomParameters[
"local_axes"].
size();
250 for(
unsigned int i=0;
i<size;
i++ )
252 Parameters LocalAxesRow = CustomParameters[
"local_axes"][
i];
254 InitialLocalMatrix(0,
i) = LocalAxesRow[0].
GetDouble();
255 InitialLocalMatrix(1,
i) = LocalAxesRow[1].
GetDouble();
256 InitialLocalMatrix(2,
i) = LocalAxesRow[2].
GetDouble();
259 this->CreateCompoundNosesBox(Radius,RakeAngles,ClearanceAngles,Centers,Convexities,
260 Velocity, AngularVelocity, UpperPoint, LowerPoint, InitialLocalMatrix);
280 Matrix InitialLocalMatrix)
285 this->CreateCompoundNosesBox(Radius,RakeAngles,ClearanceAngles,Centers,Convexities,
286 Velocity, AngularVelocity, UpperPoint, LowerPoint, InitialLocalMatrix);
340 return GetNearerRadius(LocalPoint);
354 PointType LocalNearerPoint = GetNearerCenter(LocalPoint);
358 return LocalNearerPoint;
408 unsigned int SelectedNose = BoxNoseSearch(LocalPoint);
412 double NoseRadius = rWallNose.
Radius;
424 switch( ContactSearch(LocalPoint, NoseRadius, rWallNose) )
444 case ClearanceSurface:
487 unsigned int SelectedNose = BoxNoseSearch(LocalPoint);
491 double NoseRadius = rWallNose.
Radius;
495 switch( ContactSearch(LocalPoint, NoseRadius, rWallNose) )
502 is_inside = CalculateRakeSurface(LocalPoint, rGapNormal, rNormal, rWallNose);
506 is_inside = CalculateTipSurface(LocalPoint, rGapNormal, rNormal, rWallNose);
509 case ClearanceSurface:
510 is_inside = CalculateClearanceSurface(LocalPoint, rGapNormal, rNormal, rWallNose);
547 unsigned int NodeId = 0;
553 unsigned int InitialNodeId = NodeId;
556 std::vector<std::string> BoundaryModelPartsName;
564 if( i_mp->Is(BOUNDARY) || i_mp->Is(ACTIVE) ){
565 for(ModelPart::NodesContainerType::iterator i_node = i_mp->NodesBegin() ; i_node != i_mp->NodesEnd() ; ++i_node)
567 if( i_node->Id() == rModelPart.
Nodes().front().Id() ){
568 BoundaryModelPartsName.push_back(i_mp->Name());
598 std::vector<PointType> FacePoints;
604 bool order_changed =
false;
607 this->GetNosePoints(
mBoxNoses[
i],RakePoint,ClearancePoint,TipPoint);
609 order_changed =
false;
615 this->GetPlaneTangent(Normal,RakePoint,TipPoint,Tangent);
623 if(
norm_2(RakePoint-FirstPoint) >
norm_2(ClearancePoint-FirstPoint) ){
626 order_changed =
true;
627 BasePoint = ClearancePoint;
628 ClearancePoint = RakePoint;
629 RakePoint = BasePoint;
634 BasePoint = FirstPoint;
636 FacePoints.push_back(BasePoint);
640 FirstPoint = ClearancePoint;
644 BasePoint = RakePoint;
646 FacePoints.push_back(BasePoint);
651 length1 = sqrt(length1);
652 length2 = sqrt(length2);
655 for(
int k=1;
k<=angular_partitions;
k++)
658 alpha = (tip_alpha *
double(
k) )/(
double)(angular_partitions-1);
661 RotationAxis = DirectionX *
alpha;
664 RotatedDirectionY = RakePoint -
mBoxNoses[
i].Center;
671 FacePoints.push_back(BasePoint);
679 BasePoint = ClearancePoint;
681 FacePoints.push_back(BasePoint);
686 this->GetClearanceNormal(
mBoxNoses[
i],Normal);
689 this->GetPlaneTangent(Normal,FirstPoint,TipPoint,Tangent);
695 FacePoints.push_back(BasePoint);
706 for(
unsigned int i=0;
i<FacePoints.size();
i++)
711 NodeType::Pointer pNode = this->
CreateNode(rModelPart, FacePoints[
i], NodeId);
713 pNode->Set(RIGID,
true);
718 for(
unsigned int j=0;
j<BoundaryModelPartsName.size();
j++)
719 (pMainModelPart->
GetSubModelPart(BoundaryModelPartsName[
j])).AddNode( pNode );
731 for(
unsigned int i=0;
i<FacePoints.size();
i++)
739 NodeType::Pointer pNode = this->
CreateNode(rModelPart, FacePoints[
i], NodeId);
741 pNode->Set(RIGID,
true);
746 for(
unsigned int j=0;
j<BoundaryModelPartsName.size();
j++)
747 (pMainModelPart->
GetSubModelPart(BoundaryModelPartsName[
j])).AddNode( pNode );
752 double FinalNodeId = NodeId;
757 Matrix RotationMatrix(3,3);
759 Axis[0] = RotationMatrix(2,0);
760 Axis[1] = RotationMatrix(2,1);
761 Axis[2] = RotationMatrix(2,2);
766 for(
unsigned int i=0;
i<FacePoints.size();
i++)
770 FacePoints[
i] += Axis;
772 NodeType::Pointer pNode = this->
CreateNode(rModelPart, FacePoints[
i], NodeId);
774 pNode->Set(RIGID,
true);
779 for(
unsigned int j=0;
j<BoundaryModelPartsName.size();
j++)
780 (pMainModelPart->
GetSubModelPart(BoundaryModelPartsName[
j])).AddNode( pNode );
809 std::string
Info()
const override
811 return "CompoundNosesBoundingBox";
866 if( i_mp->Is(ACTIVE) )
872 if( i_mp->Is(ACTIVE) )
878 unsigned int ElementId = 0;
884 unsigned int NodeId = 0;
892 GeometryType::Pointer pFace;
893 ElementType::Pointer pElement;
897 Properties::Pointer pProperties = Kratos::make_shared<Properties>(number_of_properties);
900 unsigned int Id = rInitialNodeId;
910 FaceNodesIds[0] = rInitialNodeId +
counter ;
911 FaceNodesIds[1] = rInitialNodeId +
counter + 1;
920 for(
unsigned int j=0;
j<2;
j++)
923 pFace = Kratos::make_shared<Line2D2<NodeType> >(FaceNodes);
924 pElement = Kratos::make_intrusive<Element>(ElementId, pFace, pProperties);
927 pElement->Set(ACTIVE,
false);
928 pComputingModelPart->AddElement(pElement);
930 Id = rInitialNodeId +
counter + 1;
952 if( i_mp->Is(ACTIVE) )
958 if( i_mp->Is(ACTIVE) )
964 unsigned int ElementId = 0;
970 unsigned int NodeId = 0;
978 GeometryType::Pointer pFace;
979 ElementType::Pointer pElement;
983 Properties::Pointer pProperties = Kratos::make_shared<Properties>(number_of_properties);
986 unsigned int Id = rSecondInitialNodeId;
996 FaceNodesIds[0] = rFirstInitialNodeId +
counter + 1;
997 FaceNodesIds[1] = rFirstInitialNodeId +
counter;
998 FaceNodesIds[2] = rSecondInitialNodeId +
counter;
999 FaceNodesIds[3] = rSecondInitialNodeId +
counter + 1;
1010 for(
unsigned int j=0;
j<4;
j++)
1013 pFace = Kratos::make_shared<Quadrilateral3D4<NodeType> >(FaceNodes);
1014 pElement = Kratos::make_intrusive<Element>(ElementId, pFace, pProperties);
1017 pElement->Set(ACTIVE,
false);
1018 pComputingModelPart->AddElement(pElement);
1020 Id = rSecondInitialNodeId +
counter + 1;
1070 unsigned int SelectedNose = BoxNoseSearch(rPoint);
1072 BoxNoseVariables& rWallNose =
mBoxNoses[SelectedNose];
1074 return rWallNose.Center;
1080 double GetNearerRadius(
const PointType& rPoint)
1082 unsigned int SelectedNose = BoxNoseSearch(rPoint);
1084 BoxNoseVariables& rWallNose =
mBoxNoses[SelectedNose];
1086 return rWallNose.Radius;
1093 bool CheckValidAngle(
double& rAngle )
1095 bool valid_angle =
true;
1097 for(
int i = 0;
i<=360;
i+=90 ){
1098 if( fabs(rAngle) <
double(
i +
tol) && fabs(rAngle) >
double(
i -
tol) ){
1099 valid_angle =
false;
1117 if( rRadius.size() != rRakeAngles.size() || rRakeAngles.size() != rClearanceAngles.size() )
1118 std::cout<<
" Introduced walls are not consistent in sizes "<<std::endl;
1120 double pi = 3.141592654;
1122 std::cout<<
" [--NOSE-WALL--] "<<std::endl;
1123 std::cout<<
" [NOSES:"<<rRadius.size()<<
"]"<<std::endl;
1127 for(
unsigned int i=0;
i<rRadius.size();
i++)
1129 BoxNoseVariables WallNose;
1130 WallNose.Initialize();
1132 WallNose.Convexity = rConvexities[
i];
1133 WallNose.Radius = rRadius[
i];
1137 WallNose.RakeAngle = ( 90 - rRakeAngles[
i] );
1141 WallNose.ClearanceAngle = ( 180 + rClearanceAngles[
i] );
1143 bool valid_angle = CheckValidAngle( WallNose.RakeAngle );
1147 WallNose.RakeAngle *=
pi / 180.0;
1148 WallNose.TangentRakeAngle = tan(0.5*
pi-WallNose.RakeAngle);
1151 WallNose.RakeAngle *=
pi / 180.0;
1152 WallNose.TangentRakeAngle = 0;
1155 valid_angle = CheckValidAngle( WallNose.ClearanceAngle );
1159 WallNose.ClearanceAngle *=
pi / 180.0;
1160 WallNose.TangentClearanceAngle = tan(0.5*
pi-WallNose.ClearanceAngle);
1163 WallNose.ClearanceAngle *=
pi / 180.0;
1164 WallNose.TangentClearanceAngle = 0;
1167 for(
unsigned int j=0;
j<rCenters.size2();
j++)
1169 WallNose.Center[
j] = rCenters(
i,
j);
1172 WallNose.SetInitialValues();
1178 std::cout<<
" [COMPONENT]["<<
i<<
"]"<<std::endl;
1179 std::cout<<
" [Convexity:"<<WallNose.Convexity<<std::endl;
1180 std::cout<<
" [Radius:"<<WallNose.Radius<<std::endl;
1181 std::cout<<
" [Center:"<<WallNose.Center<<std::endl;
1182 std::cout<<
" [Rake:"<<WallNose.RakeAngle<<std::endl;
1183 std::cout<<
" [Clearance:"<<WallNose.ClearanceAngle<<std::endl;
1184 std::cout<<
" [TangentRakeAngle:"<<WallNose.TangentRakeAngle<<std::endl;
1185 std::cout<<
" [TangentClearanceAngle:"<<WallNose.TangentClearanceAngle<<std::endl;
1191 std::cout<<
" [--------] "<<std::endl;
1198 mBox.
Center = 0.5 * ( rUpperPoint + rLowerPoint );
1222 unsigned int BoxNoseSearch(
const PointType& rPoint)
1232 unsigned int NumberBoxNoses =
mBoxNoses.size();
1234 unsigned int SelectedNose = 0;
1235 unsigned int SelectedNoseDistance = 0;
1236 unsigned int SelectedNoseRadius = 0;
1238 std::vector<double> NoseDistanceVector (NumberBoxNoses);
1240 for(
unsigned int i=0;
i<NumberBoxNoses;
i++)
1246 double NoseDistance =
norm_2( Distance );
1247 double NoseDistanceRadius =
norm_2( Distance );
1249 if( NoseDistance > 0 ){
1265 Distance = ( 1.0 - (
mBoxNoses[
i].Radius)/NoseDistance ) * Distance;
1266 NoseDistanceRadius =
norm_2( Distance );
1272 NoseDistanceVector[
i] = NoseDistance;
1275 if( NoseDistance < MinimumDistance ){
1276 MinimumDistance = NoseDistance;
1277 SelectedNoseDistance =
i;
1281 if( NoseDistanceRadius < MinimumDistanceRadius ){
1282 MinimumDistanceRadius = NoseDistanceRadius;
1283 SelectedNoseRadius =
i;
1291 if( SelectedNoseDistance == SelectedNoseRadius ){
1293 SelectedNose = SelectedNoseRadius;
1298 if(
mBoxNoses[SelectedNoseDistance].Convexity >
mBoxNoses[SelectedNoseRadius].Convexity ){
1301 if( NoseDistanceVector[SelectedNoseDistance] >
mBoxNoses[SelectedNoseDistance].Radius ){
1305 this->GetTipPoint(
mBoxNoses[SelectedNoseRadius],TipPoint);
1307 double sign = GetOrientation( rPoint,
mBoxNoses[SelectedNoseDistance].Center,
mBoxNoses[SelectedNoseRadius].Center, TipPoint );
1310 SelectedNose = SelectedNoseRadius;
1312 SelectedNose = SelectedNoseDistance;
1326 SelectedNose = SelectedNoseDistance;
1331 else if(
mBoxNoses[SelectedNoseDistance].Convexity <
mBoxNoses[SelectedNoseRadius].Convexity ){
1338 this->GetTipPoint(
mBoxNoses[SelectedNoseRadius],TipPoint);
1340 double sign = GetOrientation( rPoint,
mBoxNoses[SelectedNoseDistance].Center,
mBoxNoses[SelectedNoseRadius].Center, TipPoint );
1343 SelectedNose = SelectedNoseRadius;
1345 SelectedNose = SelectedNoseDistance;
1360 SelectedNose = SelectedNoseDistance;
1368 SelectedNose = SelectedNoseRadius;
1373 return SelectedNose;
1386 PointType DistanceToPoint = (rPoint - rMasterCenter);
1387 DistanceToPoint[2] = 0;
1388 PointType DistanceToCenter = (rSlaveCenter - rMasterCenter);
1389 DistanceToCenter[2] = 0;
1390 PointType DistanceToTip = (rSlaveTipPoint - rMasterCenter);
1391 DistanceToTip[2] = 0;
1398 double sign = (Orientation[2] * ReferenceOrientation[2]);
1409 ContactFace ContactSearch(
const PointType& rPoint,
const double& rRadius,
const BoxNoseVariables& rWallNose)
1414 ContactFace Face = FreeSurface;
1416 double FaceR = CalculateRakeFace( FaceR, rPoint, rRadius, rWallNose );
1417 double FaceT = CalculateTipFace( FaceT, rPoint, rRadius, rWallNose );
1418 double FaceC = CalculateClearanceFace( FaceC, rPoint, rRadius, rWallNose );
1420 double Face1=0, Face2=0, Face3=0;
1421 CalculateAuxiliarFaces( Face1, Face2, Face3, rPoint, rRadius, rWallNose );
1435 if(rWallNose.Convexity == 1){
1437 if(FaceR>0 && Face3<0 && Face1<0){
1440 else if(FaceT>0 && Face1>0 && Face2>0){
1443 else if(FaceC>0 && Face3>0 && Face2<0){
1444 Face = ClearanceSurface;
1453 if(FaceR<0 && Face3<0 && Face1<0){
1456 else if(FaceT<0 && Face1>0 && Face2>0){
1459 else if(FaceC<0 && Face3>0 && Face2<0){
1460 Face = ClearanceSurface;
1480 void PointFaceEvaluation(
const PointType& rPoint,
const PointType& rLinePoint,
const double& rTangentAngle,
PointType& rPointFace)
1492 rPointFace[0] = rPoint[0] - rLinePoint[0];
1493 rPointFace[1] = rPoint[1] - rLinePoint[1];
1505 double& CalculateRakeFace(
double& Face,
const PointType& rPoint,
const double& rRadius,
const BoxNoseVariables& rWallNose)
1516 RakePoint[0] = rWallNose.Center[0] - rRadius * sin(rWallNose.RakeAngle);
1517 RakePoint[1] = rWallNose.Center[1] + rRadius * cos(rWallNose.RakeAngle);
1529 PointFaceEvaluation(rPoint, RakePoint, rWallNose.TangentRakeAngle, PointFace);
1530 PointFaceEvaluation(rWallNose.Center, RakePoint, rWallNose.TangentRakeAngle, CenterFace);
1576 double& CalculateClearanceFace(
double& Face,
const PointType& rPoint,
const double& rRadius,
const BoxNoseVariables& rWallNose)
1586 ClearancePoint[0] = rWallNose.Center[0] - rRadius * sin(rWallNose.ClearanceAngle);
1587 ClearancePoint[1] = rWallNose.Center[1] + rRadius * cos(rWallNose.ClearanceAngle);
1588 ClearancePoint[2] = 0;
1597 PointFaceEvaluation(rPoint, ClearancePoint, rWallNose.TangentClearanceAngle, PointFace);
1598 PointFaceEvaluation(rWallNose.Center, ClearancePoint, rWallNose.TangentClearanceAngle, CenterFace);
1644 double& CalculateTipFace(
double& Face,
const PointType& rPoint,
const double& rRadius,
const BoxNoseVariables& rWallNose)
1648 Face = ( rRadius * rRadius ) - pow( (rPoint[0] - rWallNose.Center[0]), 2 ) - pow( (rPoint[1] - rWallNose.Center[1]), 2 );
1668 Line[0] = (rLinePoint[0] - rCenterPoint[0]);
1669 Line[1] = (rLinePoint[1] - rCenterPoint[1]);
1671 Line *= (1.0/
norm_2(Line));
1674 NormalLine[0] = -Line[1];
1675 NormalLine[1] = Line[0];
1680 Line1[0] = (rReferencePoint[0] - rCenterPoint[0]);
1681 Line1[1] = (rReferencePoint[1] - rCenterPoint[1]);
1684 Line2[0] = (rPoint[0] - rCenterPoint[0]);
1685 Line2[1] = (rPoint[1] - rCenterPoint[1]);
1689 double ReferenceDirection =
inner_prod(Line1,NormalLine);
1690 double PointDirection =
inner_prod(Line2,NormalLine);
1693 if( PointDirection != 0 ){
1694 rFace = PointDirection * ReferenceDirection;
1697 std::cout<<
" Critical point reached and accepted on a Face "<<std::endl;
1698 std::cout<<
" LINE "<<rLinePoint<<
" CENTER "<<rCenterPoint<<
" REFERENCE "<<rReferencePoint<<
" POINT "<<rPoint<<std::endl;
1709 void CalculateAuxiliarFaces(
double& rFace1,
double& rFace2,
double& rFace3,
const PointType& rPoint,
const double& rRadius,
const BoxNoseVariables& rWallNose)
1713 double pi = 3.141592654;
1719 RakePoint[0] = rWallNose.Center[0] - rRadius * sin(rWallNose.RakeAngle);
1720 RakePoint[1] = rWallNose.Center[1] + rRadius * cos(rWallNose.RakeAngle);
1725 ClearancePoint[0] = rWallNose.Center[0] - rRadius * sin(rWallNose.ClearanceAngle);
1726 ClearancePoint[1] = rWallNose.Center[1] + rRadius * cos(rWallNose.ClearanceAngle);
1727 ClearancePoint[2] = 0;
1731 TipPoint[0] = ( RakePoint[0] - rWallNose.Center[0] ) + ( ClearancePoint[0] - rWallNose.Center[0] );
1732 TipPoint[1] = ( RakePoint[1] - rWallNose.Center[1] ) + ( ClearancePoint[1] - rWallNose.Center[1] );
1734 TipPoint *= ( rRadius/
norm_2(TipPoint) );
1737 double OpenAngle = ( rWallNose.ClearanceAngle - rWallNose.RakeAngle ) * ( 180.0 /
pi ) - 90;
1739 if( OpenAngle < 90 )
1740 TipPoint = rWallNose.Center + TipPoint;
1742 TipPoint = rWallNose.Center - TipPoint;
1757 CalculateLineProjection(rFace1, rPoint, TipPoint, rWallNose.Center, RakePoint);
1767 CalculateLineProjection(rFace2, rPoint, TipPoint, rWallNose.Center, ClearancePoint);
1777 CalculateLineProjection(rFace3, rPoint, ClearancePoint, rWallNose.Center, TipPoint);
1789 void GetRakePoint(
const BoxNoseVariables& rWallNose,
PointType& rRakePoint)
1794 rRakePoint[0] = rWallNose.Center[0] - rWallNose.Radius * sin(rWallNose.RakeAngle);
1795 rRakePoint[1] = rWallNose.Center[1] + rWallNose.Radius * cos(rWallNose.RakeAngle);
1806 void GetClearancePoint(
const BoxNoseVariables& rWallNose,
PointType& rClearancePoint)
1810 rClearancePoint[0] = rWallNose.Center[0] - rWallNose.Radius * sin(rWallNose.ClearanceAngle);
1811 rClearancePoint[1] = rWallNose.Center[1] + rWallNose.Radius * cos(rWallNose.ClearanceAngle);
1812 rClearancePoint[2] = 0;
1820 void GetTipPoint(
const BoxNoseVariables& rWallNose,
PointType& rTipPoint)
1827 this->GetNosePoints(rWallNose, RakePoint, ClearancePoint, rTipPoint);
1841 double pi = 3.141592654;
1845 this->GetRakePoint(rWallNose,rRakePoint);
1847 this->GetClearancePoint(rWallNose,rClearancePoint);
1849 rTipPoint = ( rRakePoint - rWallNose.Center ) + ( rClearancePoint - rWallNose.Center );
1851 rTipPoint *= ( rWallNose.Radius/
norm_2(rTipPoint) );
1854 double OpenAngle = ( rWallNose.ClearanceAngle - rWallNose.RakeAngle ) * ( 180.0 /
pi ) - 90;
1856 if( OpenAngle < 90 )
1857 rTipPoint = rWallNose.Center + rTipPoint;
1859 rTipPoint = rWallNose.Center - rTipPoint;
1870 void GetRakeNormal(
const BoxNoseVariables& rWallNose,
PointType& rNormal)
1874 rNormal[0] = -sin(rWallNose.RakeAngle);
1875 rNormal[1] = cos(rWallNose.RakeAngle);
1878 rNormal *= rWallNose.Convexity;
1887 void GetClearanceNormal(
const BoxNoseVariables& rWallNose,
PointType& rNormal)
1891 rNormal[0] = -sin(rWallNose.ClearanceAngle);
1892 rNormal[1] = cos(rWallNose.ClearanceAngle);
1895 rNormal *= rWallNose.Convexity;
1908 rTangent = (rTipPoint-rPoint);
1909 rTangent -=
inner_prod((rTipPoint-rPoint),rNormal) * rNormal;
1912 rTangent *= (-1.0/
norm_2(rTangent));
1922 bool CalculateRakeSurface(
const PointType& rPoint,
double& rGapNormal,
PointType& rNormal,
const BoxNoseVariables& rWallNose)
1929 this->GetRakeNormal(rWallNose,rNormal);
1934 this->GetRakePoint(rWallNose,RakePoint);
1937 rGapNormal =
inner_prod((rPoint - RakePoint), rNormal);
1951 bool CalculateTipSurface(
const PointType& rPoint,
double& rGapNormal,
PointType& rNormal,
const BoxNoseVariables& rWallNose)
1959 Projection[0] = (rPoint[0]-rWallNose.Center[0]);
1960 Projection[1] = (rPoint[1]-rWallNose.Center[1]);
1963 Projection /=
norm_2(Projection);
1965 Projection[0] = rWallNose.Radius * Projection[0] + rWallNose.Center[0];
1966 Projection[1] = rWallNose.Radius * Projection[1] + rWallNose.Center[1];
1970 rNormal[0] = (Projection[0]-rWallNose.Center[0])/rWallNose.Radius;
1971 rNormal[1] = (Projection[1]-rWallNose.Center[1])/rWallNose.Radius;
1974 rNormal *= rWallNose.Convexity;
1978 Distance[0] = rWallNose.Center[0]-rPoint[0];
1979 Distance[1] = rWallNose.Center[1]-rPoint[1];
1982 if(
norm_2(Distance) <= rWallNose.Radius ){
1983 rGapNormal = (-1) *
norm_2(rPoint - Projection);
1986 rGapNormal =
norm_2(Projection - rPoint);
1989 rGapNormal *= rWallNose.Convexity;
2005 bool CalculateClearanceSurface(
const PointType& rPoint,
double& rGapNormal,
PointType& rNormal,
const BoxNoseVariables& rWallNose)
2012 this->GetClearanceNormal(rWallNose,rNormal);
2017 this->GetClearancePoint(rWallNose,ClearancePoint);
2020 rGapNormal =
inner_prod((rPoint - ClearancePoint), rNormal);
Definition: beam_math_utilities.hpp:31
static TVector3 & MapToCurrentLocalFrame(QuaternionType &rQuaternion, TVector3 &rVector)
Definition: beam_math_utilities.hpp:57
static TVector3 & MapToReferenceLocalFrame(QuaternionType &rQuaternion, TVector3 &rVector)
Definition: beam_math_utilities.hpp:88
Short class definition.
Definition: compound_noses_bounding_box.hpp:61
void CreateQuadrilateralBoundaryMesh(ModelPart &rModelPart, const unsigned int &rFirstInitialNodeId, const unsigned int &rSecondInitialNodeId)
Definition: compound_noses_bounding_box.hpp:942
ModelPart::ElementType ElementType
Definition: compound_noses_bounding_box.hpp:71
array_1d< double, 3 > PointType
Definition: compound_noses_bounding_box.hpp:65
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: compound_noses_bounding_box.hpp:821
void CreateBoundingBoxBoundaryMesh(ModelPart &rModelPart, int linear_partitions=4, int angular_partitions=4) override
Definition: compound_noses_bounding_box.hpp:543
CompoundNosesBoundingBox & operator=(CompoundNosesBoundingBox const &rOther)
Assignment operator.
Definition: compound_noses_bounding_box.hpp:296
void UpdateBoxPosition(const double &rCurrentTime) override
Definition: compound_noses_bounding_box.hpp:365
std::vector< BoxNoseVariables > mBoxNoses
Definition: compound_noses_bounding_box.hpp:842
CompoundNosesBoundingBox(CompoundNosesBoundingBox const &rOther)
Copy constructor.
Definition: compound_noses_bounding_box.hpp:307
std::string Info() const override
Turn back information as a string.
Definition: compound_noses_bounding_box.hpp:809
bool IsInside(BoundingBoxParameters &rValues, const ProcessInfo &rCurrentProcessInfo) override
Definition: compound_noses_bounding_box.hpp:467
virtual ~CompoundNosesBoundingBox()
Destructor.
Definition: compound_noses_bounding_box.hpp:317
NodesContainerType::Pointer NodesContainerTypePointer
Definition: compound_noses_bounding_box.hpp:68
KRATOS_CLASS_POINTER_DEFINITION(CompoundNosesBoundingBox)
Pointer definition of CompoundNosesBoundingBox.
CompoundNosesBoundingBox()
Default constructor.
Definition: compound_noses_bounding_box.hpp:137
ModelPart::NodesContainerType NodesContainerType
Definition: compound_noses_bounding_box.hpp:67
ModelPart::NodeType NodeType
Definition: compound_noses_bounding_box.hpp:66
double GetRadius(const PointType &rPoint) override
Definition: compound_noses_bounding_box.hpp:332
BeamMathUtils< double > BeamMathUtilsType
Definition: compound_noses_bounding_box.hpp:69
Quaternion< double > QuaternionType
Definition: compound_noses_bounding_box.hpp:70
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: compound_noses_bounding_box.hpp:815
CompoundNosesBoundingBox(Parameters CustomParameters)
Definition: compound_noses_bounding_box.hpp:149
ElementType::GeometryType GeometryType
Definition: compound_noses_bounding_box.hpp:72
bool IsInside(const PointType &rPoint, double &rCurrentTime, double Radius=0) override
Definition: compound_noses_bounding_box.hpp:387
PointType GetCenter(const PointType &rPoint) override
Definition: compound_noses_bounding_box.hpp:346
CompoundNosesBoundingBox(Vector Radius, Vector RakeAngles, Vector ClearanceAngles, Matrix Centers, Vector Convexities, Vector Velocity, Vector AngularVelocity, Vector UpperPoint, Vector LowerPoint, Matrix InitialLocalMatrix)
Definition: compound_noses_bounding_box.hpp:271
void CreateLinearBoundaryMesh(ModelPart &rModelPart, const unsigned int &rInitialNodeId)
Definition: compound_noses_bounding_box.hpp:856
Base class for all Elements.
Definition: element.h:60
Geometry base class.
Definition: geometry.h:71
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
SizeType WorkingSpaceDimension() const
Definition: mesh.h:237
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
SubModelPartIterator SubModelPartsEnd()
Definition: model_part.h:1708
SubModelPartIterator SubModelPartsBegin()
Definition: model_part.h:1698
void AddNode(NodeType::Pointer pNewNode, IndexType ThisIndex=0)
Definition: model_part.cpp:211
SizeType NumberOfProperties(IndexType ThisIndex=0) const
Returns the number of properties of the mesh.
Definition: model_part.cpp:575
bool IsSubModelPart() const
Definition: model_part.h:1893
SubModelPartsContainerType::iterator SubModelPartIterator
Iterator over the sub model parts of this model part.
Definition: model_part.h:258
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodeType::Pointer pGetNode(IndexType NodeId, IndexType ThisIndex=0)
Definition: model_part.h:421
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
void AddElement(ElementType::Pointer pNewElement, IndexType ThisIndex=0)
Definition: model_part.cpp:917
ModelPart & GetParentModelPart()
Definition: model_part.cpp:2124
MeshType & GetMesh(IndexType ThisIndex=0)
Definition: model_part.h:1791
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
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
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
SizeType size() const
This method returns the total size of the current array parameter.
Definition: kratos_parameters.cpp:993
Point class.
Definition: point.h:59
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
void reserve(size_type dim)
Definition: pointer_vector.h:319
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
static Quaternion FromRotationMatrix(const TMatrix3x3 &m)
Definition: quaternion.h:475
void ToRotationMatrix(TMatrix3x3 &R) const
Definition: quaternion.h:213
void RotateVector3(const TVector3_A &a, TVector3_B &b) const
Definition: quaternion.h:325
static Quaternion FromRotationVector(double rx, double ry, double rz)
Definition: quaternion.h:427
Short class definition.
Definition: spatial_bounding_box.hpp:48
bool mRigidBodyCenterSupplied
Definition: spatial_bounding_box.hpp:1150
PointType GetBoxDisplacement(const double &rCurrentTime)
Definition: spatial_bounding_box.hpp:1181
void CalculateOrthonormalBase(PointType &rDirectionVectorX, PointType &rDirectionVectorY, PointType &rDirectionVectorZ)
Definition: spatial_bounding_box.hpp:1408
void ComputeContactTangent(BoundingBoxParameters &rValues, const ProcessInfo &rCurrentProcessInfo)
Definition: spatial_bounding_box.hpp:1274
NodeType::Pointer CreateNode(ModelPart &rModelPart, PointType &rPoint, const unsigned int &rNodeId)
Definition: spatial_bounding_box.hpp:1357
static unsigned int GetMaxNodeId(ModelPart &rModelPart)
Definition: spatial_bounding_box.hpp:1314
static unsigned int GetMaxElementId(ModelPart &rModelPart)
Definition: spatial_bounding_box.hpp:1334
BoundingBoxVariables mBox
Definition: spatial_bounding_box.hpp:1152
void MapToLocalFrame(QuaternionType &rQuaternion, BoundingBoxVariables &rBox)
Definition: spatial_bounding_box.hpp:1166
virtual SpatialBoundingBox & operator=(SpatialBoundingBox const &rOther)
Assignment operator.
Definition: spatial_bounding_box.hpp:540
virtual bool IsInside(const PointType &rPoint, double &rCurrentTime, double Radius=0)
Definition: spatial_bounding_box.hpp:604
BOOST_UBLAS_INLINE void clear()
Definition: array_1d.h:325
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static int sign(const double a)
Definition: GeometryFunctions.h:61
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
AMatrix::IdentityMatrix< double > IdentityMatrix
Definition: amatrix_interface.h:564
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
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
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
int tol
Definition: hinsberg_optimization.py:138
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int counter
Definition: script_THERMAL_CORRECT.py:218
integer i
Definition: TensorModule.f:17
double precision, public pi
Definition: TensorModule.f:16
e
Definition: run_cpp_mpi_tests.py:31
Definition: compound_noses_bounding_box.hpp:81
double TangentClearanceAngle
Definition: compound_noses_bounding_box.hpp:89
double TangentRakeAngle
Definition: compound_noses_bounding_box.hpp:88
PointType Center
Definition: compound_noses_bounding_box.hpp:92
void UpdatePosition(PointType &Displacement)
Definition: compound_noses_bounding_box.hpp:116
PointType InitialCenter
Definition: compound_noses_bounding_box.hpp:91
double ClearanceAngle
Definition: compound_noses_bounding_box.hpp:86
int Convexity
Definition: compound_noses_bounding_box.hpp:82
double Radius
Definition: compound_noses_bounding_box.hpp:84
void SetInitialValues()
Definition: compound_noses_bounding_box.hpp:111
double RakeAngle
Definition: compound_noses_bounding_box.hpp:85
void Initialize()
Definition: compound_noses_bounding_box.hpp:97
Definition: spatial_bounding_box.hpp:61
void SetContactFace(int ContactFace)
Definition: spatial_bounding_box.hpp:178
double & GetGapNormal()
Definition: spatial_bounding_box.hpp:193
const PointType & GetPoint()
Definition: spatial_bounding_box.hpp:181
PointType & GetNormal()
Definition: spatial_bounding_box.hpp:188
PointType AngularVelocity
Definition: spatial_bounding_box.hpp:222
QuaternionType InitialLocalQuaternion
Definition: spatial_bounding_box.hpp:224
void UpdatePosition(PointType &Displacement)
Definition: spatial_bounding_box.hpp:260
PointType Velocity
Definition: spatial_bounding_box.hpp:221
PointType LowerPoint
Definition: spatial_bounding_box.hpp:218
double Radius
Definition: spatial_bounding_box.hpp:211
void Initialize()
Definition: spatial_bounding_box.hpp:229
PointType Center
Definition: spatial_bounding_box.hpp:219
PointType UpperPoint
Definition: spatial_bounding_box.hpp:217
void SetInitialValues()
Definition: spatial_bounding_box.hpp:253
void Print()
Definition: spatial_bounding_box.hpp:267
QuaternionType LocalQuaternion
Definition: spatial_bounding_box.hpp:225
Configure::PointType PointType
Definition: transfer_utility.h:245