public override IEnumerable<INumericalResult> Solve(int resultsCount) { ICollection<INumericalResult> results = new List<INumericalResult>(); if (_mesh.IsMeshGenerated) { GetConstantMatrix(); indeciesToDelete = getIndeciesWithStaticBoundaryConditions(); Matrix StiffnessMatrix = GetStiffnessMatrix(); StiffnessMatrix = applyStaticBoundaryConditions(StiffnessMatrix, indeciesToDelete); Matrix MassMatrix = GetMassMatrix(); MassMatrix = applyStaticBoundaryConditions(MassMatrix, indeciesToDelete); #if (ALL_LAMBDAS) Vector[] eigenVectors; double[] lambdas = StiffnessMatrix.GetEigenvalueSPAlgorithm(MassMatrix, out eigenVectors, _error, resultsCount); results = generateVibrationResults(lambdas, eigenVectors); #else Vector eigenVector; double lambda = StiffnessMatrix.GetMaxEigenvalueSPAlgorithm(out eigenVector, _error); addStaticPoints(eigenVector); EigenValuesNumericalResult result = new EigenValuesNumericalResult(_mesh.Elements, eigenVector, Math.Sqrt(lambda / _model.Material.Rho)); results.Add(result); #endif } return results; }
public override IEnumerable<INumericalResult> Solve(int resultsCount) { IEnumerable<INumericalResult> results = new List<INumericalResult>(); if (_mesh.IsMeshGenerated) { GetConstantMatrix(); indeciesToDelete = getIndeciesWithStaticBoundaryConditions(); Matrix stiffnessMatrix = GetStiffnessMatrix(); stiffnessMatrix = applyStaticBoundaryConditions(stiffnessMatrix, indeciesToDelete); Matrix massMatrix = GetMassMatrix(); massMatrix = applyStaticBoundaryConditions(massMatrix, indeciesToDelete); #if (ALL_LAMBDAS) Vector firstEigenVector = null; double[] lambdas = null; Vector[] eigenVectors = null; int iterations = 0; do { if (eigenVectors != null) { firstEigenVector = eigenVectors[0]; } else { firstEigenVector = new Vector(stiffnessMatrix.CountRows); } firstEigenVector = applyAmplitudeToVector(firstEigenVector); Matrix nonlinearMatrix = GetNonlinearMatrix(firstEigenVector); nonlinearMatrix = applyStaticBoundaryConditions(nonlinearMatrix, indeciesToDelete); Matrix k = stiffnessMatrix + nonlinearMatrix; lambdas = k.GetEigenvalueSPAlgorithm(massMatrix, out eigenVectors, _error, resultsCount); iterations++; } while ((Vector.Norm(eigenVectors[0] - firstEigenVector) > _error) &&(iterations < _maxIterations)); results = generateVibrationResults(lambdas, eigenVectors); #else Vector eigenVector; double lambda = StiffnessMatrix.GetMaxEigenvalueSPAlgorithm(out eigenVector, _error); addStaticPoints(eigenVector); EigenValuesNumericalResult result = new EigenValuesNumericalResult(_mesh.Elements, eigenVector, Math.Sqrt(lambda / _model.Material.Rho)); results.Add(result); #endif } return results; }
protected ICollection<INumericalResult> generateVibrationResults(double[] lambdas, Vector[] eigenVectors) { List<INumericalResult> results = new List<INumericalResult>(); for (int i = 0; i < lambdas.Length; i++) { Vector eigenVector = eigenVectors[i]; //eigenVector = addStaticPoints(eigenVector, indeciesToDelete); //eigenVector = applyAmplitudeToVector(eigenVector); EigenValuesNumericalResult result = new EigenValuesNumericalResult(_mesh.Elements, eigenVector, Math.Sqrt(lambdas[i] / _model.Material.Rho)); results.Add(result); } return results; }