Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override StiffnessMatrix LocalStiffnessMatrix()
        {
            double stiffness = this.CalculateStiffnessConstant();

            StiffnessMatrix matrix = new StiffnessMatrix(this.Element.SupportedLocalNodalDegreeOfFreedoms);

            matrix.At(this.Element.StartNode, DegreeOfFreedom.X, this.Element.StartNode, DegreeOfFreedom.X, stiffness);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.X, this.Element.EndNode, DegreeOfFreedom.X, -stiffness);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.X, this.Element.StartNode, DegreeOfFreedom.X, -stiffness);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.X, this.Element.EndNode, DegreeOfFreedom.X, stiffness);

            return(matrix);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override StiffnessMatrix LocalStiffnessMatrix()
        {
            double elementVolume = this.Element.Thickness * this.Element.Area;
            KeyedSquareMatrix <Strain> materialMatrix = this.MaterialMatrix;
            KeyedRowColumnMatrix <Strain, NodalDegreeOfFreedom> strainDisplacementMatrix           = this.StrainDisplacementMatrix(null);
            KeyedRowColumnMatrix <NodalDegreeOfFreedom, Strain> transposedStrainDisplacementMatrix = strainDisplacementMatrix.Transpose();

            KeyedRowColumnMatrix <NodalDegreeOfFreedom, Strain> bte = transposedStrainDisplacementMatrix.Multiply <Strain, Strain>(materialMatrix);

            KeyedRowColumnMatrix <NodalDegreeOfFreedom, NodalDegreeOfFreedom> bteb = bte.Multiply <Strain, NodalDegreeOfFreedom>(strainDisplacementMatrix);

            StiffnessMatrix k = new StiffnessMatrix(bteb.Multiply(elementVolume));

            return(k);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns a submatrix of the stiffness matrix.
        /// </summary>
        /// <param name="nodeRowKey">The rows of the returned matrix relate to <see cref="NodalDegreeOfFreedom">NodalDegreeOfFreedoms</see>, where the Node property of these NodalDegreeOfFreedom equals the nodeRowKey</param>
        /// <param name="nodeColumnKey">the node which defines the columns of the submatrix</param>
        /// <returns>A submatrix of the stiffness matrix</returns>
        public StiffnessMatrix SubMatrix(FiniteElementNode nodeRowKey, FiniteElementNode nodeColumnKey)
        {
            // TODO guard against bad parameters
            IList <NodalDegreeOfFreedom> validRowKeys    = this.GetAllRowKeysWithMatchingNode(nodeRowKey);
            IList <NodalDegreeOfFreedom> validColumnKeys = this.GetAllColumnKeysWithMatchingNode(nodeColumnKey);

            StiffnessMatrix result = new StiffnessMatrix(validRowKeys, validColumnKeys);

            foreach (NodalDegreeOfFreedom rowKey in validRowKeys)
            {
                foreach (NodalDegreeOfFreedom columnKey in validColumnKeys)
                {
                    result.At(rowKey, columnKey, this.At(rowKey, columnKey));
                }
            }

            return(result);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override StiffnessMatrix LocalStiffnessMatrix()
        {
            double          length = this.Element.OriginalLength;
            StiffnessMatrix matrix = new StiffnessMatrix(this.Element.SupportedLocalNodalDegreeOfFreedoms);

            double axialStiffness = this.Element.StiffnessEA / length;

            matrix.At(this.Element.StartNode, DegreeOfFreedom.X, this.Element.StartNode, DegreeOfFreedom.X, axialStiffness);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.X, this.Element.EndNode, DegreeOfFreedom.X, -axialStiffness);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.X, this.Element.StartNode, DegreeOfFreedom.X, -axialStiffness);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.X, this.Element.EndNode, DegreeOfFreedom.X, axialStiffness);

            double shearStiffnessInZ = 12.0 * this.Element.BendingStiffnessEIy / (length * length * length);

            matrix.At(this.Element.StartNode, DegreeOfFreedom.Z, this.Element.StartNode, DegreeOfFreedom.Z, shearStiffnessInZ);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.Z, this.Element.EndNode, DegreeOfFreedom.Z, -shearStiffnessInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Z, this.Element.StartNode, DegreeOfFreedom.Z, -shearStiffnessInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Z, this.Element.EndNode, DegreeOfFreedom.Z, shearStiffnessInZ);

            double bendingStiffnessAboutYY = 2.0 * this.Element.BendingStiffnessEIy / length;

            matrix.At(this.Element.StartNode, DegreeOfFreedom.YY, this.Element.StartNode, DegreeOfFreedom.YY, 2.0 * bendingStiffnessAboutYY);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.YY, this.Element.EndNode, DegreeOfFreedom.YY, bendingStiffnessAboutYY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.YY, this.Element.StartNode, DegreeOfFreedom.YY, bendingStiffnessAboutYY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.YY, this.Element.EndNode, DegreeOfFreedom.YY, 2.0 * bendingStiffnessAboutYY);

            double bendingAboutYYShearInZ = 6.0 * this.Element.BendingStiffnessEIy / (length * length);

            matrix.At(this.Element.StartNode, DegreeOfFreedom.Z, this.Element.StartNode, DegreeOfFreedom.YY, -bendingAboutYYShearInZ);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.Z, this.Element.EndNode, DegreeOfFreedom.YY, -bendingAboutYYShearInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Z, this.Element.StartNode, DegreeOfFreedom.YY, bendingAboutYYShearInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Z, this.Element.EndNode, DegreeOfFreedom.YY, bendingAboutYYShearInZ);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.YY, this.Element.StartNode, DegreeOfFreedom.Z, -bendingAboutYYShearInZ);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.YY, this.Element.EndNode, DegreeOfFreedom.Z, bendingAboutYYShearInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.YY, this.Element.StartNode, DegreeOfFreedom.Z, -bendingAboutYYShearInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.YY, this.Element.EndNode, DegreeOfFreedom.Z, bendingAboutYYShearInZ);

            return(matrix);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Prepares and generates the stiffness matrix.
        /// It creates an entirely new matrix from the current set of nodes and the supported degrees of freedom of this element.
        /// It calls the GenerateStiffnessMatrix method which inheriting classes are expected to implement.
        /// It sets the stiffnessMatrixHasBeenGenerated flag to true.
        /// </summary>
        protected StiffnessMatrix BuildGlobalStiffnessMatrix()
        {
            StiffnessMatrix k = this.LocalStiffnessMatrix();
            KeyedSquareMatrix <NodalDegreeOfFreedom> t = this.BuildStiffnessRotationMatrixFromLocalToGlobalCoordinates();

            k = new StiffnessMatrix(t.RowKeys, t.ColumnKeys, k);                                       //pad out local stiffness matrix with zeros so that it is the same size as the rotational matrix
            Guard.AgainstInvalidState(() => { return(!k.Determinant().IsApproximatelyEqualTo(0.0)); }, ///TODO calculating the determinant is computationally intensive.  We should use another method of model verification to speed this up.
                                      "The stiffness matrix for an individual element should be singular and non-invertible. i.e. it should have a zero determinant.  This is not the case for element {0} of type {1}",
                                      this.Element,
                                      this.Element.GetType());

            ////FIXME these multiplications assume the keys of both matrices are ordered and identical
            KeyedSquareMatrix <NodalDegreeOfFreedom> kt            = k.Multiply(t);                  // K*T
            KeyedSquareMatrix <NodalDegreeOfFreedom> ttransposedkt = t.TransposeThisAndMultiply(kt); // (T^)*K*T
            StiffnessMatrix globStiffMat = new StiffnessMatrix(ttransposedkt);

            Guard.AgainstInvalidState(() => { return(!globStiffMat.Determinant().IsApproximatelyEqualTo(0.0)); }, //TODO calculating the determinant is computationally intensive.  We should use another method of model verification to speed this up.
                                      "The global stiffness matrix for an individual element should be singular and non-invertible. i.e. it should have a zero determinant.  This is not the case for element {0} of type {1}",
                                      this.Element,
                                      this.Element.GetType());

            return(globStiffMat);
        }
        /// <summary>
        /// This function iterates through all the elements which provide stiffnesses for the given combination of nodal degree of freedoms
        /// and sums them to provide the total stiffness
        /// </summary>
        /// <param name="rowKeys">The nodal degree of freedoms which represent the rows of the matrix</param>
        /// <param name="columnKeys">The nodal degree of freedoms which represents the columns of the matrix</param>
        /// <returns>A matrix representing the stiffness for these combinations of rows and columns</returns>
        private StiffnessMatrix BuildStiffnessSubMatrix(IList <NodalDegreeOfFreedom> rowKeys, IList <NodalDegreeOfFreedom> columnKeys)
        {
            Guard.AgainstNullArgument(rowKeys, "rowKeys");
            Guard.AgainstNullArgument(columnKeys, "columnKeys");

            int numRows = rowKeys.Count;
            int numCols = columnKeys.Count;

            Guard.AgainstBadArgument(
                "rowKeys",
                () => { return(numRows == 0); },
                "There must be at least one row");
            Guard.AgainstBadArgument(
                "columnKeys",
                () => { return(numCols == 0); },
                "There must be at least one column");

            StiffnessMatrix result = new StiffnessMatrix(rowKeys, columnKeys);

            IList <IFiniteElement> connectedElements;

            foreach (NodalDegreeOfFreedom row in rowKeys)
            {
                foreach (NodalDegreeOfFreedom column in columnKeys)
                {
                    connectedElements = this.parent.AllElementsDirectlyConnecting(row.Node, column.Node);
                    double currentResult = this.SumStiffnessesForAllElementsAt(connectedElements, row, column);
                    if (!currentResult.IsApproximatelyEqualTo(0.0))
                    {
                        result.At(row, column, currentResult);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ElementStiffnessMatrix" /> class.
 /// </summary>
 /// <param name="matrix">The matrix which holds the keys and data to copy into this new matrix</param>
 /// <remarks>Undertakes a deep clone of the data of the matrix, but only a shallow clone of the keys</remarks>
 public StiffnessMatrix(StiffnessMatrix matrix)
     : base(matrix)
 {
     // empty
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ElementStiffnessMatrix" /> class
 /// </summary>
 /// <param name="keysForRows">The keys which will be used to look up rows of this matrix. One unique key is expected per row.</param>
 /// <param name="keysForColumns">The keys which will be used to look up columns of this matrix. One unique key is expected per column.</param>
 /// <param name="matrix">The value to which we assign to each element of the matrix</param>
 public StiffnessMatrix(IList <NodalDegreeOfFreedom> keysForRows, IList <NodalDegreeOfFreedom> keysForColumns, StiffnessMatrix matrix)
     : base(keysForRows, keysForColumns, matrix)
 {
     // empty
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Gets all the column keys which have a Node property which equals the given node
 /// </summary>
 /// <param name="nodeToMatch">The node to match</param>
 /// <returns>A list of all the column keys which have Node properties which equal the given node</returns>
 private IList <NodalDegreeOfFreedom> GetAllColumnKeysWithMatchingNode(FiniteElementNode nodeToMatch)
 {
     return(StiffnessMatrix.GetAllRowKeysWithMatchingNode(this.ColumnKeys, nodeToMatch));
 }
Ejemplo n.º 10
0
        public StiffnessMatrix Add(StiffnessMatrix other)
        {
            KeyedSquareMatrix <NodalDegreeOfFreedom> result = base.Add(other);

            return(new StiffnessMatrix(result));
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override StiffnessMatrix LocalStiffnessMatrix()
        {
            double          length = this.Element.OriginalLength;
            StiffnessMatrix matrix = new StiffnessMatrix(this.Element.SupportedLocalNodalDegreeOfFreedoms);

            double axialStiffness = this.Element.CrossSection.Area * this.Element.Material.YoungsModulus / length;

            matrix.At(this.Element.StartNode, DegreeOfFreedom.X, this.Element.StartNode, DegreeOfFreedom.X, axialStiffness);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.X, this.Element.EndNode, DegreeOfFreedom.X, -axialStiffness);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.X, this.Element.StartNode, DegreeOfFreedom.X, -axialStiffness);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.X, this.Element.EndNode, DegreeOfFreedom.X, axialStiffness);

            double shearStiffnessInY = 12.0 * this.Element.Material.YoungsModulus * this.Element.CrossSection.SecondMomentOfAreaAroundZZ / (length * length * length);

            matrix.At(this.Element.StartNode, DegreeOfFreedom.Y, this.Element.StartNode, DegreeOfFreedom.Y, shearStiffnessInY);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.Y, this.Element.EndNode, DegreeOfFreedom.Y, -shearStiffnessInY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Y, this.Element.StartNode, DegreeOfFreedom.Y, -shearStiffnessInY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Y, this.Element.EndNode, DegreeOfFreedom.Y, shearStiffnessInY);

            double shearStiffnessInZ = 12.0 * this.Element.Material.YoungsModulus * this.Element.CrossSection.SecondMomentOfAreaAroundYY / (length * length * length);

            matrix.At(this.Element.StartNode, DegreeOfFreedom.Z, this.Element.StartNode, DegreeOfFreedom.Z, shearStiffnessInZ);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.Z, this.Element.EndNode, DegreeOfFreedom.Z, -shearStiffnessInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Z, this.Element.StartNode, DegreeOfFreedom.Z, -shearStiffnessInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Z, this.Element.EndNode, DegreeOfFreedom.Z, shearStiffnessInZ);

            double torsionalStiffness = this.Element.Material.ShearModulusElasticity * this.Element.CrossSection.MomentOfInertiaInTorsion / length;

            matrix.At(this.Element.StartNode, DegreeOfFreedom.XX, this.Element.StartNode, DegreeOfFreedom.XX, torsionalStiffness);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.XX, this.Element.EndNode, DegreeOfFreedom.XX, -torsionalStiffness);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.XX, this.Element.StartNode, DegreeOfFreedom.XX, -torsionalStiffness);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.XX, this.Element.EndNode, DegreeOfFreedom.XX, torsionalStiffness);

            double bendingStiffnessAboutYY = 2.0 * this.Element.Material.YoungsModulus * this.Element.CrossSection.SecondMomentOfAreaAroundYY / length;

            matrix.At(this.Element.StartNode, DegreeOfFreedom.YY, this.Element.StartNode, DegreeOfFreedom.YY, 2.0 * bendingStiffnessAboutYY);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.YY, this.Element.EndNode, DegreeOfFreedom.YY, bendingStiffnessAboutYY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.YY, this.Element.StartNode, DegreeOfFreedom.YY, bendingStiffnessAboutYY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.YY, this.Element.EndNode, DegreeOfFreedom.YY, 2.0 * bendingStiffnessAboutYY);

            double bendingStiffnessAboutZZ = 2.0 * this.Element.Material.YoungsModulus * this.Element.CrossSection.SecondMomentOfAreaAroundZZ / length;

            matrix.At(this.Element.StartNode, DegreeOfFreedom.ZZ, this.Element.StartNode, DegreeOfFreedom.ZZ, 2.0 * bendingStiffnessAboutZZ);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.ZZ, this.Element.EndNode, DegreeOfFreedom.ZZ, bendingStiffnessAboutZZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.ZZ, this.Element.StartNode, DegreeOfFreedom.ZZ, bendingStiffnessAboutZZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.ZZ, this.Element.EndNode, DegreeOfFreedom.ZZ, 2.0 * bendingStiffnessAboutZZ);

            double bendingAboutZZshearInY = 6.0 * this.Element.Material.YoungsModulus * this.Element.CrossSection.SecondMomentOfAreaAroundZZ / (length * length);

            matrix.At(this.Element.StartNode, DegreeOfFreedom.Y, this.Element.StartNode, DegreeOfFreedom.ZZ, bendingAboutZZshearInY);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.Y, this.Element.EndNode, DegreeOfFreedom.ZZ, bendingAboutZZshearInY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Y, this.Element.StartNode, DegreeOfFreedom.ZZ, -bendingAboutZZshearInY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Y, this.Element.EndNode, DegreeOfFreedom.ZZ, -bendingAboutZZshearInY);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.ZZ, this.Element.StartNode, DegreeOfFreedom.Y, bendingAboutZZshearInY);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.ZZ, this.Element.EndNode, DegreeOfFreedom.Y, -bendingAboutZZshearInY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.ZZ, this.Element.StartNode, DegreeOfFreedom.Y, bendingAboutZZshearInY);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.ZZ, this.Element.EndNode, DegreeOfFreedom.Y, -bendingAboutZZshearInY);

            double bendingAboutYYShearInZ = 6.0 * this.Element.Material.YoungsModulus * this.Element.CrossSection.SecondMomentOfAreaAroundYY / (length * length);

            matrix.At(this.Element.StartNode, DegreeOfFreedom.Z, this.Element.StartNode, DegreeOfFreedom.YY, -bendingAboutYYShearInZ);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.Z, this.Element.EndNode, DegreeOfFreedom.YY, -bendingAboutYYShearInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Z, this.Element.StartNode, DegreeOfFreedom.YY, bendingAboutYYShearInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.Z, this.Element.EndNode, DegreeOfFreedom.YY, bendingAboutYYShearInZ);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.YY, this.Element.StartNode, DegreeOfFreedom.Z, -bendingAboutYYShearInZ);
            matrix.At(this.Element.StartNode, DegreeOfFreedom.YY, this.Element.EndNode, DegreeOfFreedom.Z, bendingAboutYYShearInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.YY, this.Element.StartNode, DegreeOfFreedom.Z, -bendingAboutYYShearInZ);
            matrix.At(this.Element.EndNode, DegreeOfFreedom.YY, this.Element.EndNode, DegreeOfFreedom.Z, bendingAboutYYShearInZ);

            return(matrix);
        }