public UniformLoadForPlanarElements(double ux, double uy, double uz, LoadCase lc) : base(lc) { _ux = ux; _uy = uy; _uz = uz; }
/// <summary> /// Gets the total displacement vector for whole structure for specified <see cref="cse"/> /// </summary> /// <param name="cse">The cse.</param> /// <param name="map">The map.</param> /// <remarks> /// This is not used for finding unknown displacements (like displacement of free DoFs). /// Just is used for known displacements (like settlements and only for settlement). /// </remarks> /// <returns></returns> private double[] GetTotalDispVector(LoadCase cse, DofMappingManager map) { //displacement vector. free part can be assume zero however didn't touch that var n = parent.Nodes.Count; var buf = new double[6 * n]; if (parent.SettlementLoadCase != cse) { return(buf); } var nodes = parent.Nodes; for (var i = 0; i < n; i++) { var disp = nodes[i].Settlements; buf[6 * i + 0] = disp.DX; buf[6 * i + 1] = disp.DY; buf[6 * i + 2] = disp.DZ; buf[6 * i + 3] = disp.RX; buf[6 * i + 4] = disp.RY; buf[6 * i + 5] = disp.RZ; } return(buf); }
/// <summary> /// Gets the nodal displacement regarding defined load case /// </summary> /// <param name="cse">load case</param> /// <returns></returns> public Displacement GetNodalDisplacement(LoadCase cse) { parent.LastResult.AddAnalysisResultIfNotExists(cse); var disps = parent.LastResult.Displacements[cse]; var buf = Displacement.FromVector(disps, this.Index * 6); return(buf); }
/// <summary> /// Gets the total elements equivalent nodal force vector. /// </summary> /// <param name="cse">The load case.</param> /// <param name="map">The map.</param> /// <returns></returns> private double[] GetTotalElementsForceVector(LoadCase cse) { //force vector for both free and fixed dof var n = parent.Nodes.Count; var loads = new Force[n]; //loads from connected element to node is stored in this array instead of Node.ElementLoads. for (int i = 0; i < n; i++) //re indexing { parent.Nodes[i].Index = i; } #region adding element loads foreach (var elm in parent.Elements) { var nc = elm.Nodes.Length; foreach (var ld in elm.Loads) { if (ld.Case != cse) { continue; } var frcs = elm.GetGlobalEquivalentNodalLoads(ld); //ld.GetGlobalEquivalentNodalLoads(elm); for (var i = 0; i < nc; i++) { var nde = elm.Nodes[i]; loads[nde.Index] += frcs[i]; } } } #endregion var buf = new double[6 * n]; for (int i = 0; i < n; i++) { var force = loads[i]; buf[6 * i + 0] = force.Fx; buf[6 * i + 1] = force.Fy; buf[6 * i + 2] = force.Fz; buf[6 * i + 3] = force.Mx; buf[6 * i + 4] = force.My; buf[6 * i + 5] = force.Mz; } return(buf); }
public static int[] GetMasterMapping(Model model, LoadCase cse, out bool[] hinged) { for (int i = 0; i < model.Nodes.Count; i++) { model.Nodes[i].Index = i; } var n = model.Nodes.Count; var masters = new int[n]; hinged = new bool[n]; for (var i = 0; i < n; i++) { masters[i] = i; } var masterCount = 0; #region filling the masters var distinctElements = GetDistinctRigidElements(model, cse); var centralNodePrefreation = new bool[n]; foreach (var elm in model.RigidElements) { if (elm.CentralNode != null) { centralNodePrefreation[elm.CentralNode.Index] = true; } } foreach (var elm in distinctElements) { if (elm.Count == 0) { continue; } var elmMasterIndex = GetMasterNodeIndex(model, elm, centralNodePrefreation); for (var i = 0; i < elm.Count; i++) { masters[elm[i]] = elmMasterIndex; } } #endregion return(masters); }
private Model(SerializationInfo info, StreamingContext context) { elements = (ElementCollection)info.GetValue("elements", typeof(ElementCollection)); mpcElements = (MpcElementCollection)info.GetValue("mpcElements", typeof(MpcElementCollection)); rigidElements = (RigidElementCollection)info.GetValue("rigidElements", typeof(RigidElementCollection)); telepathyLinks = (TelepathyLinkCollection)info.GetValue("telepathyLinks", typeof(TelepathyLinkCollection)); nodes = (NodeCollection)info.GetValue("nodes", typeof(NodeCollection)); settlementLoadCase = (LoadCase)info.GetValue("settlementLoadCase", typeof(LoadCase)); }
public static CCS GetReducedFreeFreeStiffnessMatrix(this Model model, LoadCase lc) { var fullst = MatrixAssemblerUtil.AssembleFullStiffnessMatrix(model); var mgr = DofMappingManager.Create(model, lc); var dvd = CalcUtil.GetReducedZoneDividedMatrix(fullst, mgr); return(dvd.ReleasedReleasedPart); }
/// Gets the sum of external applying forces (including exnternal nodal loads + Equivalent nodal loads of elemental loads) /// </summary> /// <param name="loadCase">the load case</param> /// <returns></returns> public Force GetTotalApplyingForces(LoadCase loadCase) { parent.LastResult.AddAnalysisResultIfNotExists(loadCase); var cs = Force.FromVector(parent.LastResult.ConcentratedForces[loadCase], 6 * Index); var es = Force.FromVector(parent.LastResult.ElementForces[loadCase], 6 * Index); var buf = -cs - es; return(buf); }
/// <summary> /// Determines whether the <see cref="Model"/> Needs the permutation for defined <see cref="loadCase"/> or not. (i.e. should model consider any <see cref="RigidElement"/> while analyzing the <see cref="loadCase"/> or not.) /// </summary> /// <param name="model">The model.</param> /// <param name="loadCase">The load case.</param> /// <returns>true, if need to consider any <see cref="RigidElement"/>; false, otherwise</returns> public static bool NeedPermutation(Model model, LoadCase loadCase) { foreach (var elm in model.RigidElements) { if (IsAppliableRigidElement(elm, loadCase)) { return(true); } } return(false); }
/// <summary> /// Gets the sum of external forces (including support reaction + exnternal nodal loads + Equivalent nodal loads of elemental loads) /// </summary> /// <param name="loadCase">the load case</param> /// <returns></returns> public Force GetTotalExternalForces(LoadCase loadCase) { parent.LastResult.AddAnalysisResultIfNotExists(loadCase); var cs = Force.FromVector(parent.LastResult.ConcentratedForces[loadCase], 6 * Index); var es = Force.FromVector(parent.LastResult.ElementForces[loadCase], 6 * Index); var ss = Force.FromVector(parent.LastResult.SupportReactions[loadCase], 6 * Index); var buf = ss - cs - es; return(buf); }
public void AddAnalysisResultIfNotExists_MPC(LoadCase cse) { var f1 = _displacements.ContainsKey(cse); var f2 = _forces.ContainsKey(cse); if (f1 || f2) { return; } AddAnalysisResult_MPC(cse); }
protected Model(SerializationInfo info, StreamingContext context) { Elements = (ElementCollection)info.GetValue("elements", typeof(ElementCollection)); MpcElements = (MpcElementCollection)info.GetValue("mpcElements", typeof(MpcElementCollection)); rigidElements = (RigidElementCollection)info.GetValue("rigidElements", typeof(RigidElementCollection)); //telepathyLinks = (TelepathyLinkCollection)info.GetValue("telepathyLinks", typeof(TelepathyLinkCollection)); Nodes = (NodeCollection)info.GetValue("nodes", typeof(NodeCollection)); settlementLoadCase = (LoadCase)info.GetValue("settlementLoadCase", typeof(LoadCase)); InitPool(); }
/// <summary> /// Gets the nodal displacement regarding defined load case /// </summary> /// <param name="cse">load case</param> /// <returns></returns> internal void SetNodalDisplacement(LoadCase cse, Displacement disp) { if (parent.LastResult == null) { throw new Exception(); } var disps = parent.LastResult.Displacements[cse]; var vect = Displacement.ToVector(disp); Array.Copy(vect, 0, disps, this.Index * 6, 6); }
/// <summary> /// Gets the total displacements with specified <see cref="loadCase"/> /// </summary> /// <param name="loadCase">the load case</param> /// <returns></returns> public Displacement GetTotalSettlementAmount(LoadCase loadCase) { var buf = new Displacement(); foreach (var st in settlements) { if (st.LoadCase == loadCase) { buf += st.Displacement; } } return(buf); }
/// <summary> /// Analyses the stiffness matrix for warnings. /// </summary> /// <param name="mtx">The MTX.</param> /// <param name="map">The map.</param> /// <param name="currentCase">The current load case which error is with it.</param> /// <remarks> /// Only searches for zero elements on matrix diagonal /// </remarks> private void AnalyseStiffnessMatrixForWarnings(ZoneDevidedMatrix mtx, DofMappingManager map, LoadCase currentCase) { var cs = mtx.ReleasedReleasedPart; var n = cs.ColumnCount; var t = new bool[n]; //true if i'th diagonal member nonzero, false if diagonal member zero! for (var i = 0; i < n; i++) { var st = cs.ColumnPointers[i]; var en = cs.ColumnPointers[i + 1]; var col = i; for (var j = st; j < en; j++) { var row = cs.RowIndices[j]; //var val = cs.Values[j]; if (row == col) { t[row] = true; } } } for (var i = 0; i < n; i++) { if (t[i]) { continue; } var globalDofNum = map.RMap1[map.RMap2[i]]; var nodeNum = globalDofNum / 6; var dof = (DoF)(globalDofNum % 6); var rec = TraceRecords.GetRecord(30000, parent.Nodes[nodeNum].Label); rec.TargetIdentifier = string.Format( "{0} DoF on node #{1} for load case with [name = '{2}'] and [nature = {3}]", dof, nodeNum, currentCase.CaseName, currentCase.LoadType); parent.Trace.Write(rec); } }
/// <summary> /// Gets the total concentrated forces on loads vector. /// </summary> /// <param name="cse">The load case.</param> /// <param name="map">The map.</param> /// <returns></returns> private double[] GetTotalConcentratedForceVector(LoadCase cse) { //force vector for both free and fixed dof var n = parent.Nodes.Count; var loads = new Force[n]; //loads from connected element to node is stored in this array instead of Node.ElementLoads. for (int i = 0; i < n; i++) //re indexing { parent.Nodes[i].Index = i; } #region adding concentrated nodal loads for (int i = 0; i < n; i++) { foreach (var load in parent.Nodes[i].Loads) { if (load.Case != cse) { continue; } loads[parent.Nodes[i].Index] += load.Force; } } #endregion var buf = new double[6 * n]; for (int i = 0; i < n; i++) { var force = loads[i]; buf[6 * i + 0] = force.Fx; buf[6 * i + 1] = force.Fy; buf[6 * i + 2] = force.Fz; buf[6 * i + 3] = force.Mx; buf[6 * i + 4] = force.My; buf[6 * i + 5] = force.Mz; } return(buf); }
/// <summary> /// Generates the permutation for delta for specified model in specified loadCase. /// Note that delta permutation = P_delta in reduction process /// </summary> /// <param name="target">The target.</param> /// <param name="loadCase">The load case.</param> /// <returns>delta permutation</returns> public static CCS GenerateP_Delta(Model target, LoadCase loadCase) { throw new NotImplementedException(); target.ReIndexNodes(); var buf = new CoordinateStorage <double>(target.Nodes.Count * 6, target.Nodes.Count * 6, 1); #region rigid elements foreach (var elm in target.RigidElements) { var centralNode = elm.Nodes[0]; var masterIdx = centralNode.Index; for (var i = 1; i < elm.Nodes.Count; i++) { var slaveIdx = elm.Nodes[i].Index; var d = centralNode.Location - elm.Nodes[i].Location; //buf[0, 4] = -(buf[1, 3] = d.Z); //buf[2, 3] = -(buf[0, 5] = d.Y); //buf[1, 5] = -(buf[2, 4] = d.X); buf.At(6 * slaveIdx + 0, 6 * masterIdx + 0, 1); buf.At(6 * slaveIdx + 1, 6 * masterIdx + 1, 1); buf.At(6 * slaveIdx + 2, 6 * masterIdx + 2, 1); buf.At(6 * slaveIdx + 1, 6 * masterIdx + 3, d.Z); buf.At(6 * slaveIdx + 0, 6 * masterIdx + 4, -d.Z); buf.At(6 * slaveIdx + 0, 6 * masterIdx + 5, d.Y); buf.At(6 * slaveIdx + 2, 6 * masterIdx + 3, -d.Y); // buf.At(6 * slaveIdx + 2, 6 * masterIdx + 4, d.X); // buf.At(6 * slaveIdx + 1, 6 * masterIdx + 5, -d.X); } //add to buf } #endregion throw new NotImplementedException(); return(buf.ToCCs()); }
/// <summary> /// Adds the analysis result if not exists. /// </summary> /// <param name="cse">The load case.</param> /// <remarks>If current instance do not contains the results related to <see cref="cse"/>, then this method will add result related to <see cref="cse"/> using <see cref="StaticLinearAnalysisResult.AddAnalResult"/> method</remarks> public void AddAnalysisResultIfNotExists(LoadCase cse) { var f1 = displacements.ContainsKey(cse); var f2 = forces.ContainsKey(cse); if (f1 != f2) { throw new Exception("!"); } if (f1) { return; } AddAnalysisResult(cse); }
/// <summary> /// Gets the supports reaction that is from load cse which are applying to this <see cref="Node"/> from supports. /// </summary> /// <param name="cse">The loadCase.</param> /// <returns></returns> public Force GetSupportReaction(LoadCase cse) { if (constraints == Constraint.Released) { return(new Force()); } parent.LastResult.AddAnalysisResultIfNotExists(cse); var cs = Force.FromVector(parent.LastResult.ConcentratedForces[cse], 6 * Index); var es = Force.FromVector(parent.LastResult.ElementForces[cse], 6 * Index); var ss = Force.FromVector(parent.LastResult.SupportReactions[cse], 6 * Index); var buf = ss - cs - es; if (constraints.DX == DofConstraint.Released) { buf.Fx = 0; } if (constraints.DY == DofConstraint.Released) { buf.Fy = 0; } if (constraints.DZ == DofConstraint.Released) { buf.Fz = 0; } if (constraints.RX == DofConstraint.Released) { buf.Mx = 0; } if (constraints.RY == DofConstraint.Released) { buf.My = 0; } if (constraints.RZ == DofConstraint.Released) { buf.Mz = 0; } return(buf); }
public static bool IsInStaticEquilibrium(StaticLinearAnalysisResult res, LoadCase cse) { var allForces = new Force[res.Parent.Nodes.Count]; var forceVec = res.Forces[cse]; for (int i = 0; i < allForces.Length; i++) { var force = Force.FromVector(forceVec, 6 * i); allForces[i] = force; } var ft = allForces.Select((i, j) => i.Move(res.Parent.Nodes[j].Location, new Point())).Sum(); throw new NotImplementedException(); }
private static bool IsAppliableRigidElement(RigidElement elm, LoadCase loadCase) { if (elm.UseForAllLoads) { return(true); } if (elm.AppliedLoadTypes.Contains(loadCase.LoadType)) { return(true); } if (elm.AppliedLoadCases.Contains(loadCase)) { return(true); } return(false); }
public bool AppliesForLoadCase(LoadCase lc) { if (_useForAllLoads) { return(true); } if (AppliedLoadCases.Contains(lc)) { return(true); } if (_appliedLoadTypes.Contains(lc.LoadType)) { return(true); } return(false); }
private static List <List <int> > GetDistinctRigidElements(Model model, LoadCase loadCase) { for (int i = 0; i < model.Nodes.Count; i++) { model.Nodes[i].Index = i; } var n = model.Nodes.Count; var ecrd = new CoordinateStorage <double>(n, n, 1); //for storing existence of rigid elements var crd = new CoordinateStorage <double>(n, n, 1); //for storing hinged connection of rigid elements for (int ii = 0; ii < model.RigidElements.Count; ii++) { var elm = model.RigidElements[ii]; if (IsAppliableRigidElement(elm, loadCase)) { for (var i = 0; i < elm.Nodes.Count; i++) { ecrd.At(elm.Nodes[i].Index, elm.Nodes[i].Index, 1.0); } for (var i = 0; i < elm.Nodes.Count - 1; i++) { ecrd.At(elm.Nodes[i].Index, elm.Nodes[i + 1].Index, 1.0); ecrd.At(elm.Nodes[i + 1].Index, elm.Nodes[i].Index, 1.0); } } } var graph = Converter.ToCompressedColumnStorage(ecrd); var buf = CalcUtil.EnumerateGraphParts(graph); return(buf); }
/// <summary> /// Determines whether the specified <see cref="rigidElement"/> should be considered with defined <see cref="loadCase"/> or not. /// </summary> /// <param name="rigidElement">The rigidElement.</param> /// <param name="loadCase">The load case.</param> /// <returns></returns> private static bool IsAppliableRigidElement(RigidElement rigidElement, LoadCase loadCase) { return(true); if (rigidElement.UseForAllLoads) { return(true); } foreach (var lCase in rigidElement.AppliedLoadCases) { if (lCase.LoadType == loadCase.LoadType) { return(true); } if (lCase.Equals(loadCase)) { return(true); } } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="LoadCase"/> struct. /// </summary> /// <param name="loadCase">load case of settlement.</param> /// <param name="displacement">amount of settlement.</param> public Settlement(LoadCase loadCase, Displacement displacement) { this.loadCase = loadCase; this.displacement = displacement; }
/// <summary> /// Initializes a new instance of the <see cref="LoadCase"/> struct. for ISerialable. /// </summary> /// <param name="info">The information.</param> /// <param name="context">The context.</param> private Settlement(SerializationInfo info, StreamingContext context) { loadCase = info.GetValue <LoadCase>("caseName"); displacement = info.GetValue <Displacement>("loadType"); }
/// <summary> /// Gets the permutation matrix for defined <see cref="model" /> for applying the defined <see cref="RigidElement"/>s in <see cref="model"/> in defined <see cref="loadCase"/>. /// </summary> /// <param name="model">The model.</param> /// <param name="loadCase">The load case.</param> /// <returns>The permutation matrix</returns> public CompressedColumnStorage <double> GetPermutationMatrix(Model model, LoadCase loadCase) { for (int i = 0; i < model.Nodes.Count; i++) { model.Nodes[i].Index = i; } var n = model.Nodes.Count; var masters = new int[n]; for (var i = 0; i < n; i++) { masters[i] = i; } var masterCount = 0; #region filling the masters var distinctElements = GetDistinctRigidElements(model, loadCase); foreach (var elm in distinctElements) { if (elm.Count == 0) { continue; } var elmMasterIndex = GetMasterNodeIndex(model, elm); for (var i = 0; i < elm.Count; i++) { masters[elm[i]] = elmMasterIndex; } } #endregion for (var i = 0; i < n; i++) { if (masters[i] == i) { masterCount++; } } var rMaster = new int[n]; var cnt = 0; for (var i = 0; i < masters.Length; i++) { if (masters[i] == i) { rMaster[i] = cnt++; } else { rMaster[i] = -1; } } var buf = new CoordinateStorage <double>(6 * n, 6 * masterCount, 1); for (var i = 0; i < n; i++) { if (masters[i] == i) { InsertPij(Matrix.Eye(6), rMaster[i], i, buf); } else { var j = masters[i]; var pij = GetPij(model, j, i); InsertPij(pij, rMaster[j], i, buf); } } return(Converter.ToCompressedColumnStorage(buf)); }
public CompressedColumnStorage <double> GetInvertPermutationMatrix(Model model, LoadCase loadCase) { var n = model.Nodes.Count; var masters = new int[n]; for (var i = 0; i < n; i++) { masters[i] = i; } #region filling the masters foreach (var elm in model.RigidElements) { var apply = false; if (elm.UseForAllLoads) { apply = true; } else { foreach (var cse in elm.AppliedLoadCases) { if (cse.Equals(loadCase)) { apply = true; break; } } } if (apply) { if (elm.Nodes.Count == 0) { continue; } var elmMasterIndex = elm.Nodes[0].Index; for (var i = 0; i < elm.Nodes.Count; i++) { masters[elm.Nodes[i].Index] = elmMasterIndex; } } } #endregion var masterCount = 0; for (var i = 0; i < n; i++) { if (masters[i] == i) { masterCount++; } } var buf = new CoordinateStorage <double>(6 * n, masterCount, masterCount); for (var i = 0; i < n; i++) { if (masters[i] == i) { InsertPij(Matrix.Eye(6), i, i, buf); } } return(Converter.ToCompressedColumnStorage(buf).Transpose()); }
/// <summary> /// Initializes a new instance of the <see cref="UniformLoad1D"/> class. /// </summary> /// <param name="magnitude">The magnitude of load.</param> /// <param name="direction">The direction of load.</param> /// <param name="sys">The coordination system type.</param> /// <param name="cse">The load case.</param> public UniformLoad1D(double magnitude, LoadDirection direction, CoordinationSystem sys, LoadCase cse) { this.magnitude = magnitude; this.coordinationSystem = sys; this.direction = direction; this.Case = cse; }
/// <summary> /// Initializes a new instance of the <see cref="LoadCase"/> struct. for ISerialable. /// </summary> /// <param name="info">The information.</param> /// <param name="context">The context.</param> private Settlement(SerializationInfo info, StreamingContext context) { loadCase = (LoadCase)info.GetValue("caseName", typeof(LoadCase)); displacement = (Displacement)info.GetValue("loadType", typeof(Displacement)); }