A finite element node is a fundamental part of a finite element mesh. Nodes have a position in space. Constraints and forces can be applied to nodes.
Inheritance: IFiniteElementNode
Ejemplo n.º 1
0
 public void WillCheckForInsufficientNumberOfElements()
 {
     model = new FiniteElementModel(ModelType.Truss1D);
     node1 = model.NodeFactory.Create(0);
     node2 = model.NodeFactory.Create(1);
     SUT = new MatrixInversionLinearSolver(model);
     SUT.Solve();
 }
Ejemplo n.º 2
0
 public void SetUp()
 {
     nodeFactory = new NodeFactory(ModelType.Truss1D);
     start = nodeFactory.Create(0);
     end = nodeFactory.Create(1);
     elementFactory = new ElementFactory(ModelType.Truss1D);
     SUT = elementFactory.CreateLinearConstantSpring(start, end, 2);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Determines whether this node matches another node
        /// </summary>
        /// <param name="other">the other node to compare for equality</param>
        /// <returns>true if the nodes are equal; otherwise, false</returns>
        public bool Equals(FiniteElementNode other)
        {
            if (other == null)
            {
                return(false);
            }

            return(object.Equals(this.X, other.X) && object.Equals(this.Y, other.Y) && object.Equals(this.Z, other.Z));
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Create a new node in a 1D model type
        /// </summary>
        /// <param name="coordinateAlongGlobalXAxis">The location of the node along the global x-axis</param>
        /// <returns>The newly created node</returns>
        public FiniteElementNode Create(double coordinateAlongGlobalXAxis)
        {
            Guard.AgainstInvalidState(() => { return this.modelType.GetDimensions() != GeometryDimensionality.OneDimension; },
                                      "Can only create a Node with an x-coordinate when a 1D system is in use");

            FiniteElementNode newNode = new FiniteElementNode(coordinateAlongGlobalXAxis);

            if (this.repo != null)
            {
                this.repo.Add(newNode);
            }

            return newNode;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Create a new node in a 1D model type
        /// </summary>
        /// <param name="coordinateAlongGlobalXAxis">The location of the node along the global x-axis</param>
        /// <returns>The newly created node</returns>
        public FiniteElementNode Create(double coordinateAlongGlobalXAxis)
        {
            Guard.AgainstInvalidState(() => { return(this.modelType.GetDimensions() != GeometryDimensionality.OneDimension); },
                                      "Can only create a Node with an x-coordinate when a 1D system is in use");

            FiniteElementNode newNode = new FiniteElementNode(coordinateAlongGlobalXAxis);

            if (this.repo != null)
            {
                this.repo.Add(newNode);
            }

            return(newNode);
        }
Ejemplo n.º 8
0
        public void SetUp()
        {
            model = new FiniteElementModel(ModelType.Truss1D);
            node1 = model.NodeFactory.Create(0);
            node2 = model.NodeFactory.Create(1);

            spring1 = model.ElementFactory.CreateLinearConstantSpring(node1, node2, 4);

            model.ConstrainNode(node1, DegreeOfFreedom.X);

            force1 = model.ForceFactory.Create(20);
            model.ApplyForceToNode(force1, node2);

            SUT = new LinearSolverSVD(model);
        }
Ejemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="coordinateAlongGlobalXAxis"></param>
        /// <param name="coordinateAlongGlobalZAxis"></param>
        /// <returns></returns>
        public FiniteElementNode CreateFor2DTruss(double coordinateAlongGlobalXAxis, double coordinateAlongGlobalZAxis)
        {
            Guard.AgainstInvalidState(() => { return(this.modelType.GetDimensions() != GeometryDimensionality.TwoDimension); },
                                      "Can only create a Node with an x and z coordinate when a 2D system is in use");

            Guard.AgainstInvalidState(() => { return(!this.modelType.IsAllowedDegreeOfFreedomForGeometry(DegreeOfFreedom.Z)); },
                                      "Cannot define geometry in the Z-direction for model type of {0}.  Use the Create method instead.",
                                      this.modelType);

            FiniteElementNode newNode = new FiniteElementNode(coordinateAlongGlobalXAxis, 0, coordinateAlongGlobalZAxis);

            if (this.repo != null)
            {
                this.repo.Add(newNode);
            }

            return(newNode);
        }
        protected void CreateAndStore2DSpringFromOriginTo(double x, double z)
        {
            this.nodeFactory = new NodeFactory(ModelType.Truss2D);
            this.start = nodeFactory.CreateFor2DTruss(0, 0);
            this.end = nodeFactory.CreateFor2DTruss(x, z);

            this.elementFactory = new ElementFactory(ModelType.Truss2D);
            this.SUT = elementFactory.CreateLinearConstantSpring(this.start, this.end, 1);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Determines whether this node is equal to an object
        /// </summary>
        /// <param name="obj">the object to compare with this node for equality</param>
        /// <returns>true if the object is equal to this node; otherwise, false</returns>
        public override bool Equals(object obj)
        {
            FiniteElementNode other = obj as FiniteElementNode;

            return(this.Equals(other));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Create a new node in a 2D model type
        /// </summary>
        /// <param name="coordinateAlongGlobalXAxis">The location of the node along the global x-axis</param>
        /// <param name="coordinateAlongGlobalYAxis">The location of the node along the global y-axis</param>
        /// <returns>The newly created node</returns>
        public FiniteElementNode Create(double coordinateAlongGlobalXAxis, double coordinateAlongGlobalYAxis)
        {
            Guard.AgainstInvalidState(() => { return this.modelType.GetDimensions() != GeometryDimensionality.TwoDimension; },
                                      "Can only create a Node with an x and y coordinate when a 2D system is in use");

            Guard.AgainstInvalidState(() => { return !this.modelType.IsAllowedDegreeOfFreedomForGeometry(DegreeOfFreedom.Y); },
                                      "Cannot define geometry in the Y-direction for model type of {0}.  Use the CreateForTruss method instead.",
                                      this.modelType);

            FiniteElementNode newNode = new FiniteElementNode(coordinateAlongGlobalXAxis, coordinateAlongGlobalYAxis);
            if (this.repo != null)
            {
                this.repo.Add(newNode);
            }

            return newNode;
        }
Ejemplo n.º 13
0
 public void SetUp()
 {
     model = null;
     node1 = null;
     node2 = null;
     spring1 = null;
     force1 = null;
     SUT = null;
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Determines whether this node matches another node
        /// </summary>
        /// <param name="other">the other node to compare for equality</param>
        /// <returns>true if the nodes are equal; otherwise, false</returns>
        public bool Equals(FiniteElementNode other)
        {
            if (other == null)
            {
                return false;
            }

            return object.Equals(this.X, other.X) && object.Equals(this.Y, other.Y) && object.Equals(this.Z, other.Z);
        }
Ejemplo n.º 15
0
        public void Setup()
        {
            SUT = new FiniteElementModel(ModelType.Truss1D);

            node1 = SUT.NodeFactory.Create(0);
            node2 = SUT.NodeFactory.Create(1);
            node3 = SUT.NodeFactory.Create(2);
            spring1 = SUT.ElementFactory.CreateLinearConstantSpring(node1, node2, 3);
            spring2 = SUT.ElementFactory.CreateLinearConstantSpring(node2, node3, 2);

            SUT.ConstrainNode(node1, DegreeOfFreedom.X);
            SUT.ConstrainNode(node3, DegreeOfFreedom.X);

            force1 = SUT.ForceFactory.Create(20);
            SUT.ApplyForceToNode(force1, node2);
        }
Ejemplo n.º 16
0
 public void Setup()
 {
     nodeFactory = new NodeFactory(ModelType.Truss2D);
     node1 = nodeFactory.CreateFor2DTruss(0, 0);
     node2 = nodeFactory.CreateFor2DTruss(0, 1);
     node3 = nodeFactory.CreateFor2DTruss(0, 2);
     SUT = new ElementRepository();
     elementFactory = new ElementFactory(ModelType.Truss2D, SUT);
     spring1 = elementFactory.CreateLinearConstantSpring(node1, node2, 1);
     spring2 = elementFactory.CreateLinearConstantSpring(node2, node3, 2);
 }
Ejemplo n.º 17
0
        private void Create2DSingleSpringModelAroundOrigin(double x, double z)
        {
            model = new FiniteElementModel(ModelType.Truss2D);
            node1 = model.NodeFactory.CreateFor2DTruss(0, 0);
            node2 = model.NodeFactory.CreateFor2DTruss(x, z);

            spring1 = model.ElementFactory.CreateLinearConstantSpring(node1, node2, 1000);

            model.ConstrainNode(node1, DegreeOfFreedom.X);
            model.ConstrainNode(node1, DegreeOfFreedom.Z);
            model.ConstrainNode(node2, DegreeOfFreedom.X);

            force1 = model.ForceFactory.CreateForTruss(0, -10);
            model.ApplyForceToNode(force1, node2);

            SUT = new LinearSolverSVD(model);
        }
Ejemplo n.º 18
0
        public void NodesCanHaveAConstraint()
        {
            SUT = new NodeRepository(ModelType.Full3D);
            nodeFactory = new NodeFactory(ModelType.Full3D, SUT);
            node1 = nodeFactory.Create(0, 0, 0);

            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.X));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.Y));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.Z));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.XX));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.YY));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.ZZ));

            SUT.ConstrainNode(node1, DegreeOfFreedom.X);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.X));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.Y));

            SUT.ConstrainNode(node1, DegreeOfFreedom.Y);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.X));
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.Y));

            SUT.ConstrainNode(node1, DegreeOfFreedom.Z);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.Z));

            SUT.ConstrainNode(node1, DegreeOfFreedom.XX);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.XX));

            SUT.ConstrainNode(node1, DegreeOfFreedom.YY);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.YY));

            SUT.ConstrainNode(node1, DegreeOfFreedom.ZZ);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.ZZ));
        }
        protected void CreateAndStore3DSpringFromOriginTo(double x, double y, double z)
        {
            nodeFactory = new NodeFactory(ModelType.Truss3D);
            start = nodeFactory.Create(0, 0, 0);
            end = nodeFactory.Create(x, y, z);

            elementFactory = new ElementFactory(ModelType.Truss3D);
            this.SUT = elementFactory.CreateLinearConstantSpring(start, end, 1);
        }
Ejemplo n.º 20
0
 public void Setup()
 {
     SUT = new NodeRepository(ModelType.Truss1D);
     nodeFactory = new NodeFactory(ModelType.Truss1D, SUT);
     node1 = nodeFactory.Create(0);
     node2 = nodeFactory.Create(1);
     node3 = nodeFactory.Create(2);
 }
Ejemplo n.º 21
0
 public void Setup()
 {
     SUT = new ForceRepository();
     forceFactory = new ForceFactory(ModelType.Truss1D, SUT);
     exampleForce1 = forceFactory.Create(1);
     exampleForce2 = forceFactory.Create(2);
     nodeFactory = new NodeFactory(ModelType.Truss1D);
     node = nodeFactory.Create(0);
 }