Ejemplo n.º 1
0
        /// <inheritdoc />
        public override Matrix GetGlobalStifnessMatrix()
        {
            int[] newOrder;

            UpdateGeoMatrix();

            var E = GetConstitutive();
            var b = GetB(out newOrder);
            var V = Math.Abs(det) / 6;


            var buf = b.Transpose() * E * b;

            buf.MultiplyByConstant(V);

            var currentOrder = new Elo[12];

            for (var i = 0; i < 4; i++)
            {
                currentOrder[3 * i + 0] = new Elo(newOrder[i], DoF.Dx);
                currentOrder[3 * i + 1] = new Elo(newOrder[i], DoF.Dy);
                currentOrder[3 * i + 2] = new Elo(newOrder[i], DoF.Dz);
            }

            var bufEx = ElementPermuteHelper.FullyExpand(buf, currentOrder, 4);

            return(bufEx);
        }
        public override Matrix GetGlobalStifnessMatrix()
        {
            if (nodes[0].Location.Equals(nodes[1].Location))
            {
                var kl = new Matrix(6, 6);

                kl[0, 0]     = kl[1, 1] = kl[2, 2] = kl[3, 3] =
                    kl[4, 4] = kl[5, 5] = _k;

                kl[1, 0]         = kl[0, 1] =
                    kl[2, 3]     = kl[3, 2] =
                        kl[4, 5] = kl[5, 4] = -_k;

                var currentOrder = new ElementPermuteHelper.ElementLocalDof[]
                {
                    new ElementPermuteHelper.ElementLocalDof(0, DoF.Dx),
                    new ElementPermuteHelper.ElementLocalDof(1, DoF.Dx),

                    new ElementPermuteHelper.ElementLocalDof(0, DoF.Dy),
                    new ElementPermuteHelper.ElementLocalDof(1, DoF.Dy),

                    new ElementPermuteHelper.ElementLocalDof(0, DoF.Dz),
                    new ElementPermuteHelper.ElementLocalDof(1, DoF.Dz),
                };

                var kle = ElementPermuteHelper.FullyExpand(kl, currentOrder, 2);

                return(kle);
            }
            else
            {
                var kl = new Matrix(12, 12);//.FromRowColCoreArray(12, 12, baseArr);

                kl[0, 0] = kl[6, 6] = _k;
                kl[6, 0] = kl[0, 6] = -_k;

                var t = CalcUtil.Get2NodeElementTransformationMatrix(EndNode.Location - StartNode.Location);


                return(t.Transpose() * kl * t);
            }


            throw new NotImplementedException();
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public override Matrix GetGlobalStifnessMatrix()
        {
            //step 1 : get points in local system
            //step 2 : get local stiffness matrix
            //step 3 : expand local stiffness matrix
            //step 4 : get global stiffness matrix

            //step 1
            var ls = GetLocalPoints();

            var xs = new double[] { ls[0].X, ls[1].X, ls[2].X };
            var ys = new double[] { ls[0].Y, ls[1].Y, ls[2].Y };

            //step 2
            var kl = DktElement.GetStiffnessMatrix(xs, ys, this._thickness, this.ElasticModulus, this.PoissonRatio);

            //step 3
            var currentOrder = new ElementPermuteHelper.ElementLocalDof[]
            {
                new ElementPermuteHelper.ElementLocalDof(0, DoF.Dz),
                new ElementPermuteHelper.ElementLocalDof(0, DoF.Rx),
                new ElementPermuteHelper.ElementLocalDof(0, DoF.Ry),

                new ElementPermuteHelper.ElementLocalDof(1, DoF.Dz),
                new ElementPermuteHelper.ElementLocalDof(1, DoF.Rx),
                new ElementPermuteHelper.ElementLocalDof(1, DoF.Ry),

                new ElementPermuteHelper.ElementLocalDof(2, DoF.Dz),
                new ElementPermuteHelper.ElementLocalDof(2, DoF.Rx),
                new ElementPermuteHelper.ElementLocalDof(2, DoF.Ry),
            };

            var kle = ElementPermuteHelper.FullyExpand(kl, currentOrder, 3);

            var lambda = GetTransformationMatrix();

            var t = Matrix.DiagonallyRepeat(lambda.Transpose(), 6); // eq. 5-16 page 78 (87 of file)

            //step 4 : get global stiffness matrix
            var buf = t.Transpose() * kle * t; //eq. 5-15 p77

            return(buf);
        }
        public Matrix GetLocalPlateBendingStiffnessMatrix()
        {
            //dkt

            //step 1 : get points in local system
            //step 2 : get local stiffness matrix
            //step 3 : expand local stiffness matrix
            //step 4 : get global stiffness matrix

            //step 1
            var ls = GetLocalPoints();

            var xs = new double[] { ls[0].X, ls[1].X, ls[2].X };
            var ys = new double[] { ls[0].Y, ls[1].Y, ls[2].Y };

            //step 2
            var kl = DktElement.GetStiffnessMatrix(xs, ys, this._thickness, this.ElasticModulus, this.PoissonRatio);

            //step 3
            var currentOrder = new ElementPermuteHelper.ElementLocalDof[]
            {
                new ElementPermuteHelper.ElementLocalDof(0, DoF.Dz),
                new ElementPermuteHelper.ElementLocalDof(0, DoF.Rx),
                new ElementPermuteHelper.ElementLocalDof(0, DoF.Ry),

                new ElementPermuteHelper.ElementLocalDof(1, DoF.Dz),
                new ElementPermuteHelper.ElementLocalDof(1, DoF.Rx),
                new ElementPermuteHelper.ElementLocalDof(1, DoF.Ry),

                new ElementPermuteHelper.ElementLocalDof(2, DoF.Dz),
                new ElementPermuteHelper.ElementLocalDof(2, DoF.Rx),
                new ElementPermuteHelper.ElementLocalDof(2, DoF.Ry),
            };

            var kle = ElementPermuteHelper.FullyExpand(kl, currentOrder, 3);


            return(kle);
        }
        private Matrix GetLocalMembraneStiffnessMatrix()
        {
            //cst

            //step 1 : get points in local system
            //step 2 : get local stiffness matrix
            //step 3 : expand local stiffness matrix
            //step 4 : get global stiffness matrix

            //step 1
            var ls = GetLocalPoints();

            var xs = new[] { ls[0].X, ls[1].X, ls[2].X };
            var ys = new[] { ls[0].Y, ls[1].Y, ls[2].Y };

            //step 2
            var kl = CstElement.GetStiffnessMatrix(xs, ys, this._thickness, this.ElasticModulus, this.PoissonRatio,
                                                   this._formulationType);

            //step 3
            var currentOrder = new[]
            {
                new ElementPermuteHelper.ElementLocalDof(0, DoF.Dx),
                new ElementPermuteHelper.ElementLocalDof(0, DoF.Dy),

                new ElementPermuteHelper.ElementLocalDof(1, DoF.Dx),
                new ElementPermuteHelper.ElementLocalDof(1, DoF.Dy),

                new ElementPermuteHelper.ElementLocalDof(2, DoF.Dx),
                new ElementPermuteHelper.ElementLocalDof(2, DoF.Dy),
            };

            var kle = ElementPermuteHelper.FullyExpand(kl, currentOrder, 3);

            return(kle);
        }
Ejemplo n.º 6
0
        public Matrix GetGlobalStifnessMatrix_old()
        {
            //Code ported from D3_TETRAH.m from fem_toolbox

            UpdateGeoMatrix();


            var J = new Matrix(4, 4);

            for (var i = 0; i < 4; i++)
            {
                J[0, i] = 1;
                J[1, i] = nodes[i].Location.X;
                J[2, i] = nodes[i].Location.Y;
                J[3, i] = nodes[i].Location.Z;
            }

            var detJ = J.Determinant();
            var V    = detJ / 6;

            var Q = detJ * J.Inverse();



            double a1 = a[0]; double b1 = b[0]; double c1 = c[0]; double d1 = d[0];
            double a2 = a[1]; double b2 = b[1]; double c2 = c[1]; double d2 = d[1];
            double a3 = a[2]; double b3 = b[2]; double c3 = c[2]; double d3 = d[2];
            double a4 = a[3]; double b4 = b[3]; double c4 = c[3]; double d4 = d[3];

            var B = new Matrix(6, 12);//transpose of b

            B.FillMatrixRowise(
                b1, 0, 0, b2, 0, 0, b3, 0, 0, b4, 0, 0,
                0, c1, 0, 0, c2, 0, 0, c3, 0, 0, c4, 0,
                0, 0, d1, 0, 0, d2, 0, 0, d3, 0, 0, d4,
                c1, b1, 0, c2, b2, 0, c3, b3, 0, c4, b4, 0,
                0, d1, c1, 0, d2, c2, 0, d3, c3, 0, d4, c4,
                d1, 0, b1, d2, 0, b2, d3, 0, b3, d4, 0, b4);



            B.MultiplyByConstant(1 / (2 * V));

            var miu = this.Nu;
            var s   = (1 - miu);
            var E   = new Matrix(6, 6);

            E.FillMatrixRowise(1, miu / s, miu / s, 0, 0, 0, miu / s, 1, miu / s, 0, 0, 0, miu / s, miu / s, 1, 0, 0, 0, 0, 0, 0,
                               (1 - 2 * miu) / (2 * s), 0, 0, 0, 0, 0, 0, (1 - 2 * miu) / (2 * s), 0, 0, 0, 0, 0, 0, (1 - 2 * miu) / (2 * s));

            E.MultiplyByConstant(this.E * (1 - miu) / ((1 + miu) * (1 - 2 * miu)));

            var buf = B.Transpose() * E * B;

            buf.MultiplyByConstant(V);

            var currentOrder = new Elo[12];

            for (var i = 0; i < 4; i++)
            {
                currentOrder[3 * i + 0] = new Elo(i, DoF.Dx);
                currentOrder[3 * i + 1] = new Elo(i, DoF.Dy);
                currentOrder[3 * i + 2] = new Elo(i, DoF.Dz);
            }


            var bufEx = ElementPermuteHelper.FullyExpand(buf, currentOrder, 4);

            var tmp2 = GetGlobalStifnessMatrix_old();

            return(tmp2);
        }