Exemplo n.º 1
0
        /// <summary>
        /// Generates the transposed strain-displacement matrix for the given element
        /// </summary>
        /// <returns></returns>
        public override KeyedRowColumnMatrix <Strain, NodalDegreeOfFreedom> StrainDisplacementMatrix(XYZ locationInLocalCoordinates)
        {
            IList <Strain> supportedDegreesOfFreedom = new List <Strain>(1);

            supportedDegreesOfFreedom.Add(Strain.LinearStrainX);
            IList <NodalDegreeOfFreedom> supportedNodalDegreeOfFreedoms = this.Element.SupportedLocalNodalDegreeOfFreedoms;
            KeyedRowColumnMatrix <Strain, NodalDegreeOfFreedom> strainDisplacementMatrix = new KeyedRowColumnMatrix <Strain, NodalDegreeOfFreedom>(supportedDegreesOfFreedom, supportedNodalDegreeOfFreedoms);

            double originalLength = this.Element.OriginalLength;

            strainDisplacementMatrix.At(Strain.LinearStrainX, new NodalDegreeOfFreedom(this.Element.StartNode, DegreeOfFreedom.X), -1.0 / originalLength);
            strainDisplacementMatrix.At(Strain.LinearStrainX, new NodalDegreeOfFreedom(this.Element.EndNode, DegreeOfFreedom.X), 1.0 / originalLength);

            return(strainDisplacementMatrix);
        }
 private void SetSUTValues(double ax, double ay, double bx, double by, double cx, double cy)
 {
     SUT.At("a", "x", ax);
     SUT.At("a", "y", ay);
     SUT.At("b", "x", bx);
     SUT.At("b", "y", by);
     SUT.At("c", "x", cx);
     SUT.At("c", "y", cy);
 }
Exemplo n.º 3
0
        public static void AssertMatrix <TRowKey, TColumnKey>(KeyedRowColumnMatrix <TRowKey, TColumnKey> actual, int expectedRowCount, int expectedColumnCount, params double[] expectedValues)
        {
            if (expectedValues == null)
            {
                throw new ArgumentNullException("expectedValues");
            }

            if (expectedRowCount * expectedColumnCount != expectedValues.Length)
            {
                throw new ArgumentException(String.Format("You have not provided the correct number of values to check for in the matrix.  " +
                                                          "You provided a expected Row count of {0} and an expected column count of {1}.  " +
                                                          "We would have expected {2} values, but you provided {3}.  The actual matrix has {4} values.\n\r{5}",
                                                          expectedRowCount,
                                                          expectedColumnCount,
                                                          expectedRowCount * expectedColumnCount,
                                                          expectedValues.Length,
                                                          actual.ColumnCount * actual.RowCount,
                                                          actual));
            }

            Assert.IsNotNull(actual);
            Assert.AreEqual(expectedRowCount, actual.RowCount, "RowCount is not correct");
            Assert.AreEqual(expectedColumnCount, actual.ColumnCount, "ColumnCount");

            int currentArrayIndex = 0;

            foreach (TRowKey rowKey in actual.RowKeys)
            {
                foreach (TColumnKey columnKey in actual.ColumnKeys)
                {
                    Assert.AreEqual(expectedValues[currentArrayIndex], actual.At(rowKey, columnKey), 0.0005, String.Format("Row : {0}; Column : {1},\r\n" +
                                                                                                                           "Actual : \r\n" +
                                                                                                                           "{2}", rowKey, columnKey, PrettyPrintKeyedRowColumnMatrix(actual)));
                    currentArrayIndex++;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override KeyedRowColumnMatrix <Strain, NodalDegreeOfFreedom> StrainDisplacementMatrix(XYZ locationInLocalCoordinates)
        {
            IList <Strain> supportedStrains = this.SupportedStrains;
            IList <NodalDegreeOfFreedom> supportedNodalDegreesOfFreedom = this.Element.SupportedLocalNodalDegreeOfFreedoms;
            KeyedRowColumnMatrix <Strain, NodalDegreeOfFreedom> strainDisplacementMatrix = new KeyedRowColumnMatrix <Strain, NodalDegreeOfFreedom>(supportedStrains, supportedNodalDegreesOfFreedom);

            IFiniteElementNode node0 = this.Element.Nodes[0];
            IFiniteElementNode node1 = this.Element.Nodes[1];
            IFiniteElementNode node2 = this.Element.Nodes[2];

            IDictionary <IFiniteElementNode, XYZ> localCoords = this.Element.CalculateLocalPositionsOfNodes();
            XYZ node0Pos = localCoords[node0];
            XYZ node1Pos = localCoords[node1];
            XYZ node2Pos = localCoords[node2];

            double constant = 1.0 / (2.0 * this.Element.Area);

            strainDisplacementMatrix.At(Strain.LinearStrainX, new NodalDegreeOfFreedom(node0, DegreeOfFreedom.X), constant * (node1Pos.Y - node2Pos.Y));
            strainDisplacementMatrix.At(Strain.LinearStrainX, new NodalDegreeOfFreedom(node1, DegreeOfFreedom.X), constant * (node2Pos.Y - node0Pos.Y));
            strainDisplacementMatrix.At(Strain.LinearStrainX, new NodalDegreeOfFreedom(node2, DegreeOfFreedom.X), constant * (node0Pos.Y - node1Pos.Y));

            strainDisplacementMatrix.At(Strain.LinearStrainY, new NodalDegreeOfFreedom(node0, DegreeOfFreedom.Y), constant * (node2Pos.X - node1Pos.X));
            strainDisplacementMatrix.At(Strain.LinearStrainY, new NodalDegreeOfFreedom(node1, DegreeOfFreedom.Y), constant * (node0Pos.X - node2Pos.X));
            strainDisplacementMatrix.At(Strain.LinearStrainY, new NodalDegreeOfFreedom(node2, DegreeOfFreedom.Y), constant * (node1Pos.X - node0Pos.X));

            strainDisplacementMatrix.At(Strain.ShearStrainXY, new NodalDegreeOfFreedom(node0, DegreeOfFreedom.X), constant * (node2Pos.X - node1Pos.X));
            strainDisplacementMatrix.At(Strain.ShearStrainXY, new NodalDegreeOfFreedom(node0, DegreeOfFreedom.Y), constant * (node1Pos.Y - node2Pos.Y));
            strainDisplacementMatrix.At(Strain.ShearStrainXY, new NodalDegreeOfFreedom(node1, DegreeOfFreedom.X), constant * (node0Pos.X - node2Pos.X));
            strainDisplacementMatrix.At(Strain.ShearStrainXY, new NodalDegreeOfFreedom(node1, DegreeOfFreedom.Y), constant * (node2Pos.Y - node0Pos.Y));
            strainDisplacementMatrix.At(Strain.ShearStrainXY, new NodalDegreeOfFreedom(node2, DegreeOfFreedom.X), constant * (node1Pos.X - node0Pos.X));
            strainDisplacementMatrix.At(Strain.ShearStrainXY, new NodalDegreeOfFreedom(node2, DegreeOfFreedom.Y), constant * (node0Pos.Y - node1Pos.Y));

            return(strainDisplacementMatrix);
        }