public void SpringInXAxis() { FiniteElementModel model = new FiniteElementModel(ModelType.Truss2D); // we will create and analyze a 1D spring in the vertical FiniteElementNode node1 = model.NodeFactory.CreateFor2DTruss(0, 0); // create a node at the origin model.ConstrainNode(node1, DegreeOfFreedom.X); // constrain this node from moving in the X axis model.ConstrainNode(node1, DegreeOfFreedom.Z); // also constrain it from moving in the Y axis FiniteElementNode node2 = model.NodeFactory.CreateFor2DTruss(1, 0); // create a second node at a distance 1 metre along the X axis. model.ConstrainNode(node2, DegreeOfFreedom.Z); // fix this node from moving along the Y-axis. It is still free to move along the X-axis however. LinearConstantSpring spring = model.ElementFactory.CreateLinearConstantSpring(node1, node2, 1000); // create a spring between the two nodes of a stiffness of 1000 Newtons per metre ForceVector force = model.ForceFactory.CreateForTruss(10, 0); // Create a force of 10 Newtons along the x-axis. model.ApplyForceToNode(force, node2); // Apply that force to the second node IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); // Create a new instance of the solver class and pass it the model to solve FiniteElementResults results = solver.Solve(); // ask the solver to solve the model and return results DisplacementVector displacementAtNode2 = results.GetDisplacement(node2); // get the displacement at the second node Assert.AreEqual(0.01, displacementAtNode2.X); // check that we calculated 0.010 metres (10 millimetres) along the Y axis. ReactionVector reactionAtNode1 = results.GetReaction(node1); //get the reaction at the first node Assert.AreEqual(-10, reactionAtNode1.X); // Check that we have calculated a reaction of -10 Newtons in the X axis. Assert.AreEqual(0, reactionAtNode1.Z); // and a reaction of 0 Newtons in the Y axis. }
public void ReversedCantilever() { FiniteElementModel model = new FiniteElementModel(ModelType.Beam1D); FiniteElementNode node1 = model.NodeFactory.Create(0); model.ConstrainNode(node1, DegreeOfFreedom.Z); model.ConstrainNode(node1, DegreeOfFreedom.YY); FiniteElementNode node2 = model.NodeFactory.Create(3.0); IMaterial material = new GenericElasticMaterial(0, 210000000000, 0, 0); ICrossSection section = new GenericCrossSection(0.0001, 0.0002); model.ElementFactory.CreateLinear1DBeam(node2, node1, material, section); //connecting the nodes in reverse order to the Cantilever() example ForceVector force = model.ForceFactory.CreateFor1DBeam(-10000, 0); model.ApplyForceToNode(force, node2); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); ReactionVector reaction = results.GetReaction(node1); Assert.AreEqual(10000, reaction.Z, 0.001); Assert.AreEqual(-30000, reaction.YY, 0.001); DisplacementVector displacement = results.GetDisplacement(node2); Assert.AreEqual(-0.00214, displacement.Z, 0.0005); Assert.AreEqual(0.00107, displacement.YY, 0.0001); }
public void SpringAt60DegreesInXYPlane() { FiniteElementModel model = new FiniteElementModel(ModelType.Truss2D); // we will create and analyze a 2D truss system FiniteElementNode node1 = model.NodeFactory.CreateFor2DTruss(0, 0); // create a node at the origin model.ConstrainNode(node1, DegreeOfFreedom.X); // constrain this node from moving in the X axis model.ConstrainNode(node1, DegreeOfFreedom.Z); // also constrain it from moving in the Y axis FiniteElementNode node2 = model.NodeFactory.CreateFor2DTruss(1, 1.73205); // create a second node at a distance 1 metre along the X axis and 1.73 metres along the Y axis (giving an angle of 60 degrees from x-axis). model.ConstrainNode(node2, DegreeOfFreedom.X); LinearConstantSpring spring = model.ElementFactory.CreateLinearConstantSpring(node1, node2, 1000); // create a spring between the first two nodes of a stiffness of 1000 Newtons per metre ForceVector force = model.ForceFactory.CreateForTruss(0, 10); // Create a force of with components of 10 Newtons along the y-axis. model.ApplyForceToNode(force, node2); // Apply that force to the second node IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); // Create a new instance of the solver class and pass it the model to solve FiniteElementResults results = solver.Solve(); // ask the solver to solve the model and return results DisplacementVector displacementAtNode2 = results.GetDisplacement(node2); // get the displacement at the second node Assert.AreEqual(0, displacementAtNode2.X); // Check that there is no displacement in the x-axis Assert.AreEqual(0.013333, displacementAtNode2.Z, 0.001); // and 0.01333 metres (13 millimetres) along the Y axis. ReactionVector reactionAtNode1 = results.GetReaction(node1); //get the reaction at the first node Assert.AreEqual(-5.774, reactionAtNode1.X, 0.001); // Check that we have calculated a reaction of 10/SQRT(3) Newtons in the X axis. Assert.AreEqual(-10, reactionAtNode1.Z, 0.001); // and a reaction of -10 Newtons in the Y axis. }
public void CalculateModelOfOneSpringWith2DegreesOfFreedom() { FiniteElementModel model = new FiniteElementModel(ModelType.Truss1D); // we will create and analyze a 1D truss system FiniteElementNode node1 = model.NodeFactory.Create(0); // create a node at the origin model.ConstrainNode(node1, DegreeOfFreedom.X); // constrain this node from moving in the X axis FiniteElementNode node2 = model.NodeFactory.Create(1.0); // create a second node at a distance 1 metre along the X axis model.ElementFactory.CreateLinearConstantSpring(node1, node2, 2000.0); // create a spring between the two nodes of a stiffness of 2000 Newtons per metre ForceVector force = model.ForceFactory.Create(10.0); // Create a force of 10 Newtons in the x direction model.ApplyForceToNode(force, node2); // Apply that force to the second node IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); // Create a new instance of the solver class and pass it the model to solve FiniteElementResults results = solver.Solve(); // ask the solver to solve the model and return results DisplacementVector displacement = results.GetDisplacement(node2); // get the displacement at the second node Assert.AreEqual(0.005, displacement.X); // Check that we have calculated a displacement of 0.005 metres (5 millimetres) along the X axis. ReactionVector reaction = results.GetReaction(node1); //get the reaction at the first node Assert.AreEqual(-10, reaction.X); // Check that we have calculated a reaction of -10 Newtons in the X axis. }
public void SetUp() { model = new FiniteElementModel(ModelType.Truss1D); node = model.NodeFactory.Create(0); SUT = new FiniteElementResults(ModelType.Truss1D); }
public void Cantilever() { FiniteElementModel model = new FiniteElementModel(ModelType.Beam1D); // we will create and analyze a 1D beam system FiniteElementNode node1 = model.NodeFactory.Create(0); // create a node at the origin model.ConstrainNode(node1, DegreeOfFreedom.Z); // constrain the node from moving in the Z-axis model.ConstrainNode(node1, DegreeOfFreedom.YY); // constrain this node from rotating around the Y-axis FiniteElementNode node2 = model.NodeFactory.Create(3.0); // create a second node at a distance 1 metre along the X axis IMaterial material = new GenericElasticMaterial(0, 210000000000, 0, 0); ICrossSection section = new GenericCrossSection(0.0001, 0.0002); model.ElementFactory.CreateLinear1DBeam(node1, node2, material, section); ForceVector force = model.ForceFactory.CreateFor1DBeam(-10000, 0); // Create a force of 10 KiloNewtons in the z direction model.ApplyForceToNode(force, node2); // Apply that force to the second node IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); // Create a new instance of the solver class and pass it the model to solve FiniteElementResults results = solver.Solve(); // ask the solver to solve the model and return results ReactionVector reaction = results.GetReaction(node1); //get the reaction at the first node Assert.AreEqual(10000, reaction.Z, 0.001); // Check that we have calculated a reaction of 10 KiloNewtons in the Z-axis Assert.AreEqual(-30000, reaction.YY, 0.001); // Check that we have calculated a reaction of -30 KiloNewtonMetres around the YY axis. DisplacementVector displacement = results.GetDisplacement(node2); // get the displacement at the second node Assert.AreEqual(-0.00214, displacement.Z, 0.0005); Assert.AreEqual(0.00107, displacement.YY, 0.0001); }
public void SetUp() { model = new FiniteElementModel(ModelType.Truss1D); node = model.NodeFactory.Create(0); SUT = new FiniteElementResults(ModelType.Truss1D); }
public void OneVerticalQuadFixed3PointsMembrane() { FiniteElementModel 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(1.0, 0.0, 1.0); model.ConstrainNode(node3, DegreeOfFreedom.X); model.ConstrainNode(node3, DegreeOfFreedom.Y); model.ConstrainNode(node3, DegreeOfFreedom.Z); FiniteElementNode node4 = model.NodeFactory.Create(0.0, 0.0, 1.0); model.ConstrainNode(node4, DegreeOfFreedom.Y); IMaterial material = new GenericElasticMaterial(0, 210000000000, 0.3, 0); model.ElementFactory.CreateLinearConstantStressQuadrilateral(node1, node2, node3, node4, material, 0.1); ForceVector force = model.ForceFactory.Create(10000, 0, 0, 0, 0, 0); model.ApplyForceToNode(force, node4); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); ReactionVector reaction1 = results.GetReaction(node1); Console.WriteLine("\nReaction1 : \n" + reaction1); ReactionVector reaction2 = results.GetReaction(node2); Console.WriteLine("\nReaction2 : \n" + reaction2); ReactionVector reaction3 = results.GetReaction(node3); Console.WriteLine("\nReaction3 : \n" + reaction3); DisplacementVector displacement4 = results.GetDisplacement(node4); Console.WriteLine("\nDisplacement4 : \n" + displacement4); Assert.AreEqual(2621, reaction1.X, 1); Assert.AreEqual(-3039, reaction1.Z, 1); Assert.AreEqual(-5660, reaction2.X, 1); Assert.AreEqual(1706, reaction2.Z, 1); Assert.AreEqual(-6961, reaction3.X, 1); Assert.AreEqual(1333, reaction3.Z, 1); Assert.AreEqual(0.0000012400, displacement4.X, 0.0000000001); Assert.AreEqual(0.0000004875, displacement4.Z, 0.0000000001); }
public void CalculateGridOf3BeamsAnd24Dof() { FiniteElementModel model = new FiniteElementModel(ModelType.Slab2D); FiniteElementNode node1 = model.NodeFactory.Create(4, 4); FiniteElementNode node2 = model.NodeFactory.Create(4, 0); model.ConstrainNode(node2, DegreeOfFreedom.Z); model.ConstrainNode(node2, DegreeOfFreedom.XX); model.ConstrainNode(node2, DegreeOfFreedom.YY); FiniteElementNode node3 = model.NodeFactory.Create(0, 0); model.ConstrainNode(node3, DegreeOfFreedom.Z); model.ConstrainNode(node3, DegreeOfFreedom.XX); model.ConstrainNode(node3, DegreeOfFreedom.YY); FiniteElementNode node4 = model.NodeFactory.Create(0, 4); model.ConstrainNode(node4, DegreeOfFreedom.Z); model.ConstrainNode(node4, DegreeOfFreedom.XX); model.ConstrainNode(node4, DegreeOfFreedom.YY); IMaterial material = new GenericElasticMaterial(0, 210000000000, 0, 84000000000); ICrossSection section = new GenericCrossSection(0.02, 0.0002, 0.0002, 0.00005); model.ElementFactory.CreateLinear3DBeam(node1, node2, material, section); model.ElementFactory.CreateLinear3DBeam(node1, node3, material, section); model.ElementFactory.CreateLinear3DBeam(node1, node4, material, section); ForceVector force = model.ForceFactory.Create(0, 0, -20000, 0, 0, 0); model.ApplyForceToNode(force, node1); IFiniteElementSolver solver = new LinearSolverSVD(model); FiniteElementResults results = solver.Solve(); DisplacementVector node1Displacement = results.GetDisplacement(node1); ReactionVector node2Reaction = results.GetReaction(node2); ReactionVector node3Reaction = results.GetReaction(node3); ReactionVector node4Reaction = results.GetReaction(node4); Assert.AreEqual(-0.0033, node1Displacement.Z, 0.0001); Assert.AreEqual(-0.0010, node1Displacement.XX, 0.0001); Assert.AreEqual(0.0010, node1Displacement.YY, 0.0001); Assert.AreEqual(10794, node2Reaction.Z, 1); Assert.AreEqual(31776, node2Reaction.XX, 1); Assert.AreEqual(-1019, node2Reaction.YY, 1); Assert.AreEqual(-1587, node3Reaction.Z, 1); Assert.AreEqual(4030, node3Reaction.XX, 1); Assert.AreEqual(-4030, node3Reaction.YY, 1); Assert.AreEqual(10794, node4Reaction.Z, 1); Assert.AreEqual(1019, node4Reaction.XX, 1); Assert.AreEqual(-31776, node4Reaction.YY, 1); }
public void CanSolveSimple1DOFSpring() { FiniteElementResults results = SUT.Solve(); Assert.IsNotNull(results); Assert.AreEqual(5, results.GetDisplacement(node2).X); Assert.AreEqual(-20, results.GetReaction(node1).X); }
public void TwoTriangleWall() { FiniteElementModel model = new FiniteElementModel(ModelType.Membrane3D); // we will create and analyze a 2D slab system FiniteElementNode node1 = model.NodeFactory.Create(0.0, 0.0, 0.0); // create a node at the origin model.ConstrainNode(node1, DegreeOfFreedom.X); // constrain the node from moving in the x-axis model.ConstrainNode(node1, DegreeOfFreedom.Y); // constrain the node from moving in the y-axis model.ConstrainNode(node1, DegreeOfFreedom.Z); // constrain the node from moving in the z-axis FiniteElementNode node2 = model.NodeFactory.Create(1.0, 0.0, 0.0); // create a second node at a distance 1 metre along the X axis model.ConstrainNode(node2, DegreeOfFreedom.X); // constrain the node from moving in the x-axis model.ConstrainNode(node2, DegreeOfFreedom.Y); // constrain the node from moving in the y-axis model.ConstrainNode(node2, DegreeOfFreedom.Z); // constrain the node from moving in the z-axis FiniteElementNode node3 = model.NodeFactory.Create(0.0, 1.0, 0.0); model.ConstrainNode(node3, DegreeOfFreedom.Z); // constrain the node from moving in the z-axis FiniteElementNode node4 = model.NodeFactory.Create(1.0, 1.0, 0.0); model.ConstrainNode(node4, DegreeOfFreedom.Z); // constrain the node from moving in the z-axis IMaterial material = new GenericElasticMaterial(0, 200000, 0.2, 84000); model.ElementFactory.CreateLinearConstantStrainTriangle(node1, node2, node3, material, 0.1); // create a triangle of thickness of 0.1 metres model.ElementFactory.CreateLinearConstantStrainTriangle(node2, node4, node3, material, 0.1); ForceVector force = model.ForceFactory.Create(0, -10); // Create a force of 10 Newtons in the y direction model.ApplyForceToNode(force, node3); // Apply that force to the third node model.ApplyForceToNode(force, node4); IFiniteElementSolver solver = new MatrixInversionLinearSolver(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.AreEqual(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.AreEqual(0.0, displacement4.Z); // TODO calculate the actual value, rather than just checking we have any value }
public void Calculate2DPortalFrameOf3BeamsAnd12Dof() { FiniteElementModel model = new FiniteElementModel(ModelType.Full3D); FiniteElementNode node1 = model.NodeFactory.Create(-3, 0, 0); model.ConstrainNode(node1, DegreeOfFreedom.X); model.ConstrainNode(node1, DegreeOfFreedom.Y); model.ConstrainNode(node1, DegreeOfFreedom.Z); model.ConstrainNode(node1, DegreeOfFreedom.XX); model.ConstrainNode(node1, DegreeOfFreedom.YY); FiniteElementNode node2 = model.NodeFactory.Create(-3, 0, 6); FiniteElementNode node3 = model.NodeFactory.Create(3, 0, 6); FiniteElementNode node4 = model.NodeFactory.Create(3, 0, 0); model.ConstrainNode(node4, DegreeOfFreedom.X); model.ConstrainNode(node4, DegreeOfFreedom.Y); model.ConstrainNode(node4, DegreeOfFreedom.Z); model.ConstrainNode(node4, DegreeOfFreedom.XX); model.ConstrainNode(node4, DegreeOfFreedom.YY); IMaterial material = new GenericElasticMaterial(0, 210000000000, 0, 84000000); ICrossSection section = new GenericCrossSection(0.0002, 0.0002, 0.0002, 0.00005); model.ElementFactory.CreateLinear3DBeam(node1, node2, material, section); model.ElementFactory.CreateLinear3DBeam(node2, node3, material, section); model.ElementFactory.CreateLinear3DBeam(node3, node4, material, section); ForceVector force2 = model.ForceFactory.Create(15000, 0, 0, 0, -10000, 0); model.ApplyForceToNode(force2, node2); IFiniteElementSolver solver = new LinearSolverSVD(model); FiniteElementResults results = solver.Solve(); DisplacementVector node2Displacement = results.GetDisplacement(node2); DisplacementVector node3Displacement = results.GetDisplacement(node3); ReactionVector node1Reaction = results.GetReaction(node1); ReactionVector node4Reaction = results.GetReaction(node4); Assert.AreEqual(0.0052843, node2Displacement.X, 0.0001); Assert.AreEqual(0.0006522, node2Displacement.Z, 0.0001); Assert.AreEqual(0.0005, node2Displacement.YY, 0.0001); Assert.AreEqual(0.0044052, node3Displacement.X, 0.0001); Assert.AreEqual(-0.0006522, node3Displacement.Z, 0.0001); Assert.AreEqual(0.0006, node3Displacement.YY, 0.0001); Assert.AreEqual(-9000, node1Reaction.X, 500); Assert.AreEqual(-5000, node1Reaction.Z, 500); Assert.AreEqual(-30022, node1Reaction.YY, 500); Assert.AreEqual(-6000, node4Reaction.X, 500); Assert.AreEqual(5000, node4Reaction.Z, 500); Assert.AreEqual(-22586, node4Reaction.YY, 500); }
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 CanCalculateCorrectReactionsWithForcesAppliedToConstrainedNodes() { model.ApplyForceToNode(force1, node1); FiniteElementResults results = SUT.Solve(); Assert.IsNotNull(results); Assert.AreEqual(5, results.GetDisplacement(node2).X); Assert.AreEqual(0, results.GetReaction(node1).X); }
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 void Calculate3DFrameOf3BeamsAnd24Dof() { FiniteElementModel model = new FiniteElementModel(ModelType.Full3D); FiniteElementNode node1 = model.NodeFactory.Create(0, 0, 0); FiniteElementNode node2 = model.NodeFactory.Create(3, 0, 0); model.ConstrainNode(node2, DegreeOfFreedom.X); model.ConstrainNode(node2, DegreeOfFreedom.Y); model.ConstrainNode(node2, DegreeOfFreedom.Z); FiniteElementNode node3 = model.NodeFactory.Create(0, 3, 0); model.ConstrainNode(node3, DegreeOfFreedom.X); model.ConstrainNode(node3, DegreeOfFreedom.Y); model.ConstrainNode(node3, DegreeOfFreedom.Z); FiniteElementNode node4 = model.NodeFactory.Create(0, 0, -4); model.ConstrainNode(node4, DegreeOfFreedom.X); model.ConstrainNode(node4, DegreeOfFreedom.Y); model.ConstrainNode(node4, DegreeOfFreedom.Z); IMaterial material = new GenericElasticMaterial(0, 210000000000, 0.3, 84000000000); ICrossSection section = new GenericCrossSection(0.02, 0.0001, 0.0002, 0.00005); model.ElementFactory.CreateLinear3DBeam(node1, node2, material, section); model.ElementFactory.CreateLinear3DBeam(node1, node3, material, section); model.ElementFactory.CreateLinear3DBeam(node1, node4, material, section); ForceVector force = model.ForceFactory.Create(-10000, -15000, 0, 0, 0, 0); model.ApplyForceToNode(force, node1); IFiniteElementSolver solver = new LinearSolverSVD(model); FiniteElementResults results = solver.Solve(); DisplacementVector node1Displacement = results.GetDisplacement(node1); ReactionVector node2Reaction = results.GetReaction(node2); ReactionVector node3Reaction = results.GetReaction(node3); ReactionVector node4Reaction = results.GetReaction(node4); Console.WriteLine("\nNode1 displacement : \n" + node1Displacement); Console.WriteLine("\nNode2 reaction : \n" + node2Reaction); Console.WriteLine("\nNode3 reaction : \n" + node3Reaction); Console.WriteLine("\nNode4 reaction : \n" + node4Reaction); Assert.Inconclusive("The below x, y and zz pass, but z, xx, yy fail"); Assert.AreEqual(-0.000007109, node1Displacement.X, 0.00000001); Assert.AreEqual(-0.000010680, node1Displacement.Y, 0.00000001); Assert.AreEqual(-0.000014704, node1Displacement.Z, 0.00000001); Assert.AreEqual(0.000001147, node1Displacement.XX, 0.00000001); Assert.AreEqual(-0.000001068, node1Displacement.YY, 0.00000001); Assert.AreEqual(0.000000595, node1Displacement.ZZ, 0.000000001); }
/// <summary> /// Puts the data into the results data structure. /// </summary> /// <param name="displacements">The calculated displacements. The index of the values in the vector matches the index of the displacement identifiers.</param> /// <param name="reactions">The calculated reactions. The index of the values in the vector matches the index of the reaction identifiers.</param> /// <returns>The results in a presentable data structure</returns> protected FiniteElementResults CreateResults(KeyedVector <NodalDegreeOfFreedom> displacements, KeyedVector <NodalDegreeOfFreedom> reactions) { Guard.AgainstNullArgument(displacements, "displacements"); Guard.AgainstNullArgument(reactions, "reactions"); FiniteElementResults results = new FiniteElementResults(this.model.ModelType); results.AddMultipleDisplacements(displacements); results.AddMultipleReactions(reactions); return(results); }
public void At120Degrees() { Create2DSingleSpringModelAroundOrigin(-1, Math.Sqrt(3)); FiniteElementResults results = SUT.Solve(); Assert.IsNotNull(results); Assert.AreEqual(-5.774, results.GetReaction(node1).X, 0.001); Assert.AreEqual(10, results.GetReaction(node1).Z, 0.001); Assert.AreEqual(5.774, results.GetReaction(node2).X, 0.001); Assert.AreEqual((-4.0 / 3.0 / 100.0), results.GetDisplacement(node2).Z, 0.001); Assert.AreEqual(0, results.GetDisplacement(node2).X); }
public void At135Degrees() { Create2DSingleSpringModelAroundOrigin(-1, 1); FiniteElementResults results = SUT.Solve(); Assert.IsNotNull(results); Assert.AreEqual(-10, results.GetReaction(node1).X, 0.001); Assert.AreEqual(10, results.GetReaction(node1).Z, 0.001); Assert.AreEqual(10, results.GetReaction(node2).X, 0.001); Assert.AreEqual(-0.02, results.GetDisplacement(node2).Z, 0.001); Assert.AreEqual(0, results.GetDisplacement(node2).X, 0.001); }
public void SimplySupportedBeam() { 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, 0); model.ConstrainNode(node2, DegreeOfFreedom.X); model.ConstrainNode(node2, DegreeOfFreedom.Y); model.ConstrainNode(node2, DegreeOfFreedom.Z); model.ConstrainNode(node2, DegreeOfFreedom.XX); IMaterial material = new GenericElasticMaterial(0, 210000000000, 0, 84000000000); ICrossSection section = new GenericCrossSection(0.0001, 0.0002, 0.0002, 0.00005); model.ElementFactory.CreateLinear3DBeam(node1, node2, material, section); ForceVector moment = model.ForceFactory.Create(0, 0, 0, 0, 10000, 0); model.ApplyForceToNode(moment, node1); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); // check the results DisplacementVector displacementAtNode1 = results.GetDisplacement(node1); Assert.AreEqual(0, displacementAtNode1.Z, 0.001); Assert.AreEqual(0.00007936, displacementAtNode1.YY, 0.000001); DisplacementVector displacementAtNode2 = results.GetDisplacement(node2); Assert.AreEqual(0, displacementAtNode2.Z, 0.001); Assert.AreEqual(-0.00003968, displacementAtNode2.YY, 0.000001); ReactionVector reactionAtNode1 = results.GetReaction(node1); Assert.AreEqual(-10000, reactionAtNode1.Z, 0.001); Assert.AreEqual(0, reactionAtNode1.YY, 0.001); ReactionVector reactionAtNode2 = results.GetReaction(node2); Assert.AreEqual(10000, reactionAtNode2.Z, 0.001); Assert.AreEqual(0, reactionAtNode2.YY, 0.001); }
public DisplacementVector GetDisplacement(IFiniteElementNode node, FiniteElementResults results) { DisplacementVector disp = null; if (results.DisplacementVectorExists(node)) { disp = results.GetDisplacement(node); } else { disp = new DisplacementVector(node, 0, 0); } return(disp); }
public void OneQuadMembraneLateralLoad() { FiniteElementModel model = new FiniteElementModel(ModelType.Membrane2D); FiniteElementNode node1 = model.NodeFactory.Create(0.0, 0.0); model.ConstrainNode(node1, DegreeOfFreedom.X); model.ConstrainNode(node1, DegreeOfFreedom.Y); FiniteElementNode node2 = model.NodeFactory.Create(1.0, 0.0); model.ConstrainNode(node2, DegreeOfFreedom.Y); FiniteElementNode node3 = model.NodeFactory.Create(1.0, 1.0); FiniteElementNode node4 = model.NodeFactory.Create(0.0, 1.0); IMaterial material = new GenericElasticMaterial(0, 210000000000, 0.3, 0); model.ElementFactory.CreateLinearConstantStressQuadrilateral(node1, node2, node3, node4, material, 0.1); ForceVector force = model.ForceFactory.Create(10000, 0); model.ApplyForceToNode(force, node4); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); ReactionVector reaction1 = results.GetReaction(node1); // Console.WriteLine("\nReaction1 : \n" + reaction1); ReactionVector reaction2 = results.GetReaction(node2); // Console.WriteLine("\nReaction2 : \n" + reaction2); Assert.AreEqual(0, reaction1.Y + reaction2.Y, 1); Assert.AreEqual(-10000, reaction1.X, 1); DisplacementVector displacement3 = results.GetDisplacement(node3); DisplacementVector displacement4 = results.GetDisplacement(node4); Console.WriteLine("\nDisplacement3 : \n" + displacement3); Console.WriteLine("\nDisplacement4 : \n" + displacement4); Assert.AreEqual(0.000002619047, displacement3.X, 0.0000000001); Assert.AreEqual(-0.000001428571, displacement3.Y, 0.0000000001); Assert.AreEqual(0.000004047618, displacement4.X, 0.0000000001); Assert.AreEqual(0.000001428571, displacement4.Y, 0.0000000001); }
public void CalculateModelOfTwoBarsAndOneSpringWithFourDegreesOfFreedom() { FiniteElementModel model = new FiniteElementModel(ModelType.Truss1D); FiniteElementNode node1 = model.NodeFactory.Create(0); model.ConstrainNode(node1, DegreeOfFreedom.X); FiniteElementNode node2 = model.NodeFactory.Create(2.0); FiniteElementNode node3 = model.NodeFactory.Create(4.0); FiniteElementNode node4 = model.NodeFactory.Create(6.0); model.ConstrainNode(node4, DegreeOfFreedom.X); IMaterial material = new GenericElasticMaterial(0, 70000000000, 0, 0); ICrossSection section = new SolidRectangle(0.02, 0.01); model.ElementFactory.CreateLinearTruss(node1, node2, material, section); model.ElementFactory.CreateLinearTruss(node2, node3, material, section); model.ElementFactory.CreateLinearConstantSpring(node3, node4, 2000000); ForceVector externalForce = model.ForceFactory.Create(8000); model.ApplyForceToNode(externalForce, node2); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); DisplacementVector displacementAtNode2 = results.GetDisplacement(node2); Assert.AreEqual(0.000935, displacementAtNode2.X, 0.001); DisplacementVector displacementAtNode3 = results.GetDisplacement(node3); Assert.AreEqual(0.000727, displacementAtNode3.X, 0.001); ReactionVector reactionAtNode1 = results.GetReaction(node1); Assert.AreEqual(-6546, reactionAtNode1.X, 1); ReactionVector reactionAtNode4 = results.GetReaction(node4); Assert.AreEqual(-1455, reactionAtNode4.X, 1); }
public void CalculateModelOfThreeSpringsWithFourDegreesOfFreedom() { FiniteElementModel model = new FiniteElementModel(ModelType.Truss1D); FiniteElementNode node1 = model.NodeFactory.Create(0); model.ConstrainNode(node1, DegreeOfFreedom.X); FiniteElementNode node2 = model.NodeFactory.Create(1.0); FiniteElementNode node3 = model.NodeFactory.Create(2.0); model.ConstrainNode(node3, DegreeOfFreedom.X); FiniteElementNode node4 = model.NodeFactory.Create(2.00001); ///TODO allow multiple nodes to be added in the same location model.ConstrainNode(node4, DegreeOfFreedom.X); model.ElementFactory.CreateLinearConstantSpring(node1, node2, 1); model.ElementFactory.CreateLinearConstantSpring(node2, node3, 1); model.ElementFactory.CreateLinearConstantSpring(node2, node4, 1); ForceVector externalForce = model.ForceFactory.Create(10); model.ApplyForceToNode(externalForce, node2); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); DisplacementVector displacementAtNode2 = results.GetDisplacement(node2); Assert.AreEqual(3.333, displacementAtNode2.X, 0.001); ReactionVector reactionAtNode1 = results.GetReaction(node1); Assert.AreEqual(-3.333, reactionAtNode1.X, 0.001); ReactionVector reactionAtNode3 = results.GetReaction(node3); Assert.AreEqual(-3.333, reactionAtNode3.X, 0.001); ReactionVector reactionAtNode4 = results.GetReaction(node4); Assert.AreEqual(-3.333, reactionAtNode4.X, 0.001); }
public void SimplySupportedBeam() //TODO verify using independent check { FiniteElementModel model = new FiniteElementModel(ModelType.Beam1D); // we will create and analyze a 1D beam system FiniteElementNode node1 = model.NodeFactory.Create(0); // create a node at the origin model.ConstrainNode(node1, DegreeOfFreedom.Z); // constrain the node from moving in the Z-axis FiniteElementNode node2 = model.NodeFactory.Create(1.0); // create a second node at a distance 1 metre along the X axis model.ConstrainNode(node2, DegreeOfFreedom.Z); // constrain the node from moving in the Z-axis IMaterial material = new GenericElasticMaterial(0, 210000000000, 0, 0); ICrossSection section = new GenericCrossSection(0.0001, 0.0002); model.ElementFactory.CreateLinear3DBeam(node1, node2, material, section); // create a spring between the two nodes of a stiffness of 2000 Newtons per metre ForceVector moment = model.ForceFactory.CreateFor1DBeam(0, 10000); // Create a clockwise(?) moment of 10 KiloNewtonmetres around the yy axis model.ApplyForceToNode(moment, node1); // Apply that moment to the first node IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); // Create a new instance of the solver class and pass it the model to solve FiniteElementResults results = solver.Solve(); // ask the solver to solve the model and return results // check the results DisplacementVector displacementAtNode1 = results.GetDisplacement(node1); Assert.AreEqual(0, displacementAtNode1.Z, 0.001); Assert.AreEqual(0.00007936, displacementAtNode1.YY, 0.00000001); DisplacementVector displacementAtNode2 = results.GetDisplacement(node2); Assert.AreEqual(0, displacementAtNode2.Z, 0.001); Assert.AreEqual(-0.00003968, displacementAtNode2.YY, 0.00000001); ReactionVector reactionAtNode1 = results.GetReaction(node1); Assert.AreEqual(-10000, reactionAtNode1.Z, 0.001); Assert.AreEqual(0, reactionAtNode1.YY, 0.001); ReactionVector reactionAtNode2 = results.GetReaction(node2); Assert.AreEqual(10000, reactionAtNode2.Z, 0.001); Assert.AreEqual(0, reactionAtNode2.YY, 0.001); }
public void ThreeNodeCantilever() { 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); model.ConstrainNode(node1, DegreeOfFreedom.YY); model.ConstrainNode(node1, DegreeOfFreedom.ZZ); FiniteElementNode node2 = model.NodeFactory.Create(1.5, 0, 0); FiniteElementNode node3 = model.NodeFactory.Create(3.0, 0, 0); IMaterial material = new GenericElasticMaterial(0, 210000000000, 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, node3); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); ReactionVector reaction = results.GetReaction(node1); Assert.AreEqual(10000, reaction.Z, 0.001); Assert.AreEqual(-30000, reaction.YY, 0.001); DisplacementVector displacement2 = results.GetDisplacement(node2); Assert.AreEqual(-0.000670, displacement2.Z, 0.0005); Assert.AreEqual(0.000804, displacement2.YY, 0.0001); DisplacementVector displacement3 = results.GetDisplacement(node3); Assert.AreEqual(-0.00214, displacement3.Z, 0.0005); Assert.AreEqual(0.00107, displacement3.YY, 0.0001); }
public List <ElementResult> CalcElementResults(FiniteElementModel model, FiniteElementResults results) { List <ElementResult> output = new List <ElementResult>(); //1. Calculate for frames foreach (var elem in model.Elements) { if (elem is LinearTruss) { var truss = elem as LinearTruss; var startLoc = truss.StartNode.Location; var endLoc = truss.EndNode.Location; var startDisp = GetDisplacement(truss.StartNode, results); var endDisp = GetDisplacement(truss.EndNode, results); var dispStartLoc = new CartesianPoint( truss.StartNode.X + startDisp.X, truss.StartNode.Y + startDisp.Y, truss.StartNode.Z + startDisp.Z); var dispEndLoc = new CartesianPoint( truss.EndNode.X + endDisp.X, truss.EndNode.Y + endDisp.Y, truss.EndNode.Z + endDisp.Z); double initialDist = Distance(startLoc, endLoc); double deformedDist = Distance(dispStartLoc, dispEndLoc); double dx = deformedDist - initialDist; var axialForce = truss.Material.YoungsModulus * truss.CrossSection.Area * dx; output.Add(new ElementResult() { AxialForce = axialForce }); } } return(output); }
public AnalysisResults AnalyzeModel(FiniteElementModel model) { IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); AnalysisResults pixResults = new AnalysisResults(); int i = 0; foreach (var node in model.Nodes) { DisplacementVector disp = GetDisplacement(node, results); pixResults.NodeResults.Add(i, new NodeResult() { DispX = disp.X, DispY = disp.Z }); i++; } //CalcElementResults(model); return(pixResults); }
public void Calculate3DTrussOf4BarsAnd15Dof() { FiniteElementModel model = new FiniteElementModel(ModelType.Truss3D); FiniteElementNode node1 = model.NodeFactory.Create(4, 4, 3); FiniteElementNode node2 = model.NodeFactory.Create(0, 4, 0); model.ConstrainNode(node2, DegreeOfFreedom.X); model.ConstrainNode(node2, DegreeOfFreedom.Y); model.ConstrainNode(node2, DegreeOfFreedom.Z); FiniteElementNode node3 = model.NodeFactory.Create(0, 4, 6); model.ConstrainNode(node3, DegreeOfFreedom.X); model.ConstrainNode(node3, DegreeOfFreedom.Y); model.ConstrainNode(node3, DegreeOfFreedom.Z); FiniteElementNode node4 = model.NodeFactory.Create(4, 0, 3); model.ConstrainNode(node4, DegreeOfFreedom.X); model.ConstrainNode(node4, DegreeOfFreedom.Y); model.ConstrainNode(node4, DegreeOfFreedom.Z); FiniteElementNode node5 = model.NodeFactory.Create(8, -1, 1); model.ConstrainNode(node5, DegreeOfFreedom.X); model.ConstrainNode(node5, DegreeOfFreedom.Y); model.ConstrainNode(node5, DegreeOfFreedom.Z); IMaterial material = new GenericElasticMaterial(0, 210000000000, 0, 0); ICrossSection section = new SolidRectangle(0.01, 0.01); model.ElementFactory.CreateLinearTruss(node1, node2, material, section); model.ElementFactory.CreateLinearTruss(node1, node3, material, section); model.ElementFactory.CreateLinearTruss(node1, node4, material, section); model.ElementFactory.CreateLinearTruss(node1, node5, material, section); ForceVector externalForce = model.ForceFactory.Create(0, -10000, 0, 0, 0, 0); model.ApplyForceToNode(externalForce, node1); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); ReactionVector reactionAtNode2 = results.GetReaction(node2); Assert.AreEqual(270.9, reactionAtNode2.X, 1); Assert.AreEqual(0, reactionAtNode2.Y, 1); Assert.AreEqual(203.2, reactionAtNode2.Z, 1); ReactionVector reactionAtNode3 = results.GetReaction(node3); Assert.AreEqual(1354.6, reactionAtNode3.X, 1); Assert.AreEqual(0, reactionAtNode3.Y, 1); Assert.AreEqual(-1016, reactionAtNode3.Z, 1); ReactionVector reactionAtNode4 = results.GetReaction(node4); Assert.AreEqual(0, reactionAtNode4.X, 1); Assert.AreEqual(7968.1, reactionAtNode4.Y, 1); Assert.AreEqual(0, reactionAtNode4.Z, 1); ReactionVector reactionAtNode5 = results.GetReaction(node5); Assert.AreEqual(-1625.5, reactionAtNode5.X, 1); Assert.AreEqual(2031.9, reactionAtNode5.Y, 1); Assert.AreEqual(812.8, reactionAtNode5.Z, 1); DisplacementVector displacementAtNode1 = results.GetDisplacement(node1); Assert.AreEqual(-0.0003024, displacementAtNode1.X, 0.0001); //NOTE the results given in the book are 1E03 Assert.AreEqual(-0.0015177, displacementAtNode1.Y, 0.0001); Assert.AreEqual(0.0002688, displacementAtNode1.Z, 0.0001); }
public void Calculate3DTrussOf3BarsAnd12Dof() { FiniteElementModel model = new FiniteElementModel(ModelType.Truss3D); FiniteElementNode node1 = model.NodeFactory.Create(72, 0, 0); model.ConstrainNode(node1, DegreeOfFreedom.Y); FiniteElementNode node2 = model.NodeFactory.Create(0, 36, 0); model.ConstrainNode(node2, DegreeOfFreedom.X); model.ConstrainNode(node2, DegreeOfFreedom.Y); model.ConstrainNode(node2, DegreeOfFreedom.Z); FiniteElementNode node3 = model.NodeFactory.Create(0, 36, 72); model.ConstrainNode(node3, DegreeOfFreedom.X); model.ConstrainNode(node3, DegreeOfFreedom.Y); model.ConstrainNode(node3, DegreeOfFreedom.Z); FiniteElementNode node4 = model.NodeFactory.Create(0, 0, -48); model.ConstrainNode(node4, DegreeOfFreedom.X); model.ConstrainNode(node4, DegreeOfFreedom.Y); model.ConstrainNode(node4, DegreeOfFreedom.Z); IMaterial material = new GenericElasticMaterial(0, 1200000, 0, 0); ICrossSection section1 = new SolidRectangle(1, 0.302); ICrossSection section2 = new SolidRectangle(1, 0.729); ///NOTE example also refers to this as A1. Assume errata in book ICrossSection section3 = new SolidRectangle(1, 0.187); ///NOTE example also refers to this as A1. Assume errata in book model.ElementFactory.CreateLinearTruss(node1, node2, material, section1); model.ElementFactory.CreateLinearTruss(node1, node3, material, section2); model.ElementFactory.CreateLinearTruss(node1, node4, material, section3); ForceVector externalForce = model.ForceFactory.Create(0, 0, -1000, 0, 0, 0); model.ApplyForceToNode(externalForce, node1); IFiniteElementSolver solver = new MatrixInversionLinearSolver(model); FiniteElementResults results = solver.Solve(); ReactionVector reactionAtNode1 = results.GetReaction(node1); Assert.AreEqual(0, reactionAtNode1.X, 1); Assert.AreEqual(-223.1632, reactionAtNode1.Y, 1); Assert.AreEqual(0, reactionAtNode1.Z, 1); ReactionVector reactionAtNode2 = results.GetReaction(node2); Assert.AreEqual(256.1226, reactionAtNode2.X, 1); Assert.AreEqual(-128.0613, reactionAtNode2.Y, 1); Assert.AreEqual(0, reactionAtNode2.Z, 1); ReactionVector reactionAtNode3 = results.GetReaction(node3); Assert.AreEqual(-702.4491, reactionAtNode3.X, 1); Assert.AreEqual(351.2245, reactionAtNode3.Y, 1); Assert.AreEqual(702.4491, reactionAtNode3.Z, 1); ReactionVector reactionAtNode4 = results.GetReaction(node4); Assert.AreEqual(446.3264, reactionAtNode4.X, 1); Assert.AreEqual(0, reactionAtNode4.Y, 1); Assert.AreEqual(297.5509, reactionAtNode4.Z, 1); DisplacementVector displacementAtNode1 = results.GetDisplacement(node1); Assert.AreEqual(-0.0711, displacementAtNode1.X, 0.0001); Assert.AreEqual(0, displacementAtNode1.Y, 0.0001); Assert.AreEqual(-0.2662, displacementAtNode1.Z, 0.0001); }
public void PitchedRoofPortalFrame() { FiniteElementModel model = new FiniteElementModel(ModelType.Full3D); FiniteElementNode node1 = model.NodeFactory.Create(-10, 0, 0); model.ConstrainNode(node1, DegreeOfFreedom.X); model.ConstrainNode(node1, DegreeOfFreedom.Z); model.ConstrainNode(node1, DegreeOfFreedom.Y); model.ConstrainNode(node1, DegreeOfFreedom.XX); FiniteElementNode node2 = model.NodeFactory.Create(-10, 0, 10); FiniteElementNode node3 = model.NodeFactory.Create(0, 0, 14); FiniteElementNode node4 = model.NodeFactory.Create(10, 0, 10); FiniteElementNode node5 = model.NodeFactory.Create(10, 0, 0); model.ConstrainNode(node5, DegreeOfFreedom.X); model.ConstrainNode(node5, DegreeOfFreedom.Z); model.ConstrainNode(node5, DegreeOfFreedom.Y); model.ConstrainNode(node5, DegreeOfFreedom.XX); IMaterial material = new GenericElasticMaterial(0, 210000000000, 0.3, 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); model.ElementFactory.CreateLinear3DBeam(node3, node4, material, section); model.ElementFactory.CreateLinear3DBeam(node4, node5, material, section); ForceVector force = model.ForceFactory.Create(0, 0, 10000, 0, 0, 0); model.ApplyForceToNode(force, node3); IFiniteElementSolver solver = new LinearSolverSVD(model); FiniteElementResults results = solver.Solve(); DisplacementVector node1Displacement = results.GetDisplacement(node1); DisplacementVector node2Displacement = results.GetDisplacement(node2); DisplacementVector node3Displacement = results.GetDisplacement(node3); DisplacementVector node4Displacement = results.GetDisplacement(node4); DisplacementVector node5Displacement = results.GetDisplacement(node5); ReactionVector node1Reaction = results.GetReaction(node1); ReactionVector node5Reaction = results.GetReaction(node5); Assert.AreEqual(0, node1Displacement.X, 0.0001); Assert.AreEqual(0, node1Displacement.Y, 0.0001); Assert.AreEqual(0, node1Displacement.Z, 0.0001); Assert.AreEqual(0.0010985, node1Displacement.YY, 0.0001); Assert.AreEqual(0.004027, node2Displacement.X, 0.0001); Assert.AreEqual(0, node2Displacement.Y, 0.0001); Assert.AreEqual(0.002381, node2Displacement.Z, 0.0001); Assert.AreEqual(-0.000996, node2Displacement.YY, 0.0001); Assert.AreEqual(0, node3Displacement.X, 0.0001); Assert.AreEqual(0, node3Displacement.Y, 0.0001); Assert.AreEqual(0.01723, node3Displacement.Z, 0.0001); Assert.AreEqual(0, node3Displacement.YY, 0.0001); Assert.AreEqual(-0.004027, node4Displacement.X, 0.0001); Assert.AreEqual(0, node4Displacement.Y, 0.0001); Assert.AreEqual(0.002381, node4Displacement.Z, 0.0001); Assert.AreEqual(0.000996, node4Displacement.YY, 0.0001); Assert.AreEqual(0, node5Displacement.X, 0.0001); Assert.AreEqual(0, node5Displacement.Y, 0.0001); Assert.AreEqual(0, node5Displacement.Z, 0.0001); Assert.AreEqual(-0.0010985, node5Displacement.YY, 0.0001); Assert.AreEqual(-5000, node1Reaction.Z, 1); Assert.AreEqual(-1759, node1Reaction.X, 1); Assert.AreEqual(0, node1Reaction.YY, 1); Assert.AreEqual(-5000, node5Reaction.Z, 1); Assert.AreEqual(1759, node5Reaction.X, 1); Assert.AreEqual(0, node5Reaction.YY, 1); }
/// <summary> /// Puts the data into the results data structure. /// </summary> /// <param name="displacements">The calculated displacements. The index of the values in the vector matches the index of the displacement identifiers.</param> /// <param name="reactions">The calculated reactions. The index of the values in the vector matches the index of the reaction identifiers.</param> /// <returns>The results in a presentable data structure</returns> protected FiniteElementResults CreateResults(KeyedVector<NodalDegreeOfFreedom> displacements, KeyedVector<NodalDegreeOfFreedom> reactions) { Guard.AgainstNullArgument(displacements, "displacements"); Guard.AgainstNullArgument(reactions, "reactions"); FiniteElementResults results = new FiniteElementResults(this.model.ModelType); results.AddMultipleDisplacements(displacements); results.AddMultipleReactions(reactions); return results; }