public double[,] CreateGlobalStiffnessMatrix() { double[,] lambdaTransposeMatrix = MatrixOperations.Transpose(lambdaMatrix); double[,] localStiffByLambda = MatrixOperations.MatrixProduct(localStiffnessMatrix, lambdaMatrix); globalStiffnessMatrix = MatrixOperations.MatrixProduct(lambdaTransposeMatrix, localStiffByLambda); return(globalStiffnessMatrix); }
public override double[,] CreateLocalStiffnessMatrix() { double[,] transposeBmatrix = MatrixOperations.Transpose(Bmatrix); double[] zVector = new[] { sinCurrent, -cosCurrent, 0, -sinCurrent, cosCurrent, 0 }; double[] vVector = new[] { -cosCurrent, -sinCurrent, 0, cosCurrent, sinCurrent, 0 }; double[,] zzMatrix = VectorOperations.VectorVectorTensorProduct(zVector, zVector); double[,] vzMatrix = VectorOperations.VectorVectorTensorProduct(vVector, zVector); double[,] zvMatrix = VectorOperations.VectorVectorTensorProduct(zVector, vVector); double[,] vzPluszv = MatrixOperations.MatrixAddition(vzMatrix, zvMatrix); double[,] firstMember = MatrixOperations.ScalarMatrixProduct(internalLocalForcesVector[0] / lengthCurrent, zzMatrix); double[,] secondMember = MatrixOperations.ScalarMatrixProduct((internalLocalForcesVector[1] + internalLocalForcesVector[2]) / Math.Pow(lengthCurrent, 2), vzPluszv); double[,] thirdMember = MatrixOperations.MatrixProduct(transposeBmatrix, MatrixOperations.MatrixProduct(Dmatrix, Bmatrix)); double[,] localStiffnessMatrix = MatrixOperations.MatrixAddition(MatrixOperations.MatrixAddition(firstMember, secondMember), thirdMember); return(localStiffnessMatrix); }
private double[] Jacobi() { double[] oldSolution = new double[forceVector.Length]; double[,] Diag = MatrixOperations.PutZerosInDiag(stiffnessMatrix); MatrixOperations.InvertDiagMatrix(Diag); double[,] zeroDiagStiff = MatrixOperations.GetDiagMatrix(stiffnessMatrix); for (int i = 0; i < maxIterations; i++) { oldSolution = solutionVector; solutionVector = VectorOperations.MatrixVectorProduct( Diag, VectorOperations.VectorVectorSubtraction( forceVector, VectorOperations.MatrixVectorProduct(zeroDiagStiff, solutionVector) )); if (VectorOperations.VectorDotProduct(solutionVector, oldSolution) < tolerance) { break; } } return(solutionVector); }
override public void SolveWithMethod(string method) { switch (method) { case "Cholesky": double[,] lowerMatrix = Cholesky(); double[,] upperMatrix = MatrixOperations.Transpose(lowerMatrix); double[] intermediateVector = ForwardSubstitution(lowerMatrix, forceVector); double[] solutionuberVector = BackSubstitution(upperMatrix, intermediateVector); this.solutionVector = solutionuberVector; break; case "Gauss": GaussElimination(stiffnessMatrix, forceVector); this.solutionVector = BackSubstitution(stiffnessMatrix, forceVector); break; default: GaussElimination(stiffnessMatrix, forceVector); this.solutionVector = BackSubstitution(stiffnessMatrix, forceVector); break; } }
private double[] CalculateInternalGlobalForcesVector() { internalGlobalForcesVector = VectorOperations.MatrixVectorProduct(MatrixOperations.Transpose(Bmatrix), internalLocalForcesVector); return(internalGlobalForcesVector); }