Beispiel #1
0
        public void SolveNewmark()
        {
            List <double> aConstants = CalculateIntegrationConstantsNewmark();

            double[,] hatStiffnessMatrixNewmark = CalculateHatKMatrixNewmark(aConstants);
            explicitSolution.Add(0, InitialValues.InitialDisplacementVector);
            explicitVelocity.Add(0, InitialValues.InitialVelocityVector);
            explicitAcceleration.Add(0, CalculateInitialAccelerationsNewmark());
            TimeAtEachStep.Add(0, 0.0);
            double[] nextSolution;
            for (int i = 1; i < timeStepsNumber; i++)
            {
                double time = i * timeStep + InitialValues.InitialTime;

                if (ActivateNonLinearSolution == false)
                {
                    double[] hatRVectorNewmark = CalculateHatRVectorNewmark(i, aConstants);
                    nextSolution = LinearSolver.Solve(hatStiffnessMatrixNewmark, hatRVectorNewmark);
                    Console.WriteLine("Solution for Load Step {0} is:", i);
                    VectorOperations.PrintVector(nextSolution);
                }
                else
                {
                    nextSolution = NewtonIterationsNewmark(ExternalForcesVector, i, aConstants);
                    Console.WriteLine("Solution for Load Step {0} is:", i);
                    VectorOperations.PrintVector(nextSolution);
                }
                explicitSolution.Add(i, nextSolution);
                explicitAcceleration.Add(i, CalculateAccelerationNewmark(i, aConstants));
                explicitVelocity.Add(i, CalculateVelocityNewmark(i, aConstants));
                TimeAtEachStep.Add(i, time);
            }
            ExportToFile.ExportExplicitResults(explicitSolution, TimeAtEachStep, 1, 1);
            //ShowToGUI.ShowResults(explicitSolution, TimeAtEachStep, 1, 1);
        }
Beispiel #2
0
        public void SolveExplicit()
        {
            double[,] hatMassMatrix = CalculateHatMMatrix();
            explicitSolution.Add(-1, CalculatePreviousDisplacementVector());
            explicitSolution.Add(0, InitialValues.InitialDisplacementVector);
            explicitAcceleration.Add(0, CalculateInitialAccelerations());
            TimeAtEachStep.Add(-1, -1 * timeStep + InitialValues.InitialTime);
            TimeAtEachStep.Add(0, 0.0);
            double[] nextSolution;
            for (int i = 1; i < timeStepsNumber; i++)
            {
                double time = i * timeStep + InitialValues.InitialTime;

                if (ActivateNonLinearSolution == false)
                {
                    double[] hatRVector = CalculateHatRVector(i);
                    nextSolution = LinearSolver.Solve(hatMassMatrix, hatRVector);
                    Console.WriteLine("Solution for Load Step {0} is:", i);
                    VectorOperations.PrintVector(nextSolution);
                }
                else
                {
                    double[] hatRVector = CalculateHatRVectorNL(i);
                    nextSolution = LinearSolver.Solve(hatMassMatrix, hatRVector);
                    //nextSolution = NewtonIterations(hatRVector);
                    Console.WriteLine("Solution for Load Step {0} is:", i);
                    VectorOperations.PrintVector(nextSolution);
                }
                explicitSolution.Add(i, nextSolution);
                explicitAcceleration.Add(i, CalculateAccelerations());
                TimeAtEachStep.Add(i, time);
            }
            ExportToFile.ExportExplicitResults(explicitSolution, TimeAtEachStep, 1, 1);
        }
Beispiel #3
0
 public void PrintExplicitSolution()
 {
     foreach (KeyValuePair <int, double[]> element in explicitSolution)
     {
         int      step           = element.Key;
         double[] solutionInStep = element.Value;
         Console.WriteLine("Solution for Load Step {0} is:", step);
         VectorOperations.PrintVector(solutionInStep);
     }
 }
Beispiel #4
0
        public static void Solve()
        {
            double[,] matrixA = new double[, ]
            {
                { 10, 1, -5 }, { -20, 3, 20 }, { 5, 3, 5 }
            };
            double[]       RHS  = new double[] { 1, 2, 6 };
            BiCGSTABSolver test = new BiCGSTABSolver();

            double[] solution = test.Solve(matrixA, RHS);
            VectorOperations.PrintVector(solution);
        }
Beispiel #5
0
 public void PrintSolution()
 {
     VectorOperations.PrintVector(staticSolutionVector);
 }