Esempio n. 1
0
 private double[,] CalculateHatMMatrix()
 {
     double[,] a0M  = MatrixOperations.ScalarMatrixProductNew(a0, massMatrix);
     double[,] a1C  = MatrixOperations.ScalarMatrixProductNew(a1, dampingMatrix);
     double[,] hutM = MatrixOperations.MatrixAddition(a0M, a1C);
     return(hutM);
 }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio 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);
 }
Esempio 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);
        }
Esempio n. 6
0
        private double[,] InverseMetricTensor(double[,] m)
        {
            double detm = MetricTensorDet(m);

            double[,] mInv = MatrixOperations.ScalarMatrixProductNew(1.0 / detm,
                                                                     new double[, ] {
                { m[1, 1], -m[0, 1] },
                { -m[1, 0], m[0, 0] }
            });
            return(mInv);
        }
Esempio 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);
 }
Esempio n. 8
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);
 }
Esempio n. 9
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);
        }
Esempio n. 10
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);
        }
Esempio 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);
        }
Esempio n. 12
0
        public double[,] CreateMassMatrix()
        {
            double[,] tempM = MatrixOperations.CreateDiagonalMatrix(6, 1.0);
            double[] xUpdated = UpdateNodalCoordinates(DisplacementVector);
            double   a        = Math.Pow(Math.Pow(xUpdated[0] - xUpdated[2], 2) + Math.Pow(xUpdated[1] - xUpdated[3], 2), 0.5);
            double   b        = Math.Pow(Math.Pow(xUpdated[0] - xUpdated[4], 2) + Math.Pow(xUpdated[1] - xUpdated[5], 2), 0.5);
            double   c        = Math.Pow(Math.Pow(xUpdated[2] - xUpdated[4], 2) + Math.Pow(xUpdated[3] - xUpdated[5], 2), 0.5);
            double   t        = (a + b + c) / 2;
            double   area     = Math.Pow(t * (t - a) * (t - b) * (t - c), 0.5);
            double   scalar   = Properties.Density * Properties.Thickness * area / 3.0;

            double[,] M = MatrixOperations.ScalarMatrixProductNew(scalar, tempM);
            double waveSpeed = Math.Sqrt(Properties.YoungMod / Properties.Density);

            return(M);
        }
Esempio n. 13
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);
        }
Esempio n. 14
0
 private double[,] CalculateHatKMatrix()
 {
     double[,] TotalMassMatrix;
     double[,] TotalStiffnessMatrix;
     if (CustomStiffnessMatrix != null)
     {
         TotalMassMatrix      = CustomMassMatrix;
         TotalStiffnessMatrix = CustomStiffnessMatrix;
     }
     else
     {
         TotalMassMatrix      = Assembler.CreateTotalMassMatrix();
         TotalStiffnessMatrix = Assembler.CreateTotalStiffnessMatrix();
     }
     double[,] hatK = MatrixOperations.MatrixSubtraction(TotalStiffnessMatrix,
                                                         MatrixOperations.ScalarMatrixProductNew(a2, TotalMassMatrix));
     return(hatK);
 }
Esempio n. 15
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);
 }
Esempio n. 16
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);
            }
        }
Esempio n. 17
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);
        }
Esempio n. 18
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);
        }
Esempio n. 19
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);
        }
Esempio n. 20
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);
        }
Esempio n. 21
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);
 }
Esempio n. 22
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);
            }
        }
Esempio n. 23
0
 private double[,] CalculateHatKMatrix()
 {
     double[,] hatK = MatrixOperations.MatrixSubtraction(stiffnessMatrix,
                                                         MatrixOperations.ScalarMatrixProductNew(a2, massMatrix));
     return(hatK);
 }
Esempio n. 24
0
        public double[,] CreateMassMatrix()
        {
            //double[,] M = new double[8, 8];



            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);
        }