Ejemplo n.º 1
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.º 2
0
        public void RunExample()
        {
            double[,] matrix1 = MatrixOperations.CreateRandomMatrix(2000, 2000);
            double[,] matrix2 = MatrixOperations.CreateRandomMatrix(2000, 2000);
            double[] vector1 = VectorOperations.CreateRandomVector(2000);
            double[,] result1, result2, result1b, result2b;
            double[] result1c, result2c;
            double   result1d, result2d;

            MatrixOperations.ParallelCalculations = false;
            Stopwatch watch1 = Stopwatch.StartNew();

            result1  = MatrixOperations.MatrixAddition(matrix1, matrix2);
            result1b = MatrixOperations.MatrixProduct(matrix1, matrix2);
            result1c = VectorOperations.MatrixVectorProduct(result1b, vector1);
            result1d = VectorOperations.VectorNorm2(result1c);
            long first = watch1.ElapsedMilliseconds;

            MatrixOperations.ParallelCalculations = true;
            Stopwatch watch2 = Stopwatch.StartNew();

            result2  = MatrixOperations.MatrixAddition(matrix1, matrix2);
            result2b = MatrixOperations.MatrixProduct(matrix1, matrix2);
            //result2 = MatrixOperations.TempVariable;
            result2c = VectorOperations.MatrixVectorProduct(result2b, vector1);
            result2d = VectorOperations.VectorNorm2(result2c);
            long second = watch2.ElapsedMilliseconds;

            string timeForCalculations = "Elapsed time for single threaded operation: " + first.ToString() + " -Result is:" + result1d + "\n" + "Elapsed time for multithreaded operation: " + second.ToString() + " -Result is:" + result2d;

            OnTimeElapsed(timeForCalculations);
        }
Ejemplo n.º 3
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.º 4
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.º 5
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.º 6
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.º 7
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.º 8
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.º 9
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.º 10
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.º 11
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.º 12
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.º 13
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.º 14
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.º 15
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.º 16
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.º 17
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.º 18
0
        public double[,] CreateMassMatrix()
        {
            double[,] M = new double[16, 16];
            double Mtot = new double();

            //double scalar = 28.24;
            //double[,] M = MatrixOperations.CreateDiagonalMatrix(8, scalar);

            double[,] consinstentMass = new double[16, 16];
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    double[] gP = GaussPoints(i, j).Item1;
                    double[] gW = GaussPoints(i, j).Item2;
                    Dictionary <string, double[]> localdN = CalculateShapeFunctionsLocalDerivatives(gP);
                    double[,] J = CalculateJacobian(localdN);
                    double detJ = CalculateInverseJacobian(J).Item2;
                    double[,] Nmatrix = CalculateShapeFunctionMatrix(gP[0], gP[1]);
                    consinstentMass   = MatrixOperations.MatrixAddition(consinstentMass, MatrixOperations.ScalarMatrixProductNew(Properties.Density * Properties.Thickness * detJ * gW[0] * gW[1],
                                                                                                                                 MatrixOperations.MatrixProduct(MatrixOperations.Transpose(Nmatrix), Nmatrix)));
                    Mtot += Properties.Density * Properties.Thickness * detJ * gW[0] * gW[1];
                }
            }
            double c = Mtot / MatrixOperations.Trace(consinstentMass);

            //M = consinstentMass;
            for (int i = 0; i <= 15; i++)
            {
                M[i, i] = c * consinstentMass[i, i];
            }
            //for (int i = 0; i <= 15; i++)
            //{
            //    for (int j = 0; j <= 15; j++)
            //    {
            //        M[i, i] += Math.Abs(consinstentMass[i, j]);
            //    }
            //}
            //-------------------------------------------------------------------
            //double[,] tempM = MatrixOperations.CreateDiagonalMatrix(8, 1.0);
            //double length = 0.3;
            //double scalar = Properties.Density * Properties.Thickness * length * (length / 3.0) / 4.0;
            //double[,] M = MatrixOperations.ScalarMatrixProductNew(scalar, tempM);

            //double waveSpeed = Math.Sqrt(Properties.YoungMod / Properties.Density);
            //double deltatCritical = length * Math.Sqrt(1.0 - 0.33) / waveSpeed;


            //--------------------------------------------------------------
            //for (int i = 0; i < 2; i++)
            //{
            //    for (int j = 0; j < 2; j++)
            //    {
            //        double[] gP = GaussPoints(i, j).Item1;
            //        double[] gW = GaussPoints(i, j).Item2;
            //        Dictionary<string, double[]> localdN = CalculateShapeFunctionsLocalDerivatives(gP);
            //        double[,] J = CalculateJacobian(localdN);
            //        double[,] invJ = CalculateInverseJacobian(J).Item1;
            //        double detJ = CalculateInverseJacobian(J).Item2;
            //        double[,] Nmatrix = CalculateShapeFunctionMatrix(gP[i], gP[j]);
            //        M = MatrixOperations.MatrixAddition(M, MatrixOperations.ScalarMatrixProductNew(Properties.Density * Properties.Thickness * detJ * gW[i] * gW[j],
            //            MatrixOperations.MatrixProduct(MatrixOperations.Transpose(Nmatrix), Nmatrix)));
            //    }
            //}

            //--------------------------------------------------------

            //for (int i = 0; i < 8; i++)
            //{
            //    M[i, i] = 4.0;
            //}

            //for (int i = 0; i < 6; i++)
            //{
            //    M[i, i + 2] = 2.0;
            //    M[i + 2, i] = 2.0;
            //}

            //for (int i = 0; i < 4; i++)
            //{
            //    M[i, i + 4] = 1.0;
            //    M[i + 4, i] = 1.0;
            //}

            //for (int i = 0; i < 2; i++)
            //{
            //    M[i, i + 6] = 2.0;
            //    M[i + 6, i] = 2.0;
            //}

            //M = MatrixOperations.ScalarMatrixProductNew(0.67 * 0.8 * Properties.Density * Properties.Thickness / 32, M);
            //MatrixOperations.PrintMatrix(M);

            return(M);
        }
Ejemplo n.º 19
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);
        }