Пример #1
0
        public double[,] CreateGlobalStiffnessMatrix()
        {
            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[] dRho = surfaceCharacteristics.Item1;
                double[] n    = surfaceCharacteristics.Item3;
                double   ksi3 = CalculateNormalGap(aMatrix, n);
                if (ksi3 <= 0)
                {
                    double[,] mainPart              = CalculateMainStiffnessPart(ksi1, n);
                    double[,] rotationalPart        = CalculateRotationalStiffnessPart(aMatrix, daMatrix, n, ksi3, m11, dRho);
                    double[,] globalStiffnessMatrix = MatrixOperations.MatrixAddition(mainPart, rotationalPart);
                    return(globalStiffnessMatrix);
                }
                else
                {
                    double[,] globalStifnessMatrix = new double[6, 6];
                    return(globalStifnessMatrix);
                }
            }
            else
            {
                double[,] globalStifnessMatrix = new double[6, 6];
                return(globalStifnessMatrix);
            }
        }
Пример #2
0
        public double[,] CreateGlobalStiffnessMatrix()
        {
            double[,] globalStiffnessMatrix;
            double[,] normalStiffnessMatrix;
            double[,] tangentialStiffnessMatrix;
            double penetration = CalculateNormalGap();

            if (penetration <= 0)
            {
                normalStiffnessMatrix = CalculateNormalStiffnessMatrix();
                double tangentialTraction = CalculateTangentialTraction();
                double phi = ReturnMappingScheme(tangentialTraction, penetration);
                if (phi <= 0)
                {
                    tangentialStiffnessMatrix = CalculateTangentialStiffnessMatrixForStick();
                }
                else
                {
                    tangentialStiffnessMatrix = CalculateTangentialStiffnessMatrixForSlip(tangentialTraction);
                }
                globalStiffnessMatrix = MatrixOperations.MatrixAddition(normalStiffnessMatrix, tangentialStiffnessMatrix);
                return(globalStiffnessMatrix);
            }
            else
            {
                globalStiffnessMatrix = new double[4, 4];
                return(globalStiffnessMatrix);
            }
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
0
 private double[,] CalculateHatMMatrix()
 {
     double[,] a0M  = MatrixOperations.ScalarMatrixProductNew(a0, massMatrix);
     double[,] a1C  = MatrixOperations.ScalarMatrixProductNew(a1, dampingMatrix);
     double[,] hutM = MatrixOperations.MatrixAddition(a0M, a1C);
     return(hutM);
 }
Пример #6
0
        public double[,] CreateGlobalStiffnessMatrix()
        {
            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[,] Km = MainStiffnessPart(PenaltyFactor, n, aMatrices.Item1);
                    double[,] Kr = RotationalStiffnessPart(PenaltyFactor, n, aMatrices.Item1, aMatrices.Item2, aMatrices.Item3, dRho, ksi3);
                    double[,] K  = MatrixOperations.MatrixAddition(Km, Kr);

                    return(K);
                }
                else
                {
                    return(new double[15, 15]);
                }
            }
            else
            {
                return(new double[15, 15]);
            }
        }
Пример #7
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);
        }
Пример #8
0
 private double[,] CalculateHatMMatrix()
 {
     double[,] TotalMassMatrix;
     double[,] TotalDampingMatrix;
     if (CustomMassMatrix != null)
     {
         TotalMassMatrix    = CustomMassMatrix;
         TotalDampingMatrix = CustomDampingMatrix;
     }
     else
     {
         TotalMassMatrix    = Assembler.CreateTotalMassMatrix();
         TotalDampingMatrix = Assembler.CreateTotalDampingMatrix();
     }
     double[,] a0M  = MatrixOperations.ScalarMatrixProductNew(a0, TotalMassMatrix);
     double[,] a1C  = MatrixOperations.ScalarMatrixProductNew(a1, TotalDampingMatrix);
     double[,] hutM = MatrixOperations.MatrixAddition(a0M, a1C);
     return(hutM);
 }
Пример #9
0
        private double[] CalculateHatRVectorNL(int i)
        {
            Assembler.UpdateDisplacements(explicitSolution[i - 1]);

            double[,] totalMassMatrix    = Assembler.CreateTotalMassMatrix();
            double[,] totalDampingMatrix = Assembler.CreateTotalDampingMatrix();
            double[,] a2M  = MatrixOperations.ScalarMatrixProductNew(a2, totalMassMatrix);
            double[,] a0M  = MatrixOperations.ScalarMatrixProductNew(a0, totalMassMatrix);
            double[,] a1C  = MatrixOperations.ScalarMatrixProductNew(-a1, totalDampingMatrix);
            double[,] hutM = MatrixOperations.MatrixAddition(a0M, a1C);

            double[] F            = Assembler.CreateTotalInternalForcesVector();
            double[] hatPreviousU = VectorOperations.MatrixVectorProduct(hutM, explicitSolution[i - 2]);
            double[] a2Mut        = VectorOperations.MatrixVectorProduct(a2M, explicitSolution[i - 1]);


            double[] hatR1     = VectorOperations.VectorVectorSubtraction(ExternalForcesVector, F);
            double[] hatR2     = VectorOperations.VectorVectorSubtraction(a2Mut, hatPreviousU);
            double[] hatRtotal = VectorOperations.VectorVectorAddition(hatR1, hatR2);
            return(hatRtotal);
        }
Пример #10
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);
        }
Пример #11
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);
        }
Пример #12
0
        public double[,] CreateGlobalStiffnessMatrix()
        {
            int nodesNumber = Properties.MasterSegmentPolynomialDegree + Properties.SlaveSegmentPolynomialDegree + 2;

            double[,] globalStifnessMatrix = new double[2 * nodesNumber, 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> masterSurfaceCharacteristics = MasterSegmentGeometry(daMatrix, da2Matrix);
                    double   m11  = masterSurfaceCharacteristics.Item2;
                    double[] dRho = masterSurfaceCharacteristics.Item1;
                    double[] n    = masterSurfaceCharacteristics.Item3;
                    double   h11  = masterSurfaceCharacteristics.Item5;
                    double   ksi3 = CalculatePenetration(aMatrix, n);
                    if (ksi3 <= 0)
                    {
                        double slaveMetricTensor = SlaveSegmentGeometry(positionMatrices.Item4, positionMatrices.Item5).Item2;
                        double[,] mainPart       = CalculateMainStiffnessPart(ksi1, ksi2, n);
                        double[,] rotationalPart = CalculateRotationalStiffnessPart(aMatrix, daMatrix, n, ksi3, m11, dRho);
                        double[,] curvaturePart  = CalculateCurvatureStiffnessPart(aMatrix, ksi3, m11, dRho, h11);
                        double scalar = Math.Pow(slaveMetricTensor, 0.5) * gW;
                        double[,] StifnessMatrix = MatrixOperations.ScalarMatrixProductNew(scalar, MatrixOperations.MatrixAddition(MatrixOperations.MatrixAddition(mainPart, rotationalPart),
                                                                                                                                   curvaturePart));
                        globalStifnessMatrix = MatrixOperations.MatrixAddition(globalStifnessMatrix, StifnessMatrix);
                    }
                }
            }
            return(globalStifnessMatrix);
        }
Пример #13
0
 private double[,] CalculateHatKMatrixNewmark(List <double> aConstants)
 {
     double[,] TotalMassMatrix;
     double[,] TotalDampingMatrix;
     double[,] TotalStiffnessMatrix;
     if (CustomMassMatrix != null)
     {
         TotalMassMatrix      = CustomMassMatrix;
         TotalDampingMatrix   = CustomDampingMatrix;
         TotalStiffnessMatrix = CustomStiffnessMatrix;
     }
     else
     {
         TotalMassMatrix      = Assembler.CreateTotalMassMatrix();
         TotalDampingMatrix   = Assembler.CreateTotalDampingMatrix();
         TotalStiffnessMatrix = Assembler.CreateTotalStiffnessMatrix();
     }
     double[,] a0M  = MatrixOperations.ScalarMatrixProductNew(aConstants[0], TotalMassMatrix);
     double[,] a1C  = MatrixOperations.ScalarMatrixProductNew(aConstants[1], TotalDampingMatrix);
     double[,] hutK = MatrixOperations.MatrixAddition(TotalStiffnessMatrix,
                                                      MatrixOperations.MatrixAddition(a0M, a1C));
     return(hutK);
 }
Пример #14
0
        public double[,] CreateGlobalStiffnessMatrix()
        {
            double ksi1 = Project(0.0);

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

                Tuple <double[], double, double[], double[], double> surfaceCharacteristics = MasterSegmentGeometry(daMatrix, da2Matrix);
                double   m11  = surfaceCharacteristics.Item2;
                double[] dRho = surfaceCharacteristics.Item1;
                double[] n    = surfaceCharacteristics.Item3;
                double   h11  = surfaceCharacteristics.Item5;
                double   ksi3 = CalculatePenetration(aMatrix, n);
                if (ksi3 <= 0)
                {
                    double[,] mainPart              = CalculateMainStiffnessPart(ksi1, n);
                    double[,] rotationalPart        = CalculateRotationalStiffnessPart(aMatrix, daMatrix, n, ksi3, m11, dRho);
                    double[,] curvaturePart         = CalculateCurvatureStiffnessPart(aMatrix, ksi3, m11, dRho, h11);
                    double[,] globalStiffnessMatrix = MatrixOperations.MatrixAddition(MatrixOperations.MatrixAddition(mainPart, rotationalPart), curvaturePart);
                    return(globalStiffnessMatrix);
                }
                else
                {
                    double[,] globalStifnessMatrix = new double[8, 8];
                    return(globalStifnessMatrix);
                }
            }
            else
            {
                double[,] globalStifnessMatrix = new double[8, 8];
                return(globalStifnessMatrix);
            }
        }
Пример #15
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);
            }
        }
Пример #16
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);
        }