public bool IsInside(CartesianPoint point)
            {
                // Shapes
                var rectHull    = new Rectangular2DBoundary(0.0, bottomWidth, 0.0, totalHeight);
                var leftVoid    = new Rectangular2DBoundary(0.0, voidRectWidth, flangeHeight, totalHeight);
                var rightVoid   = new Rectangular2DBoundary(bottomWidth - voidRectWidth, bottomWidth, flangeHeight, totalHeight);
                var leftCircle  = new Circle2D(new CartesianPoint(leftCenterX, centerY), radius);
                var rightCircle = new Circle2D(new CartesianPoint(rightCenterX, centerY), radius);

                if (rectHull.IsInside(point))
                {
                    if (leftVoid.IsInside(point)) // Over flange, left of web
                    {
                        if ((point.X > leftCenterX) && (point.Y < centerY))
                        {
                            if (leftCircle.FindRelativePositionOfPoint(point) == CirclePointPosition.Outside)
                            {
                                return(true); // Inside left fillet
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else if (rightVoid.IsInside(point)) // Over flange, right of web
                    {
                        if ((point.X < leftCenterX) && (point.Y < centerY))
                        {
                            if (leftCircle.FindRelativePositionOfPoint(point) == CirclePointPosition.Outside)
                            {
                                return(true); // Inside right fillet
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(true); // Inside the flange or the web
                    }
                }
                else
                {
                    return(false);
                }
            }
Example #2
0
 public DoubleCantileverBeam()
 {
     this.material    = HomogeneousElasticMaterial2D.CreateMaterialForPlaneStrain(E, v);
     this.integration = new IntegrationForCrackPropagation2D(
         new RectangularSubgridIntegration2D <XContinuumElement2D>(8, GaussLegendre2D.GetQuadratureWithOrder(2, 2)),
         new RectangularSubgridIntegration2D <XContinuumElement2D>(8, GaussLegendre2D.GetQuadratureWithOrder(2, 2)));
     this.jIntegration =
         new RectangularSubgridIntegration2D <XContinuumElement2D>(8, GaussLegendre2D.GetQuadratureWithOrder(4, 4));
     this.beamBoundary = new Rectangular2DBoundary(0, beamLength, 0, beamHeight);
 }
        private static XContinuumElement2D CreateCrackBodyElement()
        {
            XNode[] nodes = new XNode[]
            {
                new XNode(0, 20.0, 0.0),
                new XNode(1, 40.0, 0.0),
                new XNode(2, 40.0, 20.0),
                new XNode(3, 20.0, 20.0),

                new XNode(4, 20.0, -40.0),
                new XNode(5, 40.0, -40.0),
                new XNode(6, 40.0, -20.0),
                new XNode(7, 20.0, -20.0)
            };

            double E        = 2e6;
            double v        = 0.3;
            var    material = HomogeneousElasticMaterial2D.CreateMaterialForPlaneStrain(E, v);

            var integrationStrategy = new IntegrationForCrackPropagation2D(
                new RectangularSubgridIntegration2D <XContinuumElement2D>(2, GaussLegendre2D.GetQuadratureWithOrder(2, 2)),
                new SimpleIntegration2D());
            //var integrationStrategy = new IntegrationForCrackPropagation2D(GaussLegendre2D.GetQuadratureWithOrder(2, 2),
            //  new RectangularSubgridIntegration2D<XContinuumElement2D>(2, GaussLegendre2D.GetQuadratureWithOrder(2, 2)));
            var factory         = new XContinuumElement2DFactory(integrationStrategy, integrationStrategy, material);
            var bodyElement     = factory.CreateElement(0, CellType.Quad4, new XNode[] { nodes[0], nodes[1], nodes[2], nodes[3] });
            var blendingElement = factory.CreateElement(1, CellType.Quad4, new XNode[] { nodes[7], nodes[6], nodes[1], nodes[0] });
            var tipElement      = factory.CreateElement(2, CellType.Quad4, new XNode[] { nodes[4], nodes[5], nodes[6], nodes[7] });
            var boundary        = new Rectangular2DBoundary(20.0, 40.0, -40.0, 20.0);
            var mesh            = new SimpleMesh2D <XNode, XContinuumElement2D>(nodes,
                                                                                new XContinuumElement2D[] { bodyElement, blendingElement, tipElement }, boundary);

            var crack = new BasicExplicitCrack2D();

            crack.Mesh = mesh;
            crack.CrackBodyEnrichment = new CrackBodyEnrichment2D(crack);
            crack.CrackTipEnrichments = new CrackTipEnrichments2D(crack, CrackTipPosition.Single);

            var point1 = new CartesianPoint(30.0, 20.0);
            var point2 = new CartesianPoint(30.0, -30.0);

            crack.InitializeGeometry(point1, point2);
            crack.UpdateEnrichments();

            return(bodyElement);
        }
            public bool IsInside(CartesianPoint point)
            {
                // Shapes
                var rectHull    = new Rectangular2DBoundary(minX, maxX, minY, maxY);
                var leftCircle  = new Circle2D(new CartesianPoint(leftHoleX, leftHoleY), holeRadius);
                var rightCircle = new Circle2D(new CartesianPoint(rightHoleX, rightHoleY), holeRadius);

                // Intrnal points lie inside the rectangle, but outside the circular holes.
                if (rectHull.IsInside(point))
                {
                    if (leftCircle.FindRelativePositionOfPoint(point) == CirclePointPosition.Outside)
                    {
                        return(true);
                    }
                    if (rightCircle.FindRelativePositionOfPoint(point) == CirclePointPosition.Outside)
                    {
                        return(true);
                    }
                }
                return(false);
            }