public double[] CreateInternalGlobalForcesVector() { double ksi1 = ClosestPointProjection(); if (Math.Abs(ksi1) <= 1.05) { Tuple <double[, ], double[, ]> positionMatrices = CalculatePositionMatrix(ksi1); double[,] aMatrix = positionMatrices.Item1; double[,] daMatrix = positionMatrices.Item2; Tuple <double[], double, double[]> surfaceCharacteristics = SurfaceGeometry(daMatrix); double m11 = surfaceCharacteristics.Item2; double[] n = surfaceCharacteristics.Item3; double ksi3 = CalculateNormalGap(aMatrix, n); if (ksi3 <= 0) { double[,] AT = MatrixOperations.Transpose(aMatrix); double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n); double[] internalGlobalForcesVector = VectorOperations.VectorScalarProductNew(AT_n, PenaltyFactor * ksi3); return(internalGlobalForcesVector); } else { double[] internalGlobalForcesVector = new double[6]; return(internalGlobalForcesVector); } } else { double[] internalGlobalForcesVector = new double[6]; return(internalGlobalForcesVector); } }
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); }
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]); } }
private double[,] CalculateHatMMatrix() { double[,] a0M = MatrixOperations.ScalarMatrixProductNew(a0, massMatrix); double[,] a1C = MatrixOperations.ScalarMatrixProductNew(a1, dampingMatrix); double[,] hutM = MatrixOperations.MatrixAddition(a0M, a1C); return(hutM); }
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); }
public double[] CreateInternalGlobalForcesVector() { double penetration = CalculateNormalGap(); if (penetration <= 0) { double[,] A = CalculatePositionMatrix(); double[,] AT = MatrixOperations.Transpose(A); double[] n = CalculateNormalUnitVector(); double[] t = CalculateTangentUnitVector(); double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n); double[] AT_t = VectorOperations.MatrixVectorProduct(AT, t); double ksi = CalculateNormalGap(); double Tr = CalculateTangentialTraction(); double[] ksi_AT_n = VectorOperations.VectorScalarProductNew(AT_n, ksi); double[] e_ksi_AT_n = VectorOperations.VectorScalarProductNew(ksi_AT_n, PenaltyFactor); double[] Tr_AT_t = VectorOperations.VectorScalarProductNew(AT_t, Tr); double[] internalForcesvector = VectorOperations.VectorVectorAddition(e_ksi_AT_n, Tr_AT_t); return(internalForcesvector); } else { double[] internalGlobalForcesVector = new double[4]; return(internalGlobalForcesVector); } }
public double[] CreateInternalGlobalForcesVector() { double[] ksiVector = Project(new double[2]); if (Math.Abs(ksiVector[0]) <= 1.05 && ksiVector[1] <= 1.05) { Tuple <double[, ], double[, ], double[, ]> aMatrices = CalculatePositionMatrix(ksiVector[0], ksiVector[1]); List <double[]> dRho = SurfaceVectors(ksiVector[0], ksiVector[1]); double[,] m = MetricTensor(dRho); double[] n = NormalVector(m, dRho); double[] xUpdated = xUpdatedVector(); double ksi3 = CalculatePenetration(n, aMatrices.Item1, xUpdated); if (ksi3 <= 0) { double[,] AT = MatrixOperations.Transpose(aMatrices.Item1); double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n); double[] internalGlobalForcesVector = VectorOperations.VectorScalarProductNew(AT_n, PenaltyFactor * ksi3); return(internalGlobalForcesVector); } else { return(new double[15]); } } else { return(new double[15]); } }
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); }
public double[] CreateInternalGlobalForcesVector() { int nodesNumber = Properties.MasterSegmentPolynomialDegree + Properties.SlaveSegmentPolynomialDegree + 2; double[] internalGlobalForcesVector = new double[2 * nodesNumber]; for (int i = 0; i < Properties.IntegrationPoints; i++) { double ksi2 = GaussPoints(i).Item1; double gW = GaussPoints(i).Item2; double ksi1 = Project(0.0, ksi2); if (Math.Abs(ksi1) <= 1.05) { Tuple <double[, ], double[, ], double[, ], double[, ], double[, ]> positionMatrices = CalculatePositionMatrix(ksi1, ksi2); double[,] aMatrix = positionMatrices.Item1; double[,] daMatrix = positionMatrices.Item2; double[,] da2Matrix = positionMatrices.Item3; Tuple <double[], double, double[], double[], double> surfaceCharacteristics = MasterSegmentGeometry(daMatrix, da2Matrix); double[] n = surfaceCharacteristics.Item3; double ksi3 = CalculatePenetration(aMatrix, n); if (ksi3 <= 0) { double slaveMetricTensor = SlaveSegmentGeometry(positionMatrices.Item4, positionMatrices.Item5).Item2; double scalar = Math.Pow(slaveMetricTensor, 0.5) * gW; double[,] AT = MatrixOperations.Transpose(aMatrix); double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n); double[] internalLocalForcesVector = VectorOperations.VectorScalarProductNew(VectorOperations.VectorScalarProductNew(AT_n, PenaltyFactor * ksi3), scalar); internalGlobalForcesVector = VectorOperations.VectorVectorAddition(internalGlobalForcesVector, internalLocalForcesVector); } } } return(internalGlobalForcesVector); }
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); } }
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); } }
public static void CreateContourDataForMatlab(double[] x, double[] y, double[] z, int rows, int columns, string path) { double[,] xContour = new double[rows, columns]; double[,] yContour = new double[rows, columns]; double[,] zContour = new double[rows, columns]; //int[] arr = Enumerable.Repeat(42, 10000).ToArray(); //string[] yData = new string[rows]; //string temp; //for (int i = 0; i < rows; i++) //{ // for (int j = 0; j < columns; j++) // { // yContour[i, j] = y[i *columns+ j]; // } //} xContour = VectorOperations.ConvertVectorToMatrix(x, rows, columns); yContour = VectorOperations.ConvertVectorToMatrix(y, rows, columns); zContour = VectorOperations.ConvertVectorToMatrix(z, rows, columns); //for (int i = 0; i < rows; i++) //{ // for (int j = 0; j < columns; j++) // { // yData[i] = yData[i] + "\t" + yContour[i, j]; // } //} //File.WriteAllLines(@"C:\Users\Public\Documents\ContourDataY.dat", yData); MatrixOperations.PrintMatrixToFile(xContour, path + "xData.dat"); MatrixOperations.PrintMatrixToFile(yContour, path + "yData.dat"); MatrixOperations.PrintMatrixToFile(zContour, path + "zData.dat"); }
public override double[] Solve(double[,] stiffnessMatrix, double[] forceVector) { double[,] lowerMatrix = Cholesky(stiffnessMatrix); double[,] upperMatrix = MatrixOperations.Transpose(lowerMatrix); double[] intermediateVector = ForwardSubstitution(lowerMatrix, forceVector); double[] solutionuberVector = BackSubstitution(upperMatrix, intermediateVector); return(solutionuberVector); }
private double CalculatePenetration(double[] normalVector, double[,] aMatrix, double[] xUpdated) { double ksi3 = VectorOperations.VectorDotProduct( xUpdated, VectorOperations.MatrixVectorProduct( MatrixOperations.Transpose(aMatrix), normalVector)); return(ksi3); }
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); }
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); }
private double CalculatePenetration(double[,] aMatrix, double[] n) { double[,] AT = MatrixOperations.Transpose(aMatrix); double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n); double[] xupd = NodalXUpdated(); double normalGap = VectorOperations.VectorDotProduct(xupd, AT_n); return(normalGap); }
public static void RunExample() { IAssembly elementsAssembly = CreateAssembly(); elementsAssembly.CreateElementsAssembly(); elementsAssembly.ActivateBoundaryConditions = false; double[,] globalStiffnessMatrix = elementsAssembly.CreateTotalStiffnessMatrix(); MatrixOperations.PrintMatrix(globalStiffnessMatrix); }
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); }
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); }
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); }
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); }
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); }
private double CalculateTangentialTraction() { double[,] A = CalculatePositionMatrix(); double[,] AT = MatrixOperations.Transpose(A); double[] displacementVector = DisplacementVector; double[] tangentUnitvector = CalculateTangentUnitVector(); double[] aT_t = VectorOperations.MatrixVectorProduct(AT, tangentUnitvector); double tangentGap = VectorOperations.VectorDotProduct(displacementVector, aT_t); double tangentialTraction = -PenaltyFactor * tangentGap; return(tangentialTraction); }
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); }
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); }
private double CalculateNormalGap(double[,] aMatrix, double[] n) { double[,] AT = MatrixOperations.Transpose(aMatrix); double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n); double[] xupd = new double[] { Nodes[1].XCoordinate + DisplacementVector[0], Nodes[1].YCoordinate + DisplacementVector[1], Nodes[2].XCoordinate + DisplacementVector[2], Nodes[2].YCoordinate + DisplacementVector[3], Nodes[3].XCoordinate + DisplacementVector[4], Nodes[3].YCoordinate + DisplacementVector[5] }; double normalGap = VectorOperations.VectorDotProduct(xupd, AT_n); return(normalGap); }
private double CalculateNormalGap() { double[,] A = CalculatePositionMatrix(); double[,] AT = MatrixOperations.Transpose(A); double[] n = CalculateNormalUnitVector(); double[] AT_n = VectorOperations.MatrixVectorProduct(AT, n); double[] xupd = new double[] { Nodes[1].XCoordinate + DisplacementVector[0], Nodes[1].YCoordinate + DisplacementVector[1], Nodes[2].XCoordinate + DisplacementVector[2], Nodes[2].YCoordinate + DisplacementVector[3] }; double normalGap = VectorOperations.VectorDotProduct(xupd, AT_n); return(normalGap); }
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); }
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); }