protected Matrix GetLocalUDerivativeMatrix(Vector previousU, IFiniteElement elementCurrent, double ksi, double eta)
        {
            Matrix derivativeMatrix = GetLocalDerivativeMatrix(elementCurrent, ksi, eta);
            Vector uOnElement       = new Vector(8);

            if (previousU != null)
            {
                for (int i = 0; i < elementCurrent.Count; i++)
                {
                    uOnElement[2 * i]     = previousU[2 * elementCurrent[i].Index];
                    uOnElement[2 * i + 1] = previousU[2 * elementCurrent[i].Index + 1];
                }
            }

            Vector uDerivative       = Matrix.Transpose(derivativeMatrix) * uOnElement;
            double d1u1              = uDerivative[0];
            double d3u3              = uDerivative[1];
            Matrix derivativeUMatrix = new Matrix(4, 4);

            /*derivativeUMatrix[0, 0] = derivativeUMatrix[2, 2] = uDerivative[0];
            *  derivativeUMatrix[1, 1] = derivativeUMatrix[3, 3] = uDerivative[1];
            *  derivativeUMatrix[3, 0] = derivativeUMatrix[1, 2] = uDerivative[2];
            *  derivativeUMatrix[2, 1] = derivativeUMatrix[0, 3] = uDerivative[3];*/
            derivativeUMatrix[0, 0] = (M1 * d1u1 + M2 * d3u3) * 0.5;
            derivativeUMatrix[1, 1] = (M2 * d1u1 + M3 * d3u3) * 0.5;
            derivativeUMatrix[2, 2] = (M2 * d1u1 + M3 * d3u3) * 0.5 + G13 * d1u1;
            derivativeUMatrix[3, 3] = (M1 * d1u1 + M2 * d3u3) * 0.5 + G13 * d3u3;
            derivativeUMatrix[2, 3] = G13 * d3u3;
            derivativeUMatrix[3, 2] = G13 * d1u1;
            return(derivativeUMatrix);
        }
        private Matrix GetLocalDerivativeMatrix(IFiniteElement element, double ksi, double eta)
        {
            Matrix LocalDerivativeMatrix = new Matrix(8, 4);

            Matrix gradNksieta = new Matrix(2, 4);

            gradNksieta[0, 0] = (eta - 1) * 0.25;
            gradNksieta[1, 0] = (ksi - 1) * 0.25;
            gradNksieta[0, 1] = (1 - eta) * 0.25;
            gradNksieta[1, 1] = (-ksi - 1) * 0.25;
            gradNksieta[0, 2] = (eta + 1) * 0.25;
            gradNksieta[1, 2] = (ksi + 1) * 0.25;
            gradNksieta[0, 3] = (-eta - 1) * 0.25;
            gradNksieta[1, 3] = (1 - ksi) * 0.25;

            JacobianRectangular J = new JacobianRectangular();
            J.Element = element;

            Matrix gradN = J.GetInverseJacobian(ksi, eta) * gradNksieta;

            LocalDerivativeMatrix[0, 0] = LocalDerivativeMatrix[1, 3] = gradN[0, 0];
            LocalDerivativeMatrix[2, 0] = LocalDerivativeMatrix[3, 3] = gradN[0, 1];
            LocalDerivativeMatrix[4, 0] = LocalDerivativeMatrix[5, 3] = gradN[0, 2];
            LocalDerivativeMatrix[6, 0] = LocalDerivativeMatrix[7, 3] = gradN[0, 3];

            LocalDerivativeMatrix[1, 1] = LocalDerivativeMatrix[0, 2] = gradN[1, 0];
            LocalDerivativeMatrix[3, 1] = LocalDerivativeMatrix[2, 2] = gradN[1, 1];
            LocalDerivativeMatrix[5, 1] = LocalDerivativeMatrix[4, 2] = gradN[1, 2];
            LocalDerivativeMatrix[7, 1] = LocalDerivativeMatrix[6, 2] = gradN[1, 3];

            return LocalDerivativeMatrix;
        }
        public void Setup()
        {
            mocks = new MockRepository();

            node1 = mocks.StrictMock <IFiniteElementNode>();
            node2 = mocks.StrictMock <IFiniteElementNode>();
            node3 = mocks.StrictMock <IFiniteElementNode>();

            spring1 = mocks.StrictMock <IFiniteElement>();
            spring2 = mocks.StrictMock <IFiniteElement>();

            spring1Calculator = mocks.StrictMock <IElementStiffnessCalculator>();
            spring2Calculator = mocks.StrictMock <IElementStiffnessCalculator>();

            constraintProvider = mocks.StrictMock <IModelConstraintProvider>();

            topologyQueryable = mocks.StrictMock <ITopologyQueryable>();

            elementStiffnessMatrixBuilderFactory = mocks.StrictMock <IElementStiffnessMatrixBuilderFactory>();

            Expect.Call(elementStiffnessMatrixBuilderFactory.Create(spring1))
            .Return(spring1Calculator);
            Expect.Call(elementStiffnessMatrixBuilderFactory.Create(spring2))
            .Return(spring2Calculator);

            SUT = new GlobalModelStiffnessMatrixBuilder(topologyQueryable, constraintProvider, elementStiffnessMatrixBuilderFactory);
        }
Esempio n. 4
0
        private Matrix GetLocalDerivativeMatrix(IFiniteElement element, double ksi, double eta)
        {
            Matrix LocalDerivativeMatrix = new Matrix(8, 4);

            Matrix gradNksieta = new Matrix(2, 4);

            gradNksieta[0, 0] = (eta - 1) * 0.25;
            gradNksieta[1, 0] = (ksi - 1) * 0.25;
            gradNksieta[0, 1] = (1 - eta) * 0.25;
            gradNksieta[1, 1] = (-ksi - 1) * 0.25;
            gradNksieta[0, 2] = (eta + 1) * 0.25;
            gradNksieta[1, 2] = (ksi + 1) * 0.25;
            gradNksieta[0, 3] = (-eta - 1) * 0.25;
            gradNksieta[1, 3] = (1 - ksi) * 0.25;

            JacobianRectangular J = new JacobianRectangular();

            J.Element = element;

            Matrix gradN = J.GetInverseJacobian(ksi, eta) * gradNksieta;

            LocalDerivativeMatrix[0, 0] = LocalDerivativeMatrix[1, 3] = gradN[0, 0];
            LocalDerivativeMatrix[2, 0] = LocalDerivativeMatrix[3, 3] = gradN[0, 1];
            LocalDerivativeMatrix[4, 0] = LocalDerivativeMatrix[5, 3] = gradN[0, 2];
            LocalDerivativeMatrix[6, 0] = LocalDerivativeMatrix[7, 3] = gradN[0, 3];

            LocalDerivativeMatrix[1, 1] = LocalDerivativeMatrix[0, 2] = gradN[1, 0];
            LocalDerivativeMatrix[3, 1] = LocalDerivativeMatrix[2, 2] = gradN[1, 1];
            LocalDerivativeMatrix[5, 1] = LocalDerivativeMatrix[4, 2] = gradN[1, 2];
            LocalDerivativeMatrix[7, 1] = LocalDerivativeMatrix[6, 2] = gradN[1, 3];

            return(LocalDerivativeMatrix);
        }
        protected Matrix GetLocalMassMatrixMatrix(IFiniteElement element)
        {
            elementCurrent = element;

            Matrix localMassMatrix = Integration.GaussianIntegrationMatrix(LocalMassMatrixFunction);

            return localMassMatrix;
        }
        protected Matrix GetLocalMassMatrixMatrix(IFiniteElement element)
        {
            elementCurrent = element;

            Matrix localMassMatrix = Integration.GaussianIntegrationMatrix(LocalMassMatrixFunction);

            return(localMassMatrix);
        }
Esempio n. 7
0
        private Matrix GetLocalMassMatrixMatrix(IFiniteElement element)
        {
            elementCurrent = element;

            Matrix localMassMatrix = _model.Material.Rho * Integration.GaussianIntegrationMatrix(LocalMassMatrixFunction);

            return(localMassMatrix);
        }
Esempio n. 8
0
        private Matrix GetLocalStiffnessMatrix(IFiniteElement element)
        {
            elementCurrent = element;

            Matrix localStiffnessMatrix = Integration.GaussianIntegrationMatrix(LocalStiffnessMatrixFunction);

            return(localStiffnessMatrix);
        }
        private Matrix GetNonlinearLocalTotalVector(IFiniteElement element)
        {
            elementCurrent = element;

            Matrix NonlinearLocalTotalVector = Integration.GaussianIntegrationMatrix(LocalVectorFunction);

            return(NonlinearLocalTotalVector);
        }
Esempio n. 10
0
        private Matrix GetLocalNonlinearMatrix(IFiniteElement element, Vector u)
        {
            elementCurrent = element;
            previousU      = u;

            Matrix localMassMatrix = Integration.GaussianIntegrationMatrix(LocalNonlinearMatrixFunction);

            return(localMassMatrix);
        }
        public static Point TransformCoordinates(Point pointForm, IFiniteElement elementFrom, IFiniteElement elementTo)
        {
            Point res = new Point();
            res.X = elementTo[0].Point.X +
                    ((pointForm.X - elementFrom[0].Point.X) * (elementTo[2].Point.X - elementTo[0].Point.X)) / (elementFrom[2].Point.X - elementFrom[0].Point.X);
            res.Y = elementTo[0].Point.Y +
                    ((pointForm.Y - elementFrom[0].Point.Y) * (elementTo[2].Point.Y - elementTo[0].Point.Y)) / (elementFrom[2].Point.Y - elementFrom[0].Point.Y);

            return res;
        }
        private void CheckElementType(IFiniteElement element)
        {
            bool validElement = element is Hexa8;

            validElement |= element is Hexa8NonLinear;
            if (!(validElement))
            {
                throw new ArgumentException("Host element is not Hexa8 or Hexa8NL.");
            }
        }
Esempio n. 13
0
        public static Point TransformCoordinates(Point pointForm, IFiniteElement elementFrom, IFiniteElement elementTo)
        {
            Point res = new Point();

            res.X = elementTo[0].Point.X +
                    ((pointForm.X - elementFrom[0].Point.X) * (elementTo[2].Point.X - elementTo[0].Point.X)) / (elementFrom[2].Point.X - elementFrom[0].Point.X);
            res.Y = elementTo[0].Point.Y +
                    ((pointForm.Y - elementFrom[0].Point.Y) * (elementTo[2].Point.Y - elementTo[0].Point.Y)) / (elementFrom[2].Point.Y - elementFrom[0].Point.Y);

            return(res);
        }
        private void CheckElementType(IFiniteElement element)
        {
            bool isHexa8 = element.CellType == MSolve.Discretization.Mesh.CellType.Hexa8;

            //bool validElement = element is Hexa8;
            //validElement |= element is Hexa8NonLinear;
            if (!(isHexa8))
            {
                throw new ArgumentException("Host element is not Hexa8 or Hexa8NL.");
            }
        }
 private Vector GetUByElement(IFiniteElement element)
 {
     Vector res = new Vector(8);
     if (U != null)
     {
         for (int i = 0; i < element.Count; i++)
         {
             res[2 * i] = U[2 * element[i].Index];
             res[2 * i + 1] = U[2 * element[i].Index + 1];
         }
     }
     return res;
 }
        private Vector GetUByElement(IFiniteElement element)
        {
            Vector res = new Vector(8);

            if (U != null)
            {
                for (int i = 0; i < element.Count; i++)
                {
                    res[2 * i]     = U[2 * element[i].Index];
                    res[2 * i + 1] = U[2 * element[i].Index + 1];
                }
            }
            return(res);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        private IElementStiffnessCalculator GetElementStiffnessProvider(IFiniteElement element)
        {
            int elementHash = element.GetHashCode();

            // check the cache, and retrieve if available
            if (this.elementStiffnessProviderCache.ContainsKey(elementHash))
            {
                return((IElementStiffnessCalculator)this.elementStiffnessProviderCache[elementHash]);
            }

            IElementStiffnessCalculator builder = this.stiffnessMatrixBuilderFactory.Create(element);

            // store in the cache
            this.elementStiffnessProviderCache.Add(elementHash, builder);
            return(builder);
        }
        /// <summary>
        /// Adds a new finite element to the model.
        /// </summary>
        /// <param name="element">The element type (e.g. continuum element, beam, etc.)</param>
        /// <param name="elementNodes">The element's nodes. Beware of their order.</param>
        public void AddElement(IFiniteElement element, IReadOnlyList <Node> elementNodes)
        {
            int numElementsTotal     = model.Elements.Count;
            int numElementsSubdomain = model.Subdomains[0].Elements.Count;

            var elementWrapper = new Element()
            {
                ID = numElementsTotal, ElementType = element
            };

            foreach (Node node in elementNodes)
            {
                elementWrapper.AddNode(node);
            }
            model.ElementsDictionary.Add(numElementsTotal, elementWrapper);
            model.SubdomainsDictionary[0].Elements.Add(elementWrapper); //TODO: let the user decide which subdomain it will be added to.
        }
        private Matrix GetVariableVectorOnElement(IFiniteElement element, double ksi, double eta)
        {
            Matrix VariableVector = new Matrix(4, 1);
            Vector du             = previousRes.DU(ksi, eta, element);
            double d1u1           = du[0];
            double d3u3           = du[1];
            double d3u1           = du[2];
            double d1u3           = du[3];


            VariableVector[0, 0] = 0.5 * M1 * d1u1 * d1u1 + 0.5 * M1 * d1u3 * d1u3 + 0.5 * M2 * d3u1 * d3u1 + 0.5 * M2 * d3u3 * d3u3;
            VariableVector[1, 0] = 0.5 * M2 * d1u1 * d1u1 + 0.5 * M2 * d1u3 * d1u3 + 0.5 * M3 * d3u1 * d3u1 + 0.5 * M3 * d3u3 * d3u3;
            VariableVector[2, 0] = G13 * (d1u1 * d3u1 + d1u3 * d3u3);
            VariableVector[3, 0] = G13 * (d1u1 * d3u1 + d1u3 * d3u3);

            return(VariableVector);
        }
        public Vector GetResultAtPoint(Point point, double t)
        {
            IFiniteElement element = getElementForPoint(point);
            Vector         result  = null;

            if (element != null)
            {
                FiniteElementRectangle elementKsiTeta = new FiniteElementRectangle()
                {
                    Node1 = new FiniteElementNode(-1, -1),
                    Node3 = new FiniteElementNode(1, 1)
                };
                Point  pointKsiTeta = ResultHelper.TransformCoordinates(point, element, elementKsiTeta);
                Matrix finiteElementApproximationMatrix = getFiniteElementApproximationMatrix(pointKsiTeta);
                result = GetUByElement(element) * (finiteElementApproximationMatrix * Math.Cos(_frequency * t));
            }
            return(result);
        }
        public Vector GetResultAtPoint(Point point, double t)
        {
            IFiniteElement element = getElementForPoint(point);
            Vector         result  = null;

            if (element != null)
            {
                int time = (int)(cutTime(t) / _deltaTime);

                FiniteElementRectangle elementKsiTeta = new FiniteElementRectangle()
                {
                    Node1 = new FiniteElementNode(-1, -1),
                    Node3 = new FiniteElementNode(1, 1)
                };
                Point  pointKsiTeta = ResultHelper.TransformCoordinates(point, element, elementKsiTeta);
                Matrix finiteElementApproximationMatrix = getFiniteElementApproximationMatrix(pointKsiTeta);
                result = GetUByElement(element, U[time]) * finiteElementApproximationMatrix;
            }
            return(result);
        }
Esempio n. 22
0
        private Matrix GetLocalUDerivativeMatrix(Vector previousU, IFiniteElement elementCurrent, double ksi, double eta)
        {
            Matrix derivativeMatrix = GetLocalDerivativeMatrix(elementCurrent, ksi, eta);
            Vector uOnElement       = new Vector(8);

            if (previousU != null)
            {
                for (int i = 0; i < elementCurrent.Count; i++)
                {
                    uOnElement[2 * i]     = previousU[2 * elementCurrent[i].Index];
                    uOnElement[2 * i + 1] = previousU[2 * elementCurrent[i].Index + 1];
                }
            }

            Vector uDerivative       = Matrix.Transpose(derivativeMatrix) * uOnElement;
            Matrix derivativeUMatrix = new Matrix(4, 4);

            derivativeUMatrix[0, 0] = derivativeUMatrix[2, 2] = uDerivative[0];
            derivativeUMatrix[1, 1] = derivativeUMatrix[3, 3] = uDerivative[1];
            derivativeUMatrix[3, 0] = derivativeUMatrix[1, 2] = uDerivative[2];
            derivativeUMatrix[2, 1] = derivativeUMatrix[0, 3] = uDerivative[3];
            return(derivativeUMatrix);
        }
Esempio n. 23
0
        protected Matrix GetLocalDerivativeMatrix(IFiniteElement element, double eta)
        {
            int    n = 12;
            Matrix LocalDerivativeMatrix = new Matrix(n, n);

            int m = 0;

            for (int j = 0; j < n; j++)
            {
                if (j % 2 == 0)
                {
                    LocalDerivativeMatrix[j, m]     = (1 - eta) / 2;
                    LocalDerivativeMatrix[j, m + 6] = (1 + eta) / 2;
                }
                else
                {
                    LocalDerivativeMatrix[j, m]     = 1 / (element[0].Point.X - element[1].Point.X);
                    LocalDerivativeMatrix[j, m + 6] = 1 / (element[1].Point.X - element[0].Point.X);
                    m += 1;
                }
            }

            return(LocalDerivativeMatrix);
        }
        public Vector DU(double ksi, double eta, IFiniteElement element)
        {
            Vector uElement = GetUByElement(element);

            return(uElement * GetLocalDerivativeMatrix(element, ksi, eta));
        }
        private Matrix GetLocalStiffnessMatrix(IFiniteElement element)
        {
            elementCurrent = element;

            Matrix localStiffnessMatrix = Integration.GaussianIntegrationMatrix(LocalStiffnessMatrixFunction);

            return localStiffnessMatrix;
        }
        private Matrix GetLocalMassMatrixMatrix(IFiniteElement element)
        {
            elementCurrent = element;

            Matrix localMassMatrix = _model.Material.Rho * Integration.GaussianIntegrationMatrix(LocalMassMatrixFunction);

            return localMassMatrix;
        }
        private Matrix GetLocalUDerivativeMatrix(Vector previousU, IFiniteElement elementCurrent, double ksi, double eta)
        {
            Matrix derivativeMatrix = GetLocalDerivativeMatrix(elementCurrent, ksi, eta);
            Vector uOnElement = new Vector(8);
            if (previousU != null)
            {
                for (int i = 0; i < elementCurrent.Count; i++)
                {
                    uOnElement[2 * i] = previousU[2 * elementCurrent[i].Index];
                    uOnElement[2 * i + 1] = previousU[2 * elementCurrent[i].Index + 1];
                }
            }

            Vector uDerivative = Matrix.Transpose(derivativeMatrix) * uOnElement;
            Matrix derivativeUMatrix = new Matrix(4, 4);
            derivativeUMatrix[0, 0] = derivativeUMatrix[2, 2] = uDerivative[0];
            derivativeUMatrix[1, 1] = derivativeUMatrix[3, 3] = uDerivative[1];
            derivativeUMatrix[3, 0] = derivativeUMatrix[1, 2] = uDerivative[2];
            derivativeUMatrix[2, 1] = derivativeUMatrix[0, 3] = uDerivative[3];
            return derivativeUMatrix;

        }
        private Matrix GetLocalNonlinearMatrix(IFiniteElement element, Vector u)
        {
            elementCurrent = element;
            previousU = u;

            Matrix localMassMatrix =  Integration.GaussianIntegrationMatrix(LocalNonlinearMatrixFunction);

            return localMassMatrix;
        }
Esempio n. 29
0
        private double UIJ(double alfa1, int shift)
        {
            IFiniteElement e = FindElement(alfa1);

            return(U[6 * e[0].Index + shift] * (e[1].Point.X - alfa1) / (e[1].Point.X - e[0].Point.X) + U[6 * e[1].Index + shift] * (alfa1 - e[0].Point.X) / (e[1].Point.X - e[0].Point.X));
        }
        public void Setup()
        {
            mocks = new MockRepository();

            node1 = mocks.StrictMock<IFiniteElementNode>();
            node2 = mocks.StrictMock<IFiniteElementNode>();
            node3 = mocks.StrictMock<IFiniteElementNode>();

            spring1 = mocks.StrictMock<IFiniteElement>();
            spring2 = mocks.StrictMock<IFiniteElement>();

            spring1Calculator = mocks.StrictMock<IElementStiffnessCalculator>();
            spring2Calculator = mocks.StrictMock<IElementStiffnessCalculator>();

            constraintProvider = mocks.StrictMock<IModelConstraintProvider>();

            topologyQueryable = mocks.StrictMock<ITopologyQueryable>();

            elementStiffnessMatrixBuilderFactory = mocks.StrictMock<IElementStiffnessMatrixBuilderFactory>();

            Expect.Call(elementStiffnessMatrixBuilderFactory.Create(spring1))
                .Return(spring1Calculator);
            Expect.Call(elementStiffnessMatrixBuilderFactory.Create(spring2))
                .Return(spring2Calculator);

            SUT = new GlobalModelStiffnessMatrixBuilder(topologyQueryable, constraintProvider, elementStiffnessMatrixBuilderFactory);
        }
        protected Matrix GetLocalMassMatrix(IFiniteElement element)
        {
            elementCurrent = element;
            //_model.Material.Rho * 
            Matrix localMassMatrix = Integration.GaussianIntegrationMatrix(LocalMassMatrixFunction);

            return localMassMatrix;
        }
        protected Matrix GetLocalDerivativeMatrix(IFiniteElement element, double eta)
        {
            int n = 12;
            Matrix LocalDerivativeMatrix = new Matrix(n, n);

            int m = 0;
            for (int j = 0; j < n; j++)
            {
                if (j % 2 == 0)
                {
                    LocalDerivativeMatrix[j, m] = (1 - eta) / 2;
                    LocalDerivativeMatrix[j, m + 6] = (1 + eta) / 2;
                }
                else
                {
                    LocalDerivativeMatrix[j, m] = 1 / (element[0].Point.X - element[1].Point.X);
                    LocalDerivativeMatrix[j, m + 6] = 1 / (element[1].Point.X - element[0].Point.X);
                    m += 1;
                }
            }

            return LocalDerivativeMatrix;
        }
        private Matrix GetNonlinearLocalTotalVector(IFiniteElement element)
        {
            elementCurrent = element;

            Matrix NonlinearLocalTotalVector = Integration.GaussianIntegrationMatrix(LocalVectorFunction);

            return NonlinearLocalTotalVector;
        }
        private Matrix GetVariableVectorOnElement(IFiniteElement element, double ksi, double eta)
        {
            Matrix VariableVector = new Matrix(4, 1);
            Vector du = previousRes.DU(ksi, eta, element);
            double d1u1 = du[0];
            double d3u3 = du[1];
            double d3u1 = du[2];
            double d1u3 = du[3];


            VariableVector[0, 0] = 0.5 * M1 * d1u1 * d1u1 + 0.5 * M1 * d1u3 * d1u3 + 0.5 * M2 * d3u1 * d3u1 + 0.5 * M2 * d3u3 * d3u3;
            VariableVector[1, 0] = 0.5 * M2 * d1u1 * d1u1 + 0.5 * M2 * d1u3 * d1u3 + 0.5 * M3 * d3u1 * d3u1 + 0.5 * M3 * d3u3 * d3u3;
            VariableVector[2, 0] = G13 * (d1u1 * d3u1 + d1u3 * d3u3);
            VariableVector[3, 0] = G13 * (d1u1 * d3u1 + d1u3 * d3u3);

            return VariableVector;
        }
        protected Matrix GetLocalUDerivativeMatrix(Vector previousU, IFiniteElement elementCurrent, double ksi, double eta)
        {
            Matrix derivativeMatrix = GetLocalDerivativeMatrix(elementCurrent, ksi, eta);
            Vector uOnElement = new Vector(8);
            if (previousU != null)
            {
                for (int i = 0; i < elementCurrent.Count; i++)
                {
                    uOnElement[2 * i] = previousU[2 * elementCurrent[i].Index];
                    uOnElement[2 * i + 1] = previousU[2 * elementCurrent[i].Index + 1];
                }
            }

            Vector uDerivative = Matrix.Transpose(derivativeMatrix) * uOnElement;
            double d1u1 = uDerivative[0];
            double d3u3 = uDerivative[1];
            Matrix derivativeUMatrix = new Matrix(4, 4);
            /*derivativeUMatrix[0, 0] = derivativeUMatrix[2, 2] = uDerivative[0];
            derivativeUMatrix[1, 1] = derivativeUMatrix[3, 3] = uDerivative[1];
            derivativeUMatrix[3, 0] = derivativeUMatrix[1, 2] = uDerivative[2];
            derivativeUMatrix[2, 1] = derivativeUMatrix[0, 3] = uDerivative[3];*/
            derivativeUMatrix[0, 0] = (M1 * d1u1 + M2 * d3u3) * 0.5;
            derivativeUMatrix[1, 1] = (M2 * d1u1 + M3 * d3u3) * 0.5;
            derivativeUMatrix[2, 2] = (M2 * d1u1 + M3 * d3u3) * 0.5 + G13 * d1u1;
            derivativeUMatrix[3, 3] = (M1 * d1u1 + M2 * d3u3) * 0.5 + G13 * d3u3;
            derivativeUMatrix[2, 3] = G13 * d3u3;
            derivativeUMatrix[3, 2] = G13 * d1u1;
            return derivativeUMatrix;

        }
 public Vector DU(double ksi, double eta, IFiniteElement element)
 {
     Vector uElement = GetUByElement(element);
     return uElement * GetLocalDerivativeMatrix(element, ksi, eta);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        private IElementStiffnessCalculator GetElementStiffnessProvider(IFiniteElement element)
        {
            int elementHash = element.GetHashCode();

            // check the cache, and retrieve if available
            if (this.elementStiffnessProviderCache.ContainsKey(elementHash))
            {
                return (IElementStiffnessCalculator)this.elementStiffnessProviderCache[elementHash];
            }

            IElementStiffnessCalculator builder = this.stiffnessMatrixBuilderFactory.Create(element);

            // store in the cache
            this.elementStiffnessProviderCache.Add(elementHash, builder);
            return builder;
        }