public Result <LoadIncrementalState> Correct( LoadState state , LoadIncrementalState prediction , StructureInfo info , Vector <double> dut , Vector <double> dur) => new Result <LoadIncrementalState>() { Value = new LoadIncrementalState(0, dur) };
Result <LoadIncrementalState> GetCorrection(LoadState state, LoadIncrementalState prediction, StructureInfo info) { ILinearSolver 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); Result <LoadIncrementalState> incrementalStateResult = Scheme.Correct(state, prediction, info, dut, dur); return(incrementalStateResult); }
public LoadIncrementalState SelectDisplacement( StructureInfo info , LoadState state , LoadIncrementalState prediction , IEnumerable <LoadIncrementalState> candidates) { double Function(LoadIncrementalState candidate) => prediction.IncrementDisplacement.DotProduct(candidate.IncrementDisplacement) / (prediction.IncrementDisplacement.Norm(2) * candidate.IncrementDisplacement.Norm(2)); return(candidates.MinBy(Function).First()); }
public LoadIncrementalState SelectDisplacement( StructureInfo info , LoadState state , LoadIncrementalState prediction , IEnumerable <LoadIncrementalState> candidates) { 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)); } return(candidates.MinBy(Function).First()); }
internal Result <LoadIncrementalState> Correct( LoadState state , LoadIncrementalState prediction , StructureInfo info) { Result <LoadIncrementalState> result = new Result <LoadIncrementalState>(); LoadState initialState = state; LoadState currentState = initialState; LoadIncrementalState predictionIncrement = prediction; for (int iteration = 1; iteration <= MaximumIterations; iteration++) { Result <LoadIncrementalState> correction = GetCorrection(currentState, predictionIncrement, info); if (correction.IsSuccess) { predictionIncrement.Add(correction.Value); LoadState newState = currentState.Add(correction.Value); List <double> errors = GetErrors(newState, currentState, info).ToList(); bool convergence = CheckConvergence(errors, Tolerances); currentState = newState; if (convergence) { result.Value = currentState.Substract(initialState); break; } } else { result.Errors.AddRange(correction.Errors); } if (iteration >= MaximumIterations) { result.Errors.Add(new Error(Strings.MaxNumberOfIterationsReached)); } } return(result); }
public LoadIncrementalStateResult(LoadIncrementalState incrementalState, bool success, string message) { IncrementalState = incrementalState; Success = success; Message = message; }
internal LoadState Add(LoadIncrementalState increment) => new LoadState(Lambda + increment.IncrementLambda, Displacement + increment.IncrementDisplacement);