Inheritance: ILinearElasticMaterial
示例#1
0
        public void FourTriangleAFrame()
        {
            var model = new FiniteElementModel(ModelType.Membrane3D);
            FiniteElementNode node1 = model.NodeFactory.Create(0.0, 0.0, 0.0);
            model.ConstrainNode(node1, DegreeOfFreedom.X);
            model.ConstrainNode(node1, DegreeOfFreedom.Y);
            model.ConstrainNode(node1, DegreeOfFreedom.Z);

            FiniteElementNode node2 = model.NodeFactory.Create(1.0, 0.0, 0.0);
            model.ConstrainNode(node2, DegreeOfFreedom.X);
            model.ConstrainNode(node2, DegreeOfFreedom.Y);
            model.ConstrainNode(node2, DegreeOfFreedom.Z);

            FiniteElementNode node3 = model.NodeFactory.Create(0.0, 1.0, 0.5);

            FiniteElementNode node4 = model.NodeFactory.Create(1.0, 1.0, 0.5);

            FiniteElementNode node5 = model.NodeFactory.Create(0.0, 2.0, 0.0);
            model.ConstrainNode(node5, DegreeOfFreedom.X);
            model.ConstrainNode(node5, DegreeOfFreedom.Y);
            model.ConstrainNode(node5, DegreeOfFreedom.Z);

            FiniteElementNode node6 = model.NodeFactory.Create(1.0, 2.0, 0.0);
            model.ConstrainNode(node6, DegreeOfFreedom.X);
            model.ConstrainNode(node6, DegreeOfFreedom.Y);
            model.ConstrainNode(node6, DegreeOfFreedom.Z);

            IMaterial material = new GenericElasticMaterial(0, 200000, 0.2, 84000);

            model.ElementFactory.CreateLinearConstantStrainTriangle(node1, node2, node3, material, 0.1);
            model.ElementFactory.CreateLinearConstantStrainTriangle(node2, node4, node3, material, 0.1);
            model.ElementFactory.CreateLinearConstantStrainTriangle(node3, node4, node5, material, 0.1);
            model.ElementFactory.CreateLinearConstantStrainTriangle(node4, node6, node5, material, 0.1);

            ForceVector force = model.ForceFactory.Create(0, 0, -10, 0, 0, 0);
            model.ApplyForceToNode(force, node3);
            model.ApplyForceToNode(force, node4);

            IFiniteElementSolver solver = new LinearSolverSVD(model);
            FiniteElementResults results = solver.Solve();

            ReactionVector reaction1 = results.GetReaction(node1); //get the reaction at the first node
            Console.WriteLine("\nReaction1 : \n" + reaction1);
            ReactionVector reaction2 = results.GetReaction(node2);
            Console.WriteLine("\nReaction2 : \n" + reaction2);
            Assert.AreEqual(20, reaction1.Y + reaction2.Y, 0.001);

            DisplacementVector displacement3 = results.GetDisplacement(node3);  // get the displacement at the second node
            Console.WriteLine("\nDisplacement3 : \n" + displacement3);
            Assert.AreNotEqual(0.0, displacement3.X); // TODO calculate the actual value, rather than just checking we have any value
            Assert.AreNotEqual(0.0, displacement3.Y); // TODO calculate the actual value, rather than just checking we have any value
            Assert.AreNotEqual(0.0, displacement3.Z); // TODO calculate the actual value, rather than just checking we have any value

            DisplacementVector displacement4 = results.GetDisplacement(node4);  // get the displacement at the second node
            Console.WriteLine("\nDisplacement4 : \n" + displacement4);
            Assert.AreNotEqual(0.0, displacement4.X); // TODO calculate the actual value, rather than just checking we have any value
            Assert.AreNotEqual(0.0, displacement4.Y); // TODO calculate the actual value, rather than just checking we have any value
            Assert.AreNotEqual(0.0, displacement4.Z); // TODO calculate the actual value, rather than just checking we have any value
        }
示例#2
0
        public void Can_calculate_stiffnessEA()
        {
            material = new GenericElasticMaterial(0, 210000000000, 0.3, 80769200000);
            section = new SolidRectangle(0.1, 0.1);
            SUT = elementFactory.CreateLinear1DBeam(start, end, material, section);

            Assert.AreEqual(2100000000, SUT.StiffnessEA, 1);
        }
示例#3
0
        public void Can_calculate_ShearStiffnessGAz()
        {
            material = new GenericElasticMaterial(0, 210000000000, 0.3, 80769200000);
            section = new SolidRectangle(0.1, 0.1);
            SUT = elementFactory.CreateLinear1DBeam(start, end, material, section);

            Assert.Inconclusive("Have not yet properly calculated as to what is expected");
            Assert.AreEqual(675508000, SUT.ShearStiffnessGAz, 1);
        }
 public void SetUp()
 {
     nodeFactory = new NodeFactory(ModelType.Truss1D);
     start = nodeFactory.Create(0);
     end = nodeFactory.Create(1);
     elementFactory = new ElementFactory(ModelType.Truss1D);
     material = new GenericElasticMaterial(0, 0.1, 0, 0);
     section = new SolidRectangle(0.1, 1);
     SUT = elementFactory.CreateLinearTruss(start, end, material, section);
 }
示例#5
0
 public void SetUp()
 {
     ModelType modelType = ModelType.Beam1D;
     nodeFactory = new NodeFactory(modelType);
     start = nodeFactory.Create(0);
     end = nodeFactory.Create(1);
     elementFactory = new ElementFactory(modelType);
     material = new GenericElasticMaterial(0, 0.1, 0, 0);
     section = new SolidRectangle(0.1, 1);
     SUT = elementFactory.CreateLinear3DBeam(start, end, material, section);
 }
        public void HashCode_changes_with_Material_and_CrossSection()
        {
            int SUTOriginalHash = SUT.GetHashCode();

            LinearTruss equal = elementFactory.CreateLinearTruss(start, end, material, section);
            Assert.AreEqual(SUTOriginalHash, equal.GetHashCode());

            GenericElasticMaterial material2 = new GenericElasticMaterial(0, 2, 0, 0);
            LinearTruss unequalMaterial = elementFactory.CreateLinearTruss(start, end, material2, section);
            Assert.AreNotEqual(SUTOriginalHash, unequalMaterial.GetHashCode());

            SolidRectangle section2 = new SolidRectangle(2, 1);
            LinearTruss unequalCrossSection = elementFactory.CreateLinearTruss(start, end, material, section2);
            Assert.AreNotEqual(SUTOriginalHash, unequalCrossSection.GetHashCode());
        }
        public void Equality_depends_on_material_and_CrossSection()
        {
            Assert.IsTrue(SUT.Equals(SUT));

            LinearTruss equal = elementFactory.CreateLinearTruss(start, end, material, section);
            Assert.IsTrue(SUT.Equals(equal));

            GenericElasticMaterial material2 = new GenericElasticMaterial(0, 2, 0, 0);
            LinearTruss unequalMaterial = elementFactory.CreateLinearTruss(start, end, material2, section);
            Assert.IsFalse(SUT.Equals(unequalMaterial));

            SolidRectangle section2 = new SolidRectangle(2, 1);
            LinearTruss unequalCrossSection = elementFactory.CreateLinearTruss(start, end, material, section2);
            Assert.IsFalse(SUT.Equals(unequalCrossSection));
        }
示例#8
0
        public void CalculateModelOfThreeBarsWithFourDegreesOfFreedom()
        {
            FiniteElementModel model = new FiniteElementModel(ModelType.Truss1D);
            FiniteElementNode node1 = model.NodeFactory.Create(0);
            model.ConstrainNode(node1, DegreeOfFreedom.X);

            FiniteElementNode node2 = model.NodeFactory.Create(30.0);

            FiniteElementNode node3 = model.NodeFactory.Create(60.0);

            FiniteElementNode node4 = model.NodeFactory.Create(90.0);
            model.ConstrainNode(node4, DegreeOfFreedom.X);

            IMaterial material = new GenericElasticMaterial(0, 30000000, 0, 0);
            ICrossSection section = new SolidRectangle(1, 1);

            model.ElementFactory.CreateLinearTruss(node1, node2, material, section);
            model.ElementFactory.CreateLinearTruss(node2, node3, material, section);
            model.ElementFactory.CreateLinearTruss(node3, node4, material, section);

            ForceVector externalForce = model.ForceFactory.Create(3000);
            model.ApplyForceToNode(externalForce, node2);

            IFiniteElementSolver solver = new MatrixInversionLinearSolver(model);
            FiniteElementResults results = solver.Solve();

            DisplacementVector displacementAtNode2 = results.GetDisplacement(node2);
            Assert.AreEqual(0.002, displacementAtNode2.X, 0.001);

            DisplacementVector displacementAtNode3 = results.GetDisplacement(node3);
            Assert.AreEqual(0.001, displacementAtNode3.X, 0.001);

            ReactionVector reactionAtNode1 = results.GetReaction(node1);
            Assert.AreEqual(-2000, reactionAtNode1.X, 0.001);

            ReactionVector reactionAtNode4 = results.GetReaction(node4);
            Assert.AreEqual(-1000, reactionAtNode4.X, 0.001);
        }
示例#9
0
        public void Calculate2DTrussOf11BarsAnd12Dof()
        {
            FiniteElementModel model = new FiniteElementModel(ModelType.Truss2D);

            //build geometric model and constraints

            FiniteElementNode node1 = model.NodeFactory.CreateFor2DTruss(0, 0);
            model.ConstrainNode(node1, DegreeOfFreedom.X);
            model.ConstrainNode(node1, DegreeOfFreedom.Z);

            FiniteElementNode node2 = model.NodeFactory.CreateFor2DTruss(0, 3);

            FiniteElementNode node3 = model.NodeFactory.CreateFor2DTruss(3, 0);

            FiniteElementNode node4 = model.NodeFactory.CreateFor2DTruss(3, 3);

            FiniteElementNode node5 = model.NodeFactory.CreateFor2DTruss(6, 0);
            model.ConstrainNode(node5, DegreeOfFreedom.Z);

            FiniteElementNode node6 = model.NodeFactory.CreateFor2DTruss(6, 3);

            IMaterial material = new GenericElasticMaterial(0, 70000000, 0, 0);
            ICrossSection section = new SolidRectangle(0.03, 0.01);

            LinearTruss truss1 = model.ElementFactory.CreateLinearTruss(node1, node2, material, section);
            LinearTruss truss2 = model.ElementFactory.CreateLinearTruss(node1, node3, material, section);
            LinearTruss truss3 = model.ElementFactory.CreateLinearTruss(node2, node3, material, section);
            LinearTruss truss4 = model.ElementFactory.CreateLinearTruss(node2, node4, material, section);
            LinearTruss truss5 = model.ElementFactory.CreateLinearTruss(node1, node4, material, section);
            LinearTruss truss6 = model.ElementFactory.CreateLinearTruss(node3, node4, material, section);
            LinearTruss truss7 = model.ElementFactory.CreateLinearTruss(node3, node6, material, section);
            LinearTruss truss8 = model.ElementFactory.CreateLinearTruss(node4, node5, material, section);
            LinearTruss truss9 = model.ElementFactory.CreateLinearTruss(node4, node6, material, section);
            LinearTruss truss10 = model.ElementFactory.CreateLinearTruss(node3, node5, material, section);
            LinearTruss truss11 = model.ElementFactory.CreateLinearTruss(node5, node6, material, section);

            //apply forces

            ForceVector force50Z = model.ForceFactory.CreateForTruss(0, -50000);
            model.ApplyForceToNode(force50Z, node2);
            model.ApplyForceToNode(force50Z, node6);

            ForceVector force100Z = model.ForceFactory.CreateForTruss(0, -100000);
            model.ApplyForceToNode(force100Z, node4);

            //solve model
            IFiniteElementSolver solver = new MatrixInversionLinearSolver(model);
            FiniteElementResults results = solver.Solve();

            //assert results

            ReactionVector reactionAtNode1 = results.GetReaction(node1);
            Assert.AreEqual(0, reactionAtNode1.X, 1);
            Assert.AreEqual(100000, reactionAtNode1.Z, 1);

            ReactionVector reactionAtNode5 = results.GetReaction(node1);
            Assert.AreEqual(0, reactionAtNode5.X, 1);
            Assert.AreEqual(100000, reactionAtNode5.Z, 1);

            DisplacementVector displacementAtNode2 = results.GetDisplacement(node2);
            Assert.AreEqual(7.1429, displacementAtNode2.X, 0.001);
            Assert.AreEqual(-9.0386, displacementAtNode2.Z, 0.001);

            DisplacementVector displacementAtNode3 = results.GetDisplacement(node3);
            Assert.AreEqual(5.2471, displacementAtNode3.X, 0.001);
            Assert.AreEqual(-16.2965, displacementAtNode3.Z, 0.001);

            DisplacementVector displacementAtNode4 = results.GetDisplacement(node4);
            Assert.AreEqual(5.2471, displacementAtNode4.X, 0.001);
            Assert.AreEqual(-20.0881, displacementAtNode4.Z, 0.001);

            DisplacementVector displacementAtNode5 = results.GetDisplacement(node5);
            Assert.AreEqual(10.4942, displacementAtNode5.X, 0.001);
            Assert.AreEqual(0, displacementAtNode5.Z, 0.001);

            DisplacementVector displacementAtNode6 = results.GetDisplacement(node6);
            Assert.AreEqual(3.3513, displacementAtNode6.X, 0.001);
            Assert.AreEqual(-9.0386, displacementAtNode6.Z, 0.001);
        }
示例#10
0
        public void Calculate2DTrussOf3BarsAnd8Dof()
        {
            FiniteElementModel model = new FiniteElementModel(ModelType.Truss2D);

            FiniteElementNode node1 = model.NodeFactory.CreateFor2DTruss(0, 0);

            FiniteElementNode node2 = model.NodeFactory.CreateFor2DTruss(0, 10);
            model.ConstrainNode(node2, DegreeOfFreedom.X);
            model.ConstrainNode(node2, DegreeOfFreedom.Z);

            FiniteElementNode node3 = model.NodeFactory.CreateFor2DTruss(10, 10);
            model.ConstrainNode(node3, DegreeOfFreedom.X);
            model.ConstrainNode(node3, DegreeOfFreedom.Z);

            FiniteElementNode node4 = model.NodeFactory.CreateFor2DTruss(10, 0);
            model.ConstrainNode(node4, DegreeOfFreedom.X);
            model.ConstrainNode(node4, DegreeOfFreedom.Z);

            IMaterial material = new GenericElasticMaterial(0, 30000000, 0, 0);
            ICrossSection section = new SolidRectangle(2, 1);

            model.ElementFactory.CreateLinearTruss(node1, node2, material, section);
            model.ElementFactory.CreateLinearTruss(node1, node3, material, section);
            model.ElementFactory.CreateLinearTruss(node1, node4, material, section);

            ForceVector externalForce = model.ForceFactory.CreateForTruss(0, -10000);
            model.ApplyForceToNode(externalForce, node1);

            IFiniteElementSolver solver = new MatrixInversionLinearSolver(model);
            FiniteElementResults results = solver.Solve();

            ReactionVector reactionAtNode2 = results.GetReaction(node2);
            Assert.AreEqual(0, reactionAtNode2.X, 1);
            Assert.AreEqual(7929, reactionAtNode2.Z, 1);

            ReactionVector reactionAtNode3 = results.GetReaction(node3);
            Assert.AreEqual(2071, reactionAtNode3.X, 1);
            Assert.AreEqual(2071, reactionAtNode3.Z, 1);

            ReactionVector reactionAtNode4 = results.GetReaction(node4);
            Assert.AreEqual(-2071, reactionAtNode4.X, 1);
            Assert.AreEqual(0, reactionAtNode4.Z, 1);

            DisplacementVector displacementAtNode1 = results.GetDisplacement(node1);
            Assert.AreEqual( 0.00035, displacementAtNode1.X, 0.00001);  ///NOTE this does not match the example in the book, but was instead verified by commercial FE software.  It appears as it may be an errata in the book.
            Assert.AreEqual(-0.00132, displacementAtNode1.Z, 0.00001);  ///NOTE this does not match the example in the book, but was instead verified by commercial FE software.  It appears as it may be an errata in the book.
        }
        public override IMaterial ToSharpMaterial()
        {
            GenericElasticMaterial material = new GenericElasticMaterial(Rho,E,Nu,G);

            return material;
        }