Ejemplo n.º 1
0
        public double[] CreateInternalGlobalForcesVector()
        {
            double ksi1 = ClosestPointProjection();

            if (Math.Abs(ksi1) <= 1.05)
            {
                Tuple <double[, ], double[, ]> positionMatrices = CalculatePositionMatrix(ksi1);
                double[,] aMatrix  = positionMatrices.Item1;
                double[,] daMatrix = positionMatrices.Item2;

                Tuple <double[], double, double[]> surfaceCharacteristics = SurfaceGeometry(daMatrix);
                double   m11  = surfaceCharacteristics.Item2;
                double[] n    = surfaceCharacteristics.Item3;
                double   ksi3 = CalculateNormalGap(aMatrix, n);
                if (ksi3 <= 0)
                {
                    double[,] AT = MatrixOperations.Transpose(aMatrix);
                    double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n);
                    double[] internalGlobalForcesVector = VectorOperations.VectorScalarProductNew(AT_n, PenaltyFactor * ksi3);
                    return(internalGlobalForcesVector);
                }
                else
                {
                    double[] internalGlobalForcesVector = new double[6];
                    return(internalGlobalForcesVector);
                }
            }
            else
            {
                double[] internalGlobalForcesVector = new double[6];
                return(internalGlobalForcesVector);
            }
        }
Ejemplo n.º 2
0
        private double[,] RotationalStiffnessPart(double penaltyFactor, double[] normalVector, double[,] aMatrix, double[,] a1Matrix, double[,] a2Matrix, List <double[]> dRho, double ksi3)
        {
            double[,] m    = MetricTensor(dRho);
            double[,] mInv = InverseMetricTensor(m);

            double scalar1 = penaltyFactor * ksi3 * mInv[0, 0];
            double scalar2 = penaltyFactor * ksi3 * mInv[1, 0];
            double scalar3 = penaltyFactor * ksi3 * mInv[0, 1];
            double scalar4 = penaltyFactor * ksi3 * mInv[1, 1];

            double[,] mat11 = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(a1Matrix), MatrixOperations.MatrixProduct(VectorOperations.VectorVectorTensorProduct(normalVector, dRho[0]), aMatrix));
            double[,] mat12 = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(aMatrix), MatrixOperations.MatrixProduct(VectorOperations.VectorVectorTensorProduct(dRho[0], normalVector), a1Matrix));
            double[,] mat21 = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(a1Matrix), MatrixOperations.MatrixProduct(VectorOperations.VectorVectorTensorProduct(normalVector, dRho[1]), aMatrix));
            double[,] mat22 = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(aMatrix), MatrixOperations.MatrixProduct(VectorOperations.VectorVectorTensorProduct(dRho[0], normalVector), a2Matrix));
            double[,] mat31 = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(a2Matrix), MatrixOperations.MatrixProduct(VectorOperations.VectorVectorTensorProduct(normalVector, dRho[0]), aMatrix));
            double[,] mat32 = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(aMatrix), MatrixOperations.MatrixProduct(VectorOperations.VectorVectorTensorProduct(dRho[1], normalVector), a1Matrix));
            double[,] mat41 = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(a2Matrix), MatrixOperations.MatrixProduct(VectorOperations.VectorVectorTensorProduct(normalVector, dRho[1]), aMatrix));
            double[,] mat42 = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(aMatrix), MatrixOperations.MatrixProduct(VectorOperations.VectorVectorTensorProduct(dRho[1], normalVector), a2Matrix));

            double[,] mat1 = MatrixOperations.MatrixAddition(mat11, mat12);
            double[,] mat2 = MatrixOperations.MatrixAddition(mat21, mat22);
            double[,] mat3 = MatrixOperations.MatrixAddition(mat31, mat32);
            double[,] mat4 = MatrixOperations.MatrixAddition(mat41, mat42);

            double[,] Kr = MatrixOperations.MatrixAddition(MatrixOperations.MatrixAddition(MatrixOperations.MatrixAddition(MatrixOperations.ScalarMatrixProductNew(scalar1, mat1),
                                                                                                                           MatrixOperations.ScalarMatrixProductNew(scalar2, mat2)),
                                                                                           MatrixOperations.ScalarMatrixProductNew(scalar3, mat3)),
                                                           MatrixOperations.ScalarMatrixProductNew(scalar4, mat4));
            return(Kr);
        }
Ejemplo n.º 3
0
        public double[] CreateInternalGlobalForcesVector()
        {
            double[] ksiVector = Project(new double[2]);
            if (Math.Abs(ksiVector[0]) <= 1.05 && ksiVector[1] <= 1.05)
            {
                Tuple <double[, ], double[, ], double[, ]> aMatrices = CalculatePositionMatrix(ksiVector[0], ksiVector[1]);
                List <double[]> dRho = SurfaceVectors(ksiVector[0], ksiVector[1]);
                double[,] m = MetricTensor(dRho);
                double[] n        = NormalVector(m, dRho);
                double[] xUpdated = xUpdatedVector();
                double   ksi3     = CalculatePenetration(n, aMatrices.Item1, xUpdated);

                if (ksi3 <= 0)
                {
                    double[,] AT = MatrixOperations.Transpose(aMatrices.Item1);
                    double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n);
                    double[] internalGlobalForcesVector = VectorOperations.VectorScalarProductNew(AT_n, PenaltyFactor * ksi3);
                    return(internalGlobalForcesVector);
                }
                else
                {
                    return(new double[15]);
                }
            }
            else
            {
                return(new double[15]);
            }
        }
Ejemplo n.º 4
0
        public double[] CreateInternalGlobalForcesVector()
        {
            int nodesNumber = Properties.MasterSegmentPolynomialDegree + Properties.SlaveSegmentPolynomialDegree + 2;

            double[] internalGlobalForcesVector = new double[2 * nodesNumber];
            for (int i = 0; i < Properties.IntegrationPoints; i++)
            {
                double ksi2 = GaussPoints(i).Item1;
                double gW   = GaussPoints(i).Item2;
                double ksi1 = Project(0.0, ksi2);
                if (Math.Abs(ksi1) <= 1.05)
                {
                    Tuple <double[, ], double[, ], double[, ], double[, ], double[, ]> positionMatrices = CalculatePositionMatrix(ksi1, ksi2);
                    double[,] aMatrix   = positionMatrices.Item1;
                    double[,] daMatrix  = positionMatrices.Item2;
                    double[,] da2Matrix = positionMatrices.Item3;

                    Tuple <double[], double, double[], double[], double> surfaceCharacteristics = MasterSegmentGeometry(daMatrix, da2Matrix);
                    double[] n    = surfaceCharacteristics.Item3;
                    double   ksi3 = CalculatePenetration(aMatrix, n);
                    if (ksi3 <= 0)
                    {
                        double slaveMetricTensor = SlaveSegmentGeometry(positionMatrices.Item4, positionMatrices.Item5).Item2;
                        double scalar            = Math.Pow(slaveMetricTensor, 0.5) * gW;
                        double[,] AT = MatrixOperations.Transpose(aMatrix);
                        double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n);
                        double[] internalLocalForcesVector = VectorOperations.VectorScalarProductNew(VectorOperations.VectorScalarProductNew(AT_n, PenaltyFactor * ksi3), scalar);
                        internalGlobalForcesVector = VectorOperations.VectorVectorAddition(internalGlobalForcesVector, internalLocalForcesVector);
                    }
                }
            }
            return(internalGlobalForcesVector);
        }
Ejemplo n.º 5
0
        public double[] CreateInternalGlobalForcesVector()
        {
            double penetration = CalculateNormalGap();

            if (penetration <= 0)
            {
                double[,] A  = CalculatePositionMatrix();
                double[,] AT = MatrixOperations.Transpose(A);
                double[] n                    = CalculateNormalUnitVector();
                double[] t                    = CalculateTangentUnitVector();
                double[] AT_n                 = VectorOperations.MatrixVectorProduct(AT, n);
                double[] AT_t                 = VectorOperations.MatrixVectorProduct(AT, t);
                double   ksi                  = CalculateNormalGap();
                double   Tr                   = CalculateTangentialTraction();
                double[] ksi_AT_n             = VectorOperations.VectorScalarProductNew(AT_n, ksi);
                double[] e_ksi_AT_n           = VectorOperations.VectorScalarProductNew(ksi_AT_n, PenaltyFactor);
                double[] Tr_AT_t              = VectorOperations.VectorScalarProductNew(AT_t, Tr);
                double[] internalForcesvector = VectorOperations.VectorVectorAddition(e_ksi_AT_n, Tr_AT_t);
                return(internalForcesvector);
            }
            else
            {
                double[] internalGlobalForcesVector = new double[4];
                return(internalGlobalForcesVector);
            }
        }
Ejemplo n.º 6
0
 public override double[] Solve(double[,] stiffnessMatrix, double[] forceVector)
 {
     double[,] lowerMatrix = Cholesky(stiffnessMatrix);
     double[,] upperMatrix = MatrixOperations.Transpose(lowerMatrix);
     double[] intermediateVector = ForwardSubstitution(lowerMatrix, forceVector);
     double[] solutionuberVector = BackSubstitution(upperMatrix, intermediateVector);
     return(solutionuberVector);
 }
Ejemplo n.º 7
0
        private double CalculatePenetration(double[] normalVector, double[,] aMatrix, double[] xUpdated)
        {
            double ksi3 = VectorOperations.VectorDotProduct(
                xUpdated, VectorOperations.MatrixVectorProduct(
                    MatrixOperations.Transpose(aMatrix), normalVector));

            return(ksi3);
        }
Ejemplo n.º 8
0
        public double[,] CreateGlobalStiffnessMatrix()
        {
            double[,] globalStiffnessMatrix = new double[6, 6];
            //double E = Properties.YoungMod;
            //double A = Properties.SectionArea;
            //double I = Properties.MomentOfInertia;
            //double L = CalculateElementLength();
            //double c = CalculateElementCosinus();
            //double s = CalculateElementSinus();
            //globalStiffnessMatrix[0, 0] = (12 * E * I * s * s / Math.Pow(L, 3)) + (A * E * c * c / L);
            //globalStiffnessMatrix[0, 1] = (A * E * c * s / L) - (12 * E * I * c * s / Math.Pow(L, 3));
            //globalStiffnessMatrix[0, 2] = -6 * E * I * s / Math.Pow(L, 2);
            //globalStiffnessMatrix[0, 3] = (-12 * E * I * s * s / Math.Pow(L, 3)) - (A * E * c * c / L);
            //globalStiffnessMatrix[0, 4] = (12 * E * I * c * s / Math.Pow(L, 3)) - (A * E * c * s / L);
            //globalStiffnessMatrix[0, 5] = -6 * E * I * s / Math.Pow(L, 2);

            //globalStiffnessMatrix[1, 0] = globalStiffnessMatrix[0, 1];
            //globalStiffnessMatrix[1, 1] = (A * E * s * s / L) + (12 * E * I * c * c / Math.Pow(L, 3));
            //globalStiffnessMatrix[1, 2] = 6 * E * I * c / Math.Pow(L, 2);
            //globalStiffnessMatrix[1, 3] = (12 * E * I * c * s / Math.Pow(L, 3)) - (A * E * c * s / L);
            //globalStiffnessMatrix[1, 4] = -(A * E * s * s / L) - (12 * E * I * c * c / Math.Pow(L, 3));
            //globalStiffnessMatrix[1, 5] = 6 * E * I * c / Math.Pow(L, 2);

            //globalStiffnessMatrix[2, 0] = globalStiffnessMatrix[0, 2];
            //globalStiffnessMatrix[2, 1] = globalStiffnessMatrix[1, 2];
            //globalStiffnessMatrix[2, 2] = 4 * E * I / L;
            //globalStiffnessMatrix[2, 3] = 6 * E * I * s / Math.Pow(L, 2);
            //globalStiffnessMatrix[2, 4] = -6 * E * I * c / Math.Pow(L, 2);
            //globalStiffnessMatrix[2, 5] = 2 * E * I / L;

            //globalStiffnessMatrix[3, 0] = globalStiffnessMatrix[0, 3];
            //globalStiffnessMatrix[3, 1] = globalStiffnessMatrix[1, 3];
            //globalStiffnessMatrix[3, 2] = globalStiffnessMatrix[2, 3];
            //globalStiffnessMatrix[3, 3] = (12 * E * I * s * s / Math.Pow(L, 3)) + (A * E * c * c / L);
            //globalStiffnessMatrix[3, 4] = (A * E * c * s / L) - (12 * E * I * c * s / Math.Pow(L, 3));
            //globalStiffnessMatrix[3, 5] = 6 * E * I * s / Math.Pow(L, 2);

            //globalStiffnessMatrix[4, 0] = globalStiffnessMatrix[0, 4];
            //globalStiffnessMatrix[4, 1] = globalStiffnessMatrix[1, 4];
            //globalStiffnessMatrix[4, 2] = globalStiffnessMatrix[2, 4];
            //globalStiffnessMatrix[4, 3] = globalStiffnessMatrix[3, 4];
            //globalStiffnessMatrix[4, 4] = (A * E * s * s / L) + (12 * E * I * c * c / Math.Pow(L, 3));
            //globalStiffnessMatrix[4, 5] = -6 * E * I * c / Math.Pow(L, 2);

            //globalStiffnessMatrix[5, 0] = globalStiffnessMatrix[0, 5];
            //globalStiffnessMatrix[5, 1] = globalStiffnessMatrix[1, 5];
            //globalStiffnessMatrix[5, 2] = globalStiffnessMatrix[2, 5];
            //globalStiffnessMatrix[5, 3] = globalStiffnessMatrix[3, 5];
            //globalStiffnessMatrix[5, 4] = globalStiffnessMatrix[4, 5];
            //globalStiffnessMatrix[5, 5] = 4 * E * I / L;
            double[,] lambda              = CreateLambdaMatrix();
            double[,] localStiff          = CreateLocalStiffnessMatrix();
            double[,] transposeLocalStiff = MatrixOperations.Transpose(lambda);
            double[,] KxL         = MatrixOperations.MatrixProduct(localStiff, lambda);
            globalStiffnessMatrix = MatrixOperations.MatrixProduct(transposeLocalStiff, KxL);

            return(globalStiffnessMatrix);
        }
Ejemplo n.º 9
0
 private double[,] MainStiffnessPart(double penaltyFactor, double[] normalVector, double[,] aMatrix)
 {
     double[,] nxn    = VectorOperations.VectorVectorTensorProduct(normalVector, normalVector);
     double[,] aT     = MatrixOperations.Transpose(aMatrix);
     double[,] nxna   = MatrixOperations.MatrixProduct(nxn, aMatrix);
     double[,] aTnxna = MatrixOperations.MatrixProduct(aT, nxna);
     double[,] Kmain  = MatrixOperations.ScalarMatrixProductNew(penaltyFactor, aTnxna);
     return(Kmain);
 }
Ejemplo n.º 10
0
        private double CalculatePenetration(double[,] aMatrix, double[] n)
        {
            double[,] AT = MatrixOperations.Transpose(aMatrix);
            double[] AT_n      = VectorOperations.MatrixVectorProduct(AT, n);
            double[] xupd      = NodalXUpdated();
            double   normalGap = VectorOperations.VectorDotProduct(xupd, AT_n);

            return(normalGap);
        }
Ejemplo n.º 11
0
        private double[,] CalculateMainStiffnessPart(double ksi1, double[] n)
        {
            double[,] mainStiffnessMatrix = new double[6, 6];
            double N1 = 1.0 / 2.0 * (1.0 - ksi1);
            double N2 = 1.0 / 2.0 * (1.0 + ksi1);
            Tuple <double[, ], double[, ]> positionMatrices = CalculatePositionMatrix(ksi1);

            double[,] A         = positionMatrices.Item1;
            double[,] nxn       = VectorOperations.VectorVectorTensorProduct(n, n);
            double[,] nxn_A     = MatrixOperations.MatrixProduct(nxn, A);
            double[,] AT_nxn_A  = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(A), nxn_A);
            mainStiffnessMatrix = MatrixOperations.ScalarMatrixProductNew(PenaltyFactor, AT_nxn_A);
            //mainStiffnessMatrix[0, 0] = N1 * N1 * n[0] * n[0] * PenaltyFactor;
            //mainStiffnessMatrix[0, 1] = N1 * N1 * n[0] * n[1] * PenaltyFactor;
            //mainStiffnessMatrix[0, 2] = N1 * N2 * n[0] * n[0] * PenaltyFactor;
            //mainStiffnessMatrix[0, 3] = N1 * N1 * n[0] * n[1] * PenaltyFactor;
            //mainStiffnessMatrix[0, 4] = -N1 * n[0] * n[0] * PenaltyFactor;
            //mainStiffnessMatrix[0, 5] = -N1 * n[0] * n[1] * PenaltyFactor;

            //mainStiffnessMatrix[1, 0] = mainStiffnessMatrix[0, 1];
            //mainStiffnessMatrix[1, 1] = N1 * N1 * n[1] * n[1] * PenaltyFactor;
            //mainStiffnessMatrix[1, 2] = N1 * N2 * n[0] * n[1] * PenaltyFactor;
            //mainStiffnessMatrix[1, 3] = N1 * N2 * n[1] * n[1] * PenaltyFactor;
            //mainStiffnessMatrix[1, 4] = -N1 * n[0] * n[1] * PenaltyFactor;
            //mainStiffnessMatrix[1, 5] = -N1 * n[1] * n[1] * PenaltyFactor;

            //mainStiffnessMatrix[2, 0] = mainStiffnessMatrix[0, 2];
            //mainStiffnessMatrix[2, 1] = mainStiffnessMatrix[1, 2];
            //mainStiffnessMatrix[2, 2] = N2 * N2 * n[0] * n[0] * PenaltyFactor;
            //mainStiffnessMatrix[2, 3] = N2 * N2 * n[0] * n[1] * PenaltyFactor;
            //mainStiffnessMatrix[2, 4] = -N2 * n[0] * n[0] * PenaltyFactor;
            //mainStiffnessMatrix[2, 5] = -N2 * n[0] *n[1] * PenaltyFactor;

            //mainStiffnessMatrix[3, 0] = mainStiffnessMatrix[0, 3];
            //mainStiffnessMatrix[3, 1] = mainStiffnessMatrix[1, 3];
            //mainStiffnessMatrix[3, 2] = mainStiffnessMatrix[2, 3];
            //mainStiffnessMatrix[3, 3] = N2 * N2 * n[1] * n[1] * PenaltyFactor;
            //mainStiffnessMatrix[3, 4] = -N2 * n[0] * n[1] * PenaltyFactor;
            //mainStiffnessMatrix[3, 5] = -N2 * n[1] * n[1] * PenaltyFactor;

            //mainStiffnessMatrix[4, 0] = mainStiffnessMatrix[0, 4];
            //mainStiffnessMatrix[4, 1] = mainStiffnessMatrix[1, 4];
            //mainStiffnessMatrix[4, 2] = mainStiffnessMatrix[2, 4];
            //mainStiffnessMatrix[4, 3] = mainStiffnessMatrix[3, 4];
            //mainStiffnessMatrix[4, 4] = n[0] * n[0] * PenaltyFactor;
            //mainStiffnessMatrix[4, 5] = n[0] * n[1] * PenaltyFactor;

            //mainStiffnessMatrix[5, 0] = mainStiffnessMatrix[0, 5];
            //mainStiffnessMatrix[5, 1] = mainStiffnessMatrix[1, 5];
            //mainStiffnessMatrix[5, 2] = mainStiffnessMatrix[2, 5];
            //mainStiffnessMatrix[5, 3] = mainStiffnessMatrix[3, 5];
            //mainStiffnessMatrix[5, 4] = mainStiffnessMatrix[4, 5];
            //mainStiffnessMatrix[5, 5] = n[1] * n[1] * PenaltyFactor;
            return(mainStiffnessMatrix);
        }
Ejemplo n.º 12
0
 private double[,] CalculateTangentialStiffnessMatrixForStick()
 {
     double[] t = CalculateTangentUnitVector();
     double[,] A        = CalculatePositionMatrix();
     double[,] AT       = MatrixOperations.Transpose(A);
     double[,] txt      = VectorOperations.VectorVectorTensorProduct(t, t);
     double[,] txt_A    = MatrixOperations.MatrixProduct(txt, A);
     double[,] AT_txt_A = MatrixOperations.MatrixProduct(AT, txt_A);
     double[,] tangentialStiffnessMatrix = MatrixOperations.ScalarMatrixProductNew(-PenaltyFactor, AT_txt_A);
     return(tangentialStiffnessMatrix);
 }
Ejemplo n.º 13
0
 private double[,] CalculateNormalStiffnessMatrix()
 {
     double[] n = CalculateNormalUnitVector();
     double[,] A        = CalculatePositionMatrix();
     double[,] AT       = MatrixOperations.Transpose(A);
     double[,] nxn      = VectorOperations.VectorVectorTensorProduct(n, n);
     double[,] nxn_A    = MatrixOperations.MatrixProduct(nxn, A);
     double[,] AT_nxn_A = MatrixOperations.MatrixProduct(AT, nxn_A);
     double[,] globalStiffnessMatrix = MatrixOperations.ScalarMatrixProductNew(PenaltyFactor, AT_nxn_A);
     return(globalStiffnessMatrix);
 }
Ejemplo n.º 14
0
        private double CalculateTangentialTraction()
        {
            double[,] A  = CalculatePositionMatrix();
            double[,] AT = MatrixOperations.Transpose(A);
            double[] displacementVector = DisplacementVector;
            double[] tangentUnitvector  = CalculateTangentUnitVector();
            double[] aT_t               = VectorOperations.MatrixVectorProduct(AT, tangentUnitvector);
            double   tangentGap         = VectorOperations.VectorDotProduct(displacementVector, aT_t);
            double   tangentialTraction = -PenaltyFactor * tangentGap;

            return(tangentialTraction);
        }
Ejemplo n.º 15
0
        private double[,] CalculateMainStiffnessPart(double ksi1, double[] n)
        {
            double[,] mainStiffnessMatrix = new double[8, 8];
            Tuple <double[, ], double[, ], double[, ]> positionMatrices = CalculatePositionMatrix(ksi1);

            double[,] A         = positionMatrices.Item1;
            double[,] nxn       = VectorOperations.VectorVectorTensorProduct(n, n);
            double[,] nxn_A     = MatrixOperations.MatrixProduct(nxn, A);
            double[,] AT_nxn_A  = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(A), nxn_A);
            mainStiffnessMatrix = MatrixOperations.ScalarMatrixProductNew(PenaltyFactor, AT_nxn_A);
            return(mainStiffnessMatrix);
        }
Ejemplo n.º 16
0
        private double[,] CalculateMainStiffnessPart(double ksi1, double ksi2, double[] n)
        {
            int numberOfNodes = Properties.MasterSegmentPolynomialDegree + Properties.SlaveSegmentPolynomialDegree + 2;

            double[,] mainStiffnessMatrix = new double[2 * numberOfNodes, 2 * numberOfNodes];
            Tuple <double[, ], double[, ], double[, ], double[, ], double[, ]> positionMatrices = CalculatePositionMatrix(ksi1, ksi2);

            double[,] A         = positionMatrices.Item1;
            double[,] nxn       = VectorOperations.VectorVectorTensorProduct(n, n);
            double[,] nxn_A     = MatrixOperations.MatrixProduct(nxn, A);
            double[,] AT_nxn_A  = MatrixOperations.MatrixProduct(MatrixOperations.Transpose(A), nxn_A);
            mainStiffnessMatrix = MatrixOperations.ScalarMatrixProductNew(PenaltyFactor, AT_nxn_A);
            return(mainStiffnessMatrix);
        }
Ejemplo n.º 17
0
        private double[,] CalculateCurvatureStiffnessPart(double[,] A, double ksi3, double m11, double[] dRho, double h11)
        {
            double coef = PenaltyFactor * ksi3 * m11 * h11;

            double[,] curvaturePart;
            double[,] dRho_x_dRho = VectorOperations.VectorVectorTensorProduct(dRho, dRho);
            double[,] Matrix      = MatrixOperations.MatrixProduct(
                MatrixOperations.Transpose(A),
                MatrixOperations.MatrixProduct(dRho_x_dRho, A)
                );
            curvaturePart = MatrixOperations.ScalarMatrixProductNew(
                coef,
                Matrix
                );
            return(curvaturePart);
        }
Ejemplo n.º 18
0
        private double CalculateNormalGap(double[,] aMatrix, double[] n)
        {
            double[,] AT = MatrixOperations.Transpose(aMatrix);
            double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n);
            double[] xupd = new double[] {
                Nodes[1].XCoordinate + DisplacementVector[0],
                Nodes[1].YCoordinate + DisplacementVector[1],
                Nodes[2].XCoordinate + DisplacementVector[2],
                Nodes[2].YCoordinate + DisplacementVector[3],
                Nodes[3].XCoordinate + DisplacementVector[4],
                Nodes[3].YCoordinate + DisplacementVector[5]
            };
            double normalGap = VectorOperations.VectorDotProduct(xupd, AT_n);

            return(normalGap);
        }
Ejemplo n.º 19
0
        private double CalculateNormalGap()
        {
            double[,] A  = CalculatePositionMatrix();
            double[,] AT = MatrixOperations.Transpose(A);
            double[] n    = CalculateNormalUnitVector();
            double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n);
            double[] xupd = new double[] {
                Nodes[1].XCoordinate + DisplacementVector[0],
                Nodes[1].YCoordinate + DisplacementVector[1],
                Nodes[2].XCoordinate + DisplacementVector[2],
                Nodes[2].YCoordinate + DisplacementVector[3]
            };
            double normalGap = VectorOperations.VectorDotProduct(xupd, AT_n);

            return(normalGap);
        }
Ejemplo n.º 20
0
        private double[,] CalculateTangentialStiffnessMatrixForSlip(double tangentialTraction)
        {
            double Tr = tangentialTraction;

            double[] t = CalculateTangentUnitVector();
            double[] n = CalculateNormalUnitVector();
            double[,] A        = CalculatePositionMatrix();
            double[,] AT       = MatrixOperations.Transpose(A);
            double[,] txn      = VectorOperations.VectorVectorTensorProduct(t, n);
            double[,] txn_A    = MatrixOperations.MatrixProduct(txn, A);
            double[,] AT_txn_A = MatrixOperations.MatrixProduct(AT, txn_A);
            double scalarFactor = -FrictionCoef * PenaltyFactor * (Tr / Math.Abs(Tr));

            double[,] tangentialStiffnessMatrix = MatrixOperations.ScalarMatrixProductNew(scalarFactor, AT_txn_A);
            return(tangentialStiffnessMatrix);
        }
Ejemplo n.º 21
0
        private double CalculatePenetration(double ksi1, double ksi2)
        {
            double[]        xUpdated = xUpdatedVector();
            List <double[]> dRho     = SurfaceVectors(ksi1, ksi2);

            double[,] m = MetricTensor(dRho);
            double[] n = NormalVector(m, dRho);
            Tuple <double[, ], double[, ], double[, ]> aMatrices = CalculatePositionMatrix(ksi1, ksi2);

            double[,] a  = aMatrices.Item1;
            double[,] aT = MatrixOperations.Transpose(a);
            double ksi3 = VectorOperations.VectorDotProduct(
                xUpdated, VectorOperations.MatrixVectorProduct(
                    aT, n));

            return(ksi3);
        }
Ejemplo n.º 22
0
        public double[] CreateInternalGlobalForcesVector()
        {
            double[,] globalStiffnessMatrix = new double[6, 6];
            double[,] lambda              = CreateLambdaMatrix();
            double[,] localStiff          = CreateLocalStiffnessMatrix();
            double[,] transposeLocalStiff = MatrixOperations.Transpose(lambda);
            double[,] KxL         = MatrixOperations.MatrixProduct(localStiff, lambda);
            globalStiffnessMatrix = MatrixOperations.MatrixProduct(transposeLocalStiff, KxL);
            double[] stiffPart = VectorOperations.MatrixVectorProduct(globalStiffnessMatrix, DisplacementVector);

            //if (AccelerationVector != null)
            //{
            //    double[,] globalMassMatrix = CreateMassMatrix();
            //    double[] massPart = VectorOperations.MatrixVectorProduct(globalMassMatrix, VectorOperations.VectorScalarProductNew(AccelerationVector, 1.0));
            //    stiffPart = VectorOperations.VectorVectorAddition(stiffPart, massPart);
            //}
            return(stiffPart);
        }
Ejemplo n.º 23
0
 public double[,] CreateMassMatrix()
 {
     double[,] lambda = CreateLambdaMatrix();
     double[,] localMassMatrix;
     if (ActivateLumbedMassMatrix == true)
     {
         localMassMatrix = CreateLumpedMassMatrix();
     }
     else
     {
         localMassMatrix = CreateConsistentMassMatrix();
     }
     double[,] globalMassMatrix = MatrixOperations.MatrixProduct
                                  (
         MatrixOperations.Transpose(lambda), MatrixOperations.MatrixProduct(localMassMatrix, lambda)
                                  );
     return(globalMassMatrix);
 }
Ejemplo n.º 24
0
        private double[,] CalculateRotationalStiffnessPart(double[,] A, double[,] dA, double[] n, double ksi3, double m11, double[] dRho)
        {
            double coef = PenaltyFactor * ksi3 * m11;

            double[,] rotationalPart;
            double[,] n_x_dRho  = VectorOperations.VectorVectorTensorProduct(n, dRho);
            double[,] dRho_x_n  = VectorOperations.VectorVectorTensorProduct(dRho, n);
            double[,] firstTerm = MatrixOperations.MatrixProduct(
                MatrixOperations.Transpose(dA),
                MatrixOperations.MatrixProduct(n_x_dRho, A)
                );
            double[,] secondTerm = MatrixOperations.MatrixProduct(
                MatrixOperations.Transpose(A),
                MatrixOperations.MatrixProduct(dRho_x_n, dA)
                );
            rotationalPart = MatrixOperations.ScalarMatrixProductNew(
                coef,
                MatrixOperations.MatrixAddition(firstTerm, secondTerm)
                );
            return(rotationalPart);
        }
Ejemplo n.º 25
0
        public double[,] CreateGlobalStiffnessMatrix()
        {
            double penetration = CalculateNormalGap();

            if (penetration <= 0)
            {
                double[] n = CalculateNormalUnitVector();
                double[,] A        = CalculatePositionMatrix();
                double[,] AT       = MatrixOperations.Transpose(A);
                double[,] nxn      = VectorOperations.VectorVectorTensorProduct(n, n);
                double[,] nxn_A    = MatrixOperations.MatrixProduct(nxn, A);
                double[,] AT_nxn_A = MatrixOperations.MatrixProduct(AT, nxn_A);
                double[,] globalStiffnessMatrix = MatrixOperations.ScalarMatrixProductNew(PenaltyFactor, AT_nxn_A);
                return(globalStiffnessMatrix);
            }
            else
            {
                double[,] globalStifnessMatrix = new double[4, 4];
                return(globalStifnessMatrix);
            }
        }
Ejemplo n.º 26
0
        private double[,] CalculateRotationalStiffnessPart(double[,] A, double[,] dA, double[] n, double ksi3, double m11, double[] dRho)
        {
            double coef = PenaltyFactor * ksi3 * m11;

            double[,] rotationalPart;
            double[,] n_x_dRho  = VectorOperations.VectorVectorTensorProduct(n, dRho);
            double[,] dRho_x_n  = VectorOperations.VectorVectorTensorProduct(dRho, n);
            double[,] firstTerm = MatrixOperations.MatrixProduct(
                MatrixOperations.Transpose(dA),
                MatrixOperations.MatrixProduct(n_x_dRho, A)
                );
            double[,] secondTerm = MatrixOperations.MatrixProduct(
                MatrixOperations.Transpose(A),
                MatrixOperations.MatrixProduct(dRho_x_n, dA)
                );
            rotationalPart = MatrixOperations.ScalarMatrixProductNew(
                coef,
                MatrixOperations.MatrixAddition(firstTerm, secondTerm)
                );
            //double[,] rotationalPart = new double[6, 6];
            //double N1 = 1 / 2 * (1 - ksi1);
            //double N2 = 1 / 2 * (1 + ksi1);
            //double coef = PenaltyFactor * ksi3 * m11;
            //rotationalPart[0, 0] = -coef * N1 * drho[0] * n[0];
            //rotationalPart[0, 1] = -coef * (N1 * drho[0] * n[1] / 2) - coef * (N1 * drho[1] * n[0] / 2);
            //rotationalPart[0, 2] = coef * (N1 * drho[0] * n[0] / 2) - coef * (N2 * drho[0] * n[0] / 2);
            //rotationalPart[0, 3] = coef * (N1 * drho[0] * n[1] / 2) - coef * (N2 * drho[1] * n[0] / 2);
            //rotationalPart[0, 4] = coef * (drho[0] * n[0] / 2);
            //rotationalPart[0, 5] = coef * (drho[1] * n[0] / 2) - coef * (N1 * drho[0] * n[1]);

            //rotationalPart[1, 0] = rotationalPart[0, 1];
            //rotationalPart[1, 1] = -coef * N1 * drho[1] * n[1];
            //rotationalPart[1, 2] = coef * (N1 * drho[1] * n[0] / 2) - coef * (N2 * drho[0] * n[1] / 2);
            //rotationalPart[1, 3] = coef * (N1 * drho[1] * n[1] / 2) - coef * (N2 * drho[1] * n[1] / 2);
            //rotationalPart[1, 4] = coef * drho[0] * n[1] / 2;
            //rotationalPart[1, 5] = coef * (drho[1] * n[1] / 2) - coef * (N1 * drho[1] * n[1]);
            return(rotationalPart);
        }
Ejemplo n.º 27
0
        public double[] CreateInternalGlobalForcesVector()
        {
            //double ksi1 = ClosestPointProjection();
            Ksi1Current = ClosestPointProjection();
            if (counter == 1)
            {
                Ksi1Initial = Ksi1Current;
            }
            counter = counter + 1;
            if (Math.Abs(Ksi1Current) <= 1.05)
            {
                Tuple <double[, ], double[, ]> positionMatrices = CalculatePositionMatrix(Ksi1Current);
                double[,] aMatrix  = positionMatrices.Item1;
                double[,] daMatrix = positionMatrices.Item2;

                Tuple <double[], double, double[], double[], double> surfaceCharacteristics = SurfaceGeometry(daMatrix);
                double   m11     = surfaceCharacteristics.Item2;
                double[] n       = surfaceCharacteristics.Item3;
                double[] tVector = surfaceCharacteristics.Item4;

                double detM = surfaceCharacteristics.Item5;

                double ksi3 = CalculateNormalGap(aMatrix, n);
                if (ksi3 <= 0)
                {
                    double[,] AT = MatrixOperations.Transpose(aMatrix);
                    double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n);
                    double[] AT_t = VectorOperations.MatrixVectorProduct(AT, tVector);

                    double deltaKsi = CalculateTangentialVelocity(Ksi1Current, Ksi1Initial);
                    //Console.WriteLine(Ksi1Initial);
                    double Tr1 = CalculateTangentialTraction(deltaKsi, detM);
                    double phi = Math.Sqrt(Tr1 * Tr1 * m11) - FrictionCoef * PenaltyFactor * Math.Abs(ksi3);
                    if (phi <= 0.0)
                    {
                        double   T1 = Tr1;
                        double[] internalGlobalForcesVector = VectorOperations.VectorVectorAddition(
                            VectorOperations.VectorScalarProductNew(AT_n, PenaltyFactor * ksi3),
                            VectorOperations.VectorScalarProductNew(AT_t, T1 * Math.Sqrt(m11)));
                        return(internalGlobalForcesVector);
                    }
                    else
                    {
                        double   T1 = (Tr1 / Math.Abs(Tr1)) * mhid * PenaltyFactor * Math.Abs(ksi3) * Math.Sqrt(detM);
                        double[] internalGlobalForcesVector = VectorOperations.VectorVectorAddition(
                            VectorOperations.VectorScalarProductNew(AT_n, PenaltyFactor * ksi3),
                            VectorOperations.VectorScalarProductNew(AT_t, T1 * Math.Sqrt(m11)));
                        return(internalGlobalForcesVector);
                    }
                }
                else
                {
                    double[] internalGlobalForcesVector = new double[6];
                    return(internalGlobalForcesVector);
                }
            }
            else
            {
                double[] internalGlobalForcesVector = new double[6];
                return(internalGlobalForcesVector);
            }
        }
Ejemplo n.º 28
0
        public double[,] CreateGlobalStiffnessMatrix()
        {
            //double ksi1 = ClosestPointProjection();
            if (counter == 1)
            {
                Ksi1Initial = Ksi1Current;
            }
            counter = counter + 1;
            if (Math.Abs(Ksi1Current) <= 1.05)
            {
                Tuple <double[, ], double[, ]> positionMatrices = CalculatePositionMatrix(Ksi1Current);
                double[,] aMatrix  = positionMatrices.Item1;
                double[,] daMatrix = positionMatrices.Item2;

                Tuple <double[], double, double[], double[], double> surfaceCharacteristics = SurfaceGeometry(daMatrix);
                double   m11     = surfaceCharacteristics.Item2;
                double[] dRho    = surfaceCharacteristics.Item1;
                double[] n       = surfaceCharacteristics.Item3;
                double[] tVector = surfaceCharacteristics.Item4;

                double detM = surfaceCharacteristics.Item5;

                double ksi3 = CalculateNormalGap(aMatrix, n);
                if (ksi3 <= 0)
                {
                    double[,] sN = CalculateMainStiffnessPart(Ksi1Current, n);
                    double deltaKsi = CalculateTangentialVelocity(Ksi1Current, Ksi1Initial);
                    double Tr1      = CalculateTangentialTraction(deltaKsi, detM);
                    double phi      = Math.Sqrt(Tr1 * Tr1 * m11) - FrictionCoef * PenaltyFactor * Math.Abs(ksi3);
                    if (phi <= 0.0)
                    {
                        double T1 = Tr1;
                        double[,] sT1 = MatrixOperations.ScalarMatrixProductNew(TangentPenaltyFactor,
                                                                                MatrixOperations.MatrixProduct(
                                                                                    MatrixOperations.Transpose(aMatrix),
                                                                                    MatrixOperations.MatrixProduct(
                                                                                        VectorOperations.VectorVectorTensorProduct(tVector, tVector), aMatrix)));
                        double[,] sT2 = MatrixOperations.ScalarMatrixProductNew(T1 * m11,
                                                                                MatrixOperations.MatrixProduct(
                                                                                    MatrixOperations.Transpose(daMatrix),
                                                                                    MatrixOperations.MatrixProduct(
                                                                                        VectorOperations.VectorVectorTensorProduct(tVector, tVector), aMatrix)));
                        double[,] sT = MatrixOperations.MatrixAddition(
                            MatrixOperations.ScalarMatrixProductNew(-1.0, sT1),
                            MatrixOperations.MatrixAddition(sT2,
                                                            MatrixOperations.Transpose(sT2)));
                        double[,] globalStiffnessMatrix = MatrixOperations.MatrixAddition(sN, sT);
                        return(globalStiffnessMatrix);
                    }
                    else
                    {
                        double T1 = (Tr1 / Math.Abs(Tr1)) * mhid * PenaltyFactor * Math.Abs(ksi3) * Math.Sqrt(detM);
                        double[,] sT1 = MatrixOperations.ScalarMatrixProductNew(mhid * PenaltyFactor * (Tr1 / Math.Abs(Tr1)),
                                                                                MatrixOperations.MatrixProduct(
                                                                                    MatrixOperations.Transpose(aMatrix),
                                                                                    MatrixOperations.MatrixProduct(
                                                                                        VectorOperations.VectorVectorTensorProduct(tVector, n), aMatrix)));
                        double[,] sT2 = MatrixOperations.ScalarMatrixProductNew(mhid * PenaltyFactor * Math.Abs(ksi3) * (Tr1 / Math.Abs(Tr1)) * Math.Sqrt(m11),
                                                                                MatrixOperations.MatrixProduct(
                                                                                    MatrixOperations.Transpose(daMatrix),
                                                                                    MatrixOperations.MatrixProduct(
                                                                                        VectorOperations.VectorVectorTensorProduct(tVector, tVector), aMatrix)));
                        double[,] sT = MatrixOperations.MatrixAddition(
                            MatrixOperations.ScalarMatrixProductNew(-1.0, sT1),
                            MatrixOperations.MatrixAddition(sT2,
                                                            MatrixOperations.Transpose(sT2)));
                        double[,] globalStiffnessMatrix = MatrixOperations.MatrixAddition(sN, sT);
                        return(globalStiffnessMatrix);
                    }
                    //double[,] rotationalPart = CalculateRotationalStiffnessPart(aMatrix, daMatrix, n, ksi3, m11, dRho);
                    //double[,] globalStiffnessMatrix = MatrixOperations.MatrixAddition(mainPart, rotationalPart);
                }
                else
                {
                    double[,] globalStifnessMatrix = new double[6, 6];
                    return(globalStifnessMatrix);
                }
            }
            else
            {
                double[,] globalStifnessMatrix = new double[6, 6];
                return(globalStifnessMatrix);
            }
        }
Ejemplo n.º 29
0
        public double[,] CreateGlobalStiffnessMatrix()
        {
            double[,] K = new double[24, 24];
            double[,] E = CalculateStressStrainMatrix(Properties.YoungMod, Properties.PoissonRatio);

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    for (int k = 0; k < 2; k++)
                    {
                        double[] gP = GaussPoints(i, j, k).Item1;
                        double[] gW = GaussPoints(i, j, k).Item2;
                        Dictionary <string, double[]> localdN = CalculateShapeFunctionsLocalDerivatives(gP);
                        double[,] J    = CalculateJacobian(localdN);
                        double[,] invJ = CalculateInverseJacobian(J).Item1;
                        double detJ = CalculateInverseJacobian(J).Item2;
                        Dictionary <int, double[]> globaldN = CalculateShapeFunctionsGlobalDerivatives(localdN, invJ);
                        double[,] B = CalculateBMatrix(globaldN);
                        K           = MatrixOperations.MatrixAddition(K, MatrixOperations.ScalarMatrixProductNew(detJ * gW[0] * gW[1] * gW[2],
                                                                                                                 MatrixOperations.MatrixProduct(MatrixOperations.Transpose(B), MatrixOperations.MatrixProduct(E, B))));
                    }
                }
            }
            return(K);
        }
Ejemplo n.º 30
0
        public double[] CreateInternalGlobalForcesVector()
        {
            double[] fInt = new double[24];
            double[,] E = CalculateStressStrainMatrix(Properties.YoungMod, Properties.PoissonRatio);

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    for (int k = 0; k < 2; k++)
                    {
                        double[] gP = GaussPoints(i, j, k).Item1;
                        double[] gW = GaussPoints(i, j, k).Item2;
                        Dictionary <string, double[]> localdN = CalculateShapeFunctionsLocalDerivatives(gP);
                        double[,] J    = CalculateJacobian(localdN);
                        double[,] invJ = CalculateInverseJacobian(J).Item1;
                        double detJ = CalculateInverseJacobian(J).Item2;
                        Dictionary <int, double[]> globaldN = CalculateShapeFunctionsGlobalDerivatives(localdN, invJ);
                        double[,] B = CalculateBMatrix(globaldN);
                        double[] strainVector = CalculateStrainsVector(B);
                        double[] stressVector = CalculateStressVector(E, strainVector);
                        fInt = VectorOperations.VectorVectorAddition(fInt, VectorOperations.VectorScalarProductNew(
                                                                         VectorOperations.MatrixVectorProduct(MatrixOperations.Transpose(B), stressVector), detJ * gW[0] * gW[1] * gW[2]));
                    }
                }
            }

            //double[,] Kstiff = CreateGlobalStiffnessMatrix();
            //double[] uDisp = DisplacementVector;
            //double[] fInt = VectorOperations.MatrixVectorProduct(Kstiff, uDisp);
            //fInt = VectorOperations.VectorScalarProductNew(fInt, 1.0);
            return(fInt);
        }