public void ThreeNodeSimplySupportedBeam() //TODO verify results using independent check { FiniteElementModel model = new FiniteElementModel(ModelType.Frame2D); FiniteElementNode node1 = model.NodeFactory.CreateFor2DTruss(0, 0); model.ConstrainNode(node1, DegreeOfFreedom.X); model.ConstrainNode(node1, DegreeOfFreedom.Z); FiniteElementNode node2 = model.NodeFactory.CreateFor2DTruss(1, 0); FiniteElementNode node3 = model.NodeFactory.CreateFor2DTruss(2, 0); model.ConstrainNode(node3, DegreeOfFreedom.Z); IMaterial material = new GenericElasticMaterial(0, 10000000000, 0, 0); ICrossSection section = new GenericCrossSection(0.0001, 0.0002); model.ElementFactory.CreateLinear1DBeam(node1, node2, material, section); model.ElementFactory.CreateLinear1DBeam(node2, node3, material, section); ForceVector force = model.ForceFactory.Create(0, 0, -10000, 0, 0, 0); model.ApplyForceToNode(force, node2); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); Stiffness.GlobalModelStiffnessMatrixBuilder gmsmb = new SharpFE.Stiffness.GlobalModelStiffnessMatrixBuilder(model); Console.WriteLine(gmsmb.BuildKnownForcesUnknownDisplacementStiffnessMatrix()); FiniteElementResults results = solver.Solve(); DisplacementVector node1Displacement = results.GetDisplacement(node1); Console.WriteLine("node1Displacement : " + node1Displacement); DisplacementVector node2Displacement = results.GetDisplacement(node2); Console.WriteLine("node2Displacement : " + node2Displacement); DisplacementVector node3Displacement = results.GetDisplacement(node3); Console.WriteLine("node3Displacement : " + node3Displacement); ReactionVector node1Reaction = results.GetReaction(node1); Console.WriteLine("node1Reaction : " + node1Reaction); ReactionVector node3Reaction = results.GetReaction(node3); Console.WriteLine("node5Reaction : " + node3Reaction); Assert.AreEqual(-0.000833333, node2Displacement.Z, 0.0000001); Assert.AreEqual(5000, node1Reaction.Z, 0.001); Assert.AreEqual(5000, node3Reaction.Z, 0.001); Assert.AreEqual(0, node2Displacement.YY, 0.0001); Assert.AreEqual(0.00125, node1Displacement.YY, 0.0000001); Assert.AreEqual(-0.00125, node3Displacement.YY, 0.0000001); }
public void ThreeNodeSimplySupportedBeam() { FiniteElementModel model = new FiniteElementModel(ModelType.Full3D); FiniteElementNode node1 = model.NodeFactory.Create(0, 0, 0); model.ConstrainNode(node1, DegreeOfFreedom.X); model.ConstrainNode(node1, DegreeOfFreedom.Y); model.ConstrainNode(node1, DegreeOfFreedom.Z); model.ConstrainNode(node1, DegreeOfFreedom.XX); FiniteElementNode node2 = model.NodeFactory.Create(1, 0, 0); FiniteElementNode node3 = model.NodeFactory.Create(2, 0, 0); model.ConstrainNode(node3, DegreeOfFreedom.X); model.ConstrainNode(node3, DegreeOfFreedom.Y); model.ConstrainNode(node3, DegreeOfFreedom.Z); model.ConstrainNode(node3, DegreeOfFreedom.XX); IMaterial material = new GenericElasticMaterial(0, 10000000000, 0, 84000000000); ICrossSection section = new GenericCrossSection(0.0001, 0.0002, 0.0002, 0.00005); model.ElementFactory.CreateLinear3DBeam(node1, node2, material, section); model.ElementFactory.CreateLinear3DBeam(node2,node3,material,section); ForceVector force = model.ForceFactory.Create(0, 0, -10000, 0, 0, 0); model.ApplyForceToNode(force, node2); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); Stiffness.GlobalModelStiffnessMatrixBuilder gmsmb = new SharpFE.Stiffness.GlobalModelStiffnessMatrixBuilder(model); Console.WriteLine(gmsmb.BuildKnownForcesUnknownDisplacementStiffnessMatrix()); FiniteElementResults results = solver.Solve(); DisplacementVector node1Displacement = results.GetDisplacement(node1); Console.WriteLine("node1Displacement : " + node1Displacement); DisplacementVector node2Displacement = results.GetDisplacement(node2); Console.WriteLine("node2Displacement : " + node2Displacement); DisplacementVector node3Displacement = results.GetDisplacement(node3); Console.WriteLine("node3Displacement : " + node3Displacement); ReactionVector node1Reaction = results.GetReaction(node1); Console.WriteLine("node1Reaction : " + node1Reaction); ReactionVector node3Reaction = results.GetReaction(node3); Console.WriteLine("node5Reaction : " + node3Reaction); Assert.AreEqual(-0.000833333, node2Displacement.Z, 0.0000001); Assert.AreEqual(5000, node1Reaction.Z, 0.001); Assert.AreEqual(5000, node3Reaction.Z, 0.001); Assert.AreEqual(0, node2Displacement.YY, 0.0001); Assert.AreEqual( 0.00125, node1Displacement.YY, 0.0000001); Assert.AreEqual(-0.00125, node3Displacement.YY, 0.0000001); }
public void ThreeNodeBeam() { FiniteElementModel model = new FiniteElementModel(ModelType.Full3D); FiniteElementNode node1 = model.NodeFactory.Create(0, 0, 0); model.ConstrainNode(node1, DegreeOfFreedom.X); model.ConstrainNode(node1, DegreeOfFreedom.Y); model.ConstrainNode(node1, DegreeOfFreedom.Z); model.ConstrainNode(node1, DegreeOfFreedom.XX); FiniteElementNode node2 = model.NodeFactory.Create(1, 0, 0); model.ConstrainNode(node2, DegreeOfFreedom.Y); FiniteElementNode node3 = model.NodeFactory.Create(2, 0, 0); model.ConstrainNode(node3, DegreeOfFreedom.Y); model.ConstrainNode(node3, DegreeOfFreedom.Z); IMaterial material = new GenericElasticMaterial(0, 10000000000, 0.3, 1000000000); ICrossSection section = new SolidRectangle(1, 1); model.ElementFactory.CreateLinear3DBeam(node1, node2, material, section); model.ElementFactory.CreateLinear3DBeam(node2, node3, material, section); ForceVector force = model.ForceFactory.Create(0, 0, -10000, 0, 0, 0); model.ApplyForceToNode(force, node2); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); Stiffness.GlobalModelStiffnessMatrixBuilder gmsmb = new SharpFE.Stiffness.GlobalModelStiffnessMatrixBuilder(model); Console.WriteLine(gmsmb.BuildKnownForcesUnknownDisplacementStiffnessMatrix()); FiniteElementResults results = solver.Solve(); DisplacementVector node1Displacement = results.GetDisplacement(node1); Console.WriteLine("node1Displacement : \n" + node1Displacement); DisplacementVector node2Displacement = results.GetDisplacement(node2); Console.WriteLine("node2Displacement : \n" + node2Displacement); DisplacementVector node3Displacement = results.GetDisplacement(node3); Console.WriteLine("node3Displacement : \n" + node3Displacement); ReactionVector node1Reaction = results.GetReaction(node1); Console.WriteLine("node1Reaction : \n" + node1Reaction); ReactionVector node3Reaction = results.GetReaction(node3); Console.WriteLine("node5Reaction : \n" + node3Reaction); Assert.AreEqual(0, node2Displacement.XX, 0.00001); Assert.AreEqual(0, node2Displacement.Y, 0.00001); Assert.AreEqual(0, node2Displacement.ZZ, 0.0001); Assert.AreEqual(-0.000002, node2Displacement.Z, 0.0000001); Assert.AreEqual(5000, node1Reaction.Z, 0.00001); Assert.AreEqual(5000, node3Reaction.Z, 0.00001); Assert.AreEqual(0, node2Displacement.YY, 0.0001); Assert.AreEqual(0.000003, node1Displacement.YY, 0.0000001); Assert.AreEqual(-0.000003, node3Displacement.YY, 0.0000001); }