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);
        }
Exemplo n.º 2
0
        private static (XModel model, IMesh2D <XNode, XContinuumElement2D> mesh) CreateModel(string meshPath)
        {
            // Mesh generation
            var reader = new GmshReader <XNode>(meshPath);

            (IReadOnlyList <XNode> nodes, IReadOnlyList <CellConnectivity <XNode> > elementConnectivities) = reader.CreateMesh(
                (id, x, y, z) => new XNode(id, x, y, z));

            // Nodes
            var model = new XModel();

            foreach (XNode node in nodes)
            {
                model.Nodes.Add(node);
            }

            // Integration rules
            var integration = new IntegrationForCrackPropagation2D(
                new RectangularSubgridIntegration2D <XContinuumElement2D>(8, GaussLegendre2D.GetQuadratureWithOrder(2, 2)),
                new RectangularSubgridIntegration2D <XContinuumElement2D>(8, GaussLegendre2D.GetQuadratureWithOrder(2, 2)));
            var jIntegration =
                new RectangularSubgridIntegration2D <XContinuumElement2D>(8, GaussLegendre2D.GetQuadratureWithOrder(4, 4));

            // Elements
            var material = HomogeneousElasticMaterial2D.CreateMaterialForPlaneStrain(2.1E7, 0.3);
            var factory  = new XContinuumElement2DFactory(integration, jIntegration, material);
            var cells    = new XContinuumElement2D[elementConnectivities.Count];

            for (int e = 0; e < cells.Length; ++e)
            {
                XContinuumElement2D element = factory.CreateElement(e, CellType.Quad4, elementConnectivities[e].Vertices);
                cells[e] = element;
                model.Elements.Add(element);
            }

            // Mesh usable for crack-mesh interaction
            //var boundary = new FilletBoundary();
            IDomain2DBoundary boundary = null;

            model.Boundary = boundary;
            var mesh = new BidirectionalMesh2D <XNode, XContinuumElement2D>(model.Nodes, cells, boundary);

            return(model, mesh);
        }
Exemplo n.º 3
0
        private void CreateMesh()
        {
            Model.Subdomains.Add(subdomainID, new XSubdomain(subdomainID));

            // Mesh generation
            var reader = new GmshReader <XNode>(meshPath);

            (IReadOnlyList <XNode> nodes, IReadOnlyList <CellConnectivity <XNode> > elementConnectivities) = reader.CreateMesh(
                (id, x, y, z) => new XNode(id, x, y, z));

            // Nodes
            foreach (XNode node in nodes)
            {
                Model.Nodes.Add(node);
            }

            // Integration rules
            var integration = new IntegrationForCrackPropagation2D(
                new RectangularSubgridIntegration2D <XContinuumElement2D>(8, GaussLegendre2D.GetQuadratureWithOrder(2, 2)),
                new RectangularSubgridIntegration2D <XContinuumElement2D>(8, GaussLegendre2D.GetQuadratureWithOrder(2, 2)));
            var jIntegration =
                new RectangularSubgridIntegration2D <XContinuumElement2D>(8, GaussLegendre2D.GetQuadratureWithOrder(4, 4));

            // Elements
            var material = HomogeneousElasticMaterial2D.CreateMaterialForPlaneStrain(E, v);
            var factory  = new XContinuumElement2DFactory(integration, jIntegration, material);
            var cells    = new XContinuumElement2D[elementConnectivities.Count];

            for (int e = 0; e < cells.Length; ++e)
            {
                XContinuumElement2D element = factory.CreateElement(e, CellType.Quad4, elementConnectivities[e].Vertices);
                cells[e] = element;
                Model.Elements.Add(element);
                Model.Subdomains[subdomainID].Elements.Add(Model.Elements[e]);
            }

            // Mesh usable for crack-mesh interaction
            var boundary = new HolesBoundary();

            Model.Boundary = boundary;
            Mesh           = new BidirectionalMesh2D <XNode, XContinuumElement2D>(Model.Nodes, cells, boundary);
        }
        private static XContinuumElement2D CreateMaterialInterfaceElement()
        {
            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),
            };

            var                 point1         = new CartesianPoint(30.0, 0.0);
            var                 point2         = new CartesianPoint(30.0, 20.0);
            PolyLine2D          discontinuity  = new PolyLine2D(point1, point2);
            MaterialInterface2D enrichmentItem = new MaterialInterface2D(discontinuity);

            double E1       = 2E6;
            double E2       = 0.5 * E1;
            double v        = 0.3;
            var    material = BiElasticMaterial2D.CreateMaterialForPlainStrain(E1, v, E2, v, enrichmentItem);

            var integrationStrategy = new RectangularSubgridIntegration2D <XContinuumElement2D>(
                2, GaussLegendre2D.GetQuadratureWithOrder(2, 2));

            //var integrationStrategy = new IntegrationForCrackPropagation2D(GaussLegendre2D.Order2x2,
            //    new RectangularSubgridIntegration2D<XContinuumElement2D>(2, GaussLegendre2D.Order2x2));
            var factory = new XContinuumElement2DFactory(integrationStrategy, integrationStrategy, material);
            var element = factory.CreateElement(0, CellType.Quad4, nodes);

            //discontinuity.ElementIntersections.Add(element, new CartesianPoint2D[] { point1, point2 });

            //OBSOLETE: Elements access their enrichments from nodes now.
            //enrichmentItem.EnrichElement(element);
            enrichmentItem.EnrichNode(nodes[0]);
            enrichmentItem.EnrichNode(nodes[1]);
            enrichmentItem.EnrichNode(nodes[2]);
            enrichmentItem.EnrichNode(nodes[3]);

            return(element);
        }
Exemplo n.º 5
0
        public void Create3x1Model()
        {
            double elementSize = 20.0;
            var    model       = new XModel();

            model.Subdomains[subdomainID] = new XSubdomain(subdomainID);
            this.Model = model;

            //Nodes
            model.Nodes.Add(new XNode(0, 0.0, 0.0));
            model.Nodes.Add(new XNode(1, elementSize, 0.0));
            model.Nodes.Add(new XNode(2, elementSize, elementSize));
            model.Nodes.Add(new XNode(3, 0.0, elementSize));
            model.Nodes.Add(new XNode(4, 2 * elementSize, 0.0));
            model.Nodes.Add(new XNode(5, 3 * elementSize, 0.0));
            model.Nodes.Add(new XNode(6, 3 * elementSize, elementSize));
            model.Nodes.Add(new XNode(7, 2 * elementSize, elementSize));

            // Elements
            XNode[][] connectivity = new XNode[3][];
            connectivity[0] = new XNode[] { model.Nodes[0], model.Nodes[1], model.Nodes[2], model.Nodes[3] };
            connectivity[1] = new XNode[] { model.Nodes[1], model.Nodes[4], model.Nodes[7], model.Nodes[2] };
            connectivity[2] = new XNode[] { model.Nodes[4], model.Nodes[5], model.Nodes[6], model.Nodes[7] };

            var factory = new XContinuumElement2DFactory(integration, jIntegration, material);
            var cells   = new XContinuumElement2D[3];

            for (int e = 0; e < 3; ++e)
            {
                XContinuumElement2D element = factory.CreateElement(e, CellType.Quad4, connectivity[e]);
                cells[e] = element;
                model.Elements.Add(element);
                model.Subdomains[subdomainID].Elements.Add(model.Elements[e]);
            }

            // Mesh
            var mesh = new BidirectionalMesh2D <XNode, XContinuumElement2D>(model.Nodes,
                                                                            model.Elements.Select(e => (XContinuumElement2D)e).ToArray(), beamBoundary);

            // Boundary conditions
            model.Nodes[0].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationX, Amount = 0.0
            });
            model.Nodes[0].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = 0.0
            });
            model.Nodes[3].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationX, Amount = 0.0
            });
            model.Nodes[3].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = 0.0
            });
            model.Nodes[5].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = -0.05
            });
            model.Nodes[6].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = +0.05
            });

            // Create crack
            CreateCrack(elementSize, model, mesh, 2.0);
        }
Exemplo n.º 6
0
        public void CreateModel(int numElementsX, int numElementsY, double jIntegralRadiusRatio)
        {
            var model = new XModel();

            model.Subdomains[subdomainID] = new XSubdomain(subdomainID);
            this.Model = model;

            // Mesh generation
            var meshGenerator = new UniformMeshGenerator2D <XNode>(0.0, 0.0, beamLength, beamHeight, numElementsX, numElementsY);

            (IReadOnlyList <XNode> nodes, IReadOnlyList <CellConnectivity <XNode> > elementConnectivities) =
                meshGenerator.CreateMesh((id, x, y, z) => new XNode(id, x, y, z));

            // Nodes
            foreach (XNode node in nodes)
            {
                model.Nodes.Add(node);
            }

            // Elements
            var factory = new XContinuumElement2DFactory(integration, jIntegration, material);
            var cells   = new XContinuumElement2D[elementConnectivities.Count];

            for (int e = 0; e < elementConnectivities.Count; ++e)
            {
                XContinuumElement2D element = factory.CreateElement(e, CellType.Quad4, elementConnectivities[e].Vertices);
                cells[e] = element;
                model.Elements.Add(element);
                model.Subdomains[subdomainID].Elements.Add(model.Elements[e]);
            }

            // Mesh
            var mesh = new BidirectionalMesh2D <XNode, XContinuumElement2D>(model.Nodes,
                                                                            model.Elements.Select(e => (XContinuumElement2D)e).ToArray(), beamBoundary);

            // Boundary conditions
            double tol         = 1E-6;
            double L           = DoubleCantileverBeam.beamLength;
            double H           = DoubleCantileverBeam.beamHeight;
            XNode  topRight    = model.Nodes.Where(n => Math.Abs(n.X - L) <= tol && Math.Abs(n.Y - H) <= tol).First();
            XNode  bottomRight = model.Nodes.Where(n => Math.Abs(n.X - L) <= tol && Math.Abs(n.Y) <= tol).First();

            topRight.Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = +0.05
            });
            bottomRight.Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = -0.05
            });
            foreach (XNode node in model.Nodes.Where(n => Math.Abs(n.X) <= tol))
            {
                node.Constraints.Add(new Constraint()
                {
                    DOF = StructuralDof.TranslationX, Amount = 0.0
                });
                node.Constraints.Add(new Constraint()
                {
                    DOF = StructuralDof.TranslationY, Amount = 0.0
                });
            }

            // Create crack
            double elementSizeX = beamLength / numElementsX;
            double elementSizeY = beamHeight / numElementsY;

            CreateCrack(Math.Max(elementSizeX, elementSizeY), model, mesh, jIntegralRadiusRatio);
        }