PyCBA 0.4.1__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyCBA
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Python Continuous Beam Analysis
5
5
  Author-email: Colin Caprani <colin.caprani@monash.edu>
6
6
  License: Apache 2.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyCBA
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Python Continuous Beam Analysis
5
5
  Author-email: Colin Caprani <colin.caprani@monash.edu>
6
6
  License: Apache 2.0
@@ -2,7 +2,7 @@
2
2
  PyCBA - Continuous Beam Analysis in Python
3
3
  """
4
4
 
5
- __version__ = "0.4.1"
5
+ __version__ = "0.4.2"
6
6
 
7
7
  from .analysis import *
8
8
  from .beam import *
@@ -219,6 +219,18 @@ class Beam:
219
219
  The number of restraints in the beam
220
220
  """
221
221
  return len(self._restraints)
222
+
223
+ @property
224
+ def no_fixed_restraints(self):
225
+ """
226
+ Returns the number of fixed restraints of the beam (fully-supported DOFs)
227
+
228
+ Returns
229
+ -------
230
+ no_fixed_restraints : int
231
+ The number of fixed restraints in the beam
232
+ """
233
+ return len(np.where(np.array(self._restraints)==-1)[0])
222
234
 
223
235
  @property
224
236
  def length(self):
@@ -121,18 +121,41 @@ class InfluenceLines:
121
121
  x = self.vResults[0].results.x
122
122
  dx = x[2] - x[1]
123
123
  idx = np.where(np.abs(x - poi) <= dx * 1e-6)[0][0]
124
- # find the nearest support to the poi
125
- idxr = (
126
- np.abs(np.cumsum(np.insert(self.ba.beam.mbr_lengths, 0, 0)) - poi)
127
- ).argmin()
124
+ #idx = np.abs(x - poi).argmin()
125
+
128
126
  npts = len(self.vResults)
129
127
  eta = np.zeros(npts)
128
+
129
+ #
130
+ # Getting the correct vertical reaction is tricky
131
+ # Should be relatively easy to extend to get moment reactions too.
132
+ #
133
+ # Get vector of the node locations
134
+ node_locations = np.cumsum(np.insert(self.ba.beam.mbr_lengths, 0, 0))
135
+ # The indices of the supported vertical DOFs wrt the node locations vector
136
+ vert_sup_dof_idx = np.where(np.array(self.ba._beam.restraints)[::2]==-1)[0]
137
+ # The locations then of these vertical supports
138
+ vert_sup_locs = node_locations[vert_sup_dof_idx]
139
+ # The index of the closest vertical support
140
+ closest_vert_sup_idx = np.abs(vert_sup_locs-poi).argmin()
141
+ # And its value
142
+ closest_vert_sup = vert_sup_locs[closest_vert_sup_idx]
143
+ # And now the indixe of this support in the node locations vector
144
+ node_idx = np.where(node_locations==closest_vert_sup)[0][0]
145
+ # And hence its index in the overall DOFs vector
146
+ dof_idx = 2*node_idx
147
+
148
+ # Now we must link the supported DOF to the index in the BeamAnalysis reactions vector
149
+ idx_mask = np.zeros_like(self.ba._beam.restraints)
150
+ idx_mask[np.where(np.array(self.ba._beam.restraints)==-1)] = np.arange(self.ba.beam.no_fixed_restraints)
151
+ # And finally the index of the vertical support nearest the POI in the reactions vector
152
+ vert_sup_idx = idx_mask[dof_idx]
130
153
 
131
154
  for i, res in enumerate(self.vResults):
132
155
  if load_effect == "V":
133
156
  eta[i] = res.results.V[idx]
134
157
  elif load_effect == "R":
135
- eta[i] = res.R[idxr]
158
+ eta[i] = res.R[vert_sup_idx]
136
159
  else:
137
160
  eta[i] = res.results.M[idx]
138
161
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes