Ejemplo n.º 1
0
        IEnumerable <double> GetErrors(LoadState newState, LoadState oldState, StructureInfo info)
        {
            Vector <double> reaction              = info.Reaction(newState.Displacement);
            Vector <double> equilibrium           = info.InitialLoad + newState.Lambda * info.ReferenceLoad - reaction;
            Vector <double> incrementDisplacement = newState.Displacement - oldState.Displacement;

            yield return(incrementDisplacement.Norm(2) / newState.Displacement.Norm(2));

            yield return(equilibrium.Norm(2) / info.ReferenceLoad.Norm(2));

            yield return(Math.Abs(newState.Displacement.DotProduct(equilibrium) / newState.Displacement.DotProduct(info.ReferenceLoad)));
        }
        public LoadIncrementalStateResult Choose(StructureInfo info, LoadState state, LoadIncrementalState prediction, IEnumerable <LoadIncrementalState> candidates)
        {
            List <LoadIncrementalState> candidateList = candidates.ToList( );

            if (candidateList.Any( ))
            {
                double Function(LoadIncrementalState candidate) =>
                prediction.IncrementDisplacement.DotProduct(candidate.IncrementDisplacement) /
                (prediction.IncrementDisplacement.Norm(2) * candidate.IncrementDisplacement.Norm(2));

                LoadIncrementalState result = candidateList.MinBy(Function).First( );
                return(new LoadIncrementalStateResult(result, true, ""));
            }
            return(new LoadIncrementalStateResult(null, false, ""));
        }
Ejemplo n.º 3
0
        public LoadIncrementalStateResult Choose(StructureInfo info, LoadState state, LoadIncrementalState prediction, IEnumerable <LoadIncrementalState> candidates)
        {
            List <LoadIncrementalState> candidateList = candidates.ToList( );

            if (candidateList.Any( ))
            {
                double Function(LoadIncrementalState candidate)
                {
                    Vector <double> displacement      = state.Displacement + candidate.IncrementDisplacement;
                    Vector <double> reaction          = info.Reaction(displacement);
                    double          lambda            = state.Lambda + candidate.IncrementLambda;
                    Vector <double> equilibriumVector = info.InitialLoad + lambda * info.ReferenceLoad - reaction;

                    return(equilibriumVector.Norm(2));
                }

                LoadIncrementalState result = candidateList.MinBy(Function).First( );
                return(new LoadIncrementalStateResult(result, true, ""));
            }
            return(new LoadIncrementalStateResult(null, false, ""));
        }
Ejemplo n.º 4
0
 double GetBergamParameter(double k0, Vector <double> Dvt, StructureInfo info)
 => Math.Abs(k0 / info.ReferenceLoad.DotProduct(Dvt));
Ejemplo n.º 5
0
        /// <summary>
        /// Predicts a LoadIncrementalState.
        /// </summary>
        /// <param name="state"></param>
        /// <param name="initialStiffness"></param>
        /// <returns></returns>
        internal LoadIncrementalStateResult Predict(LoadState state, double initialStiffness, StructureInfo info)
        {
            Vector <double> equilibrium = info.InitialLoad + state.Lambda * info.ReferenceLoad - info.Reaction(state.Displacement);
            Matrix <double> mK          = info.Stiffness(state.Displacement);
            Vector <double> Dvt         = mK.Solve(info.ReferenceLoad);
            Vector <double> Dvr         = mK.Solve(equilibrium);
            double          bergam      = GetBergamParameter(initialStiffness, Dvt, info);
            double          DLambda     = Scheme.GetPrediction(Dvt, info.ReferenceLoad) * Math.Sign(bergam);
            Vector <double> Dv          = DLambda * Dvt + Dvr;

            return(new LoadIncrementalStateResult(new LoadIncrementalState(DLambda, Dv), true, ""));
        }
Ejemplo n.º 6
0
        LoadIncrementalStateResult GetCorrection(LoadState state, LoadIncrementalState prediction, StructureInfo info)
        {
            Matrix <double>            stiffnessMatrix        = info.Stiffness(state.Displacement);
            Vector <double>            dut                    = stiffnessMatrix.Solve(info.ReferenceLoad);
            Vector <double>            reaction               = info.Reaction(state.Displacement);
            Vector <double>            equilibrium            = info.InitialLoad + state.Lambda * info.ReferenceLoad - reaction;
            Vector <double>            dur                    = stiffnessMatrix.Solve(equilibrium);
            LoadIncrementalStateResult incrementalStateResult = Scheme.GetCorrection(state, prediction, info, dut, dur);

            return(incrementalStateResult);
        }
Ejemplo n.º 7
0
        internal LoadIncrementalStateResult Correct(LoadState state, LoadIncrementalState prediction, StructureInfo info)
        {
            LoadIncrementalStateResult result        = new LoadIncrementalStateResult(null, false, "");
            LoadState            initialState        = state;
            LoadState            currentState        = initialState;
            LoadIncrementalState predictionIncrement = prediction;

            for (int iteration = 1; iteration <= MaximumIterations; iteration++)
            {
                LoadIncrementalStateResult correction = GetCorrection(currentState, predictionIncrement, info);
                predictionIncrement.Add(correction.IncrementalState);
                LoadState     newState    = currentState.Add(correction.IncrementalState);
                List <double> errors      = GetErrors(newState, currentState, info).ToList( );
                bool          convergence = CheckConvergence(errors, Tolerances);
                currentState = newState;
                if (convergence)
                {
                    break;
                }

                if (iteration >= MaximumIterations)
                {
                    result.Message = Strings.MaxNumberOfIterationsReached;
                    result.Success = false;
                }
            }

            result.IncrementalState = currentState.Substract(initialState);

            return(result);
        }
 public LoadIncrementalStateResult GetCorrection(LoadState state, LoadIncrementalState prediction, StructureInfo info, Vector <double> dut, Vector <double> dur) =>
 new LoadIncrementalStateResult(new LoadIncrementalState(0, dur), true, "");