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);
        }
示例#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);
        }
        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);
        }