public SectionPage() { InitializeComponent(); this.Force = new InternalForces(); //InputControl.Settings.UpdateDynamically = true; //OutputControl.Settings.UpdateDynamically = true; //OutputControl.Settings.Floating = 2; this.DataContext = this; //this.comboBox.ItemsSource = SittinSection.SectionBase.SectionGroups; this.comboBox.ItemsSource = Enum.GetValues(typeof(StructuralBase.Section.SectionType)) .Cast <StructuralBase.Section.SectionType>(); InputControl cont = (InputControl)ControlBase.Create(ControlTypes.Input); cont.SourceObject = this.Force; cont.InputChanged += Check; cont.Settings.UpdateDynamically = true; this.ForceInput.Children.Clear(); this.ForceInput.Children.Add(cont); ControlBase.RegisterProperties <StructuralBase.Design.Steel.SteelDesign>(ControlTypes.Input, d => d.K, d => d.Lx, d => d.Ly, d => d.MA, d => d.MB, d => d.MC, d => d.MMax); this.expInternalForces.IsExpanded = true; this.expSection.IsExpanded = false; }
private double[] LoadControlledNR(double[] forceVector) { double[] incrementDf = VectorOperations.VectorScalarProductNew(forceVector, lambda); double[] solutionVector = localSolutionVector; double[] incrementalExternalForcesVector = new double[forceVector.Length]; double[] tempSolutionVector = new double[solutionVector.Length]; double[] deltaU = new double[solutionVector.Length]; double[] internalForcesTotalVector; double[] dU; double[] residual; double residualNorm; for (int i = 0; i < numberOfLoadSteps; i++) { incrementalExternalForcesVector = VectorOperations.VectorVectorAddition(incrementalExternalForcesVector, incrementDf); discretization.UpdateDisplacements(solutionVector); internalForcesTotalVector = discretization.CreateTotalInternalForcesVector(); double[,] stiffnessMatrix = discretization.CreateTotalStiffnessMatrix(); //OnConvergenceResult("Newton-Raphson: Solution not converged at load step" + i); dU = linearSolver.Solve(stiffnessMatrix, incrementDf); solutionVector = VectorOperations.VectorVectorAddition(solutionVector, dU); residual = VectorOperations.VectorVectorSubtraction(internalForcesTotalVector, incrementalExternalForcesVector); residualNorm = VectorOperations.VectorNorm2(residual); int iteration = 0; Array.Clear(deltaU, 0, deltaU.Length); while (residualNorm > Tolerance && iteration < MaxIterations) { stiffnessMatrix = discretization.CreateTotalStiffnessMatrix(); deltaU = VectorOperations.VectorVectorSubtraction(deltaU, linearSolver.Solve(stiffnessMatrix, residual)); tempSolutionVector = VectorOperations.VectorVectorAddition(solutionVector, deltaU); discretization.UpdateDisplacements(tempSolutionVector); internalForcesTotalVector = discretization.CreateTotalInternalForcesVector(); residual = VectorOperations.VectorVectorSubtraction(internalForcesTotalVector, incrementalExternalForcesVector); residualNorm = VectorOperations.VectorNorm2(residual); if (residualNorm <= Tolerance) { OnConvergenceResult("Newton-Raphson: Load Step " + i + " - Solution converged at iteration " + iteration + " - Residual Norm = " + residualNorm); } else { OnConvergenceResult("Newton-Raphson: Load Step " + i + " - Solution not converged at iteration " + iteration + " - Residual Norm = " + residualNorm); } iteration = iteration + 1; //(Application.Current.Windows[0] as MainWindow).LogTool.Text = "ok"; //OnConvergenceResult("Newton-Raphson: Solution not converged at load step" + iteration); } InternalForces.Add(i + 1, internalForcesTotalVector); solutionVector = VectorOperations.VectorVectorAddition(solutionVector, deltaU); Solutions.Add(i + 1, solutionVector); if (iteration >= MaxIterations) { OnConvergenceResult("Newton-Raphson did not converge at Load Step " + i + ". Exiting solution."); LoadStepConvergence.Add("Solution not converged."); break; } LoadStepConvergence.Add("Solution converged."); } return(solutionVector); }