Skip to content

Commit 435d9a2

Browse files
JWock82JWock82
authored andcommitted
Worked on pushover analysis
1 parent 0119095 commit 435d9a2

File tree

5 files changed

+217
-216
lines changed

5 files changed

+217
-216
lines changed

Pynite/Analysis.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,16 +305,16 @@ def _pushover_step(model: FEModel3D, combo_name: str, push_combo: str, step_num:
305305
from scipy.sparse.linalg import spsolve
306306

307307
# Calculate the initial stiffness matrix
308-
if log: print('-Calculating elastic stiffness matrix [Ke]')
308+
if log: print('- Calculating elastic stiffness matrix [Ke]')
309309
K11, K12, K21, K22 = _partition(model, model.K(combo_name, log, check_stability, sparse).tolil(), D1_indices, D2_indices)
310310

311311
# Calculate the geometric stiffness matrix
312312
# The `combo_name` variable in the code below is not the name of the pushover load combination. Rather it is the name of the primary combination that the pushover load will be added to. Axial loads used to develop Kg are calculated from the displacements stored in `combo_name`.
313-
if log: print('-Calculating geometric stiffness matrix [Kg]')
313+
if log: print('- Calculating geometric stiffness matrix [Kg]')
314314
Kg11, Kg12, Kg21, Kg22 = _partition(model, model.Kg(combo_name, log, sparse, False).tolil(), D1_indices, D2_indices)
315315

316316
# Calculate the stiffness reduction matrix
317-
if log: print('-Calculating plastic reduction matrix [Km]')
317+
if log: print('- Calculating plastic reduction matrix [Km]')
318318
Km11, Km12, Km21, Km22 = _partition(model, model.Km(combo_name, push_combo, step_num, log, sparse).tolil(), D1_indices, D2_indices)
319319

320320
# The stiffness matrices are currently `lil` format which is great for
@@ -330,7 +330,7 @@ def _pushover_step(model: FEModel3D, combo_name: str, push_combo: str, step_num:
330330
else:
331331

332332
# Initial stiffness matrix
333-
if log: print('-Calculating elastic stiffness matrix [Ke]')
333+
if log: print('- Calculating elastic stiffness matrix [Ke]')
334334
K11, K12, K21, K22 = _partition(model, model.K(combo_name, log, check_stability, sparse), D1_indices, D2_indices)
335335

336336
# Geometric stiffness matrix
@@ -386,7 +386,7 @@ def _pushover_step(model: FEModel3D, combo_name: str, push_combo: str, step_num:
386386

387387
for sub_member in phys_member.sub_members.values():
388388

389-
print(f'Member {sub_member.name} lambda = {sub_member.lamb(Delta_D, combo_name, push_combo, step_num)}')
389+
# print(f'Member {sub_member.name} lambda = {sub_member.lamb(Delta_D, combo_name, push_combo, step_num)}')
390390

391391
# Check for plastic load reversal at the i-node in this load step
392392
if sub_member.lamb(Delta_D, combo_name, push_combo, step_num)[0, 0] < 0:
@@ -415,7 +415,7 @@ def _pushover_step(model: FEModel3D, combo_name: str, push_combo: str, step_num:
415415
# Undo the last loadstep if plastic load reversal was discovered. We'll rerun it with the corresponding gradients set to zero vectors.
416416
if run_step is True:
417417
_sum_displacements(model, -Delta_D1, D2, D1_indices, D2_indices, model.load_combos[combo_name])
418-
print('Restarting load step')
418+
if log: print('- Restarting load step')
419419

420420
# Sum the calculated displacements
421421
_sum_displacements(model, Delta_D1, D2, D1_indices, D2_indices, model.load_combos[combo_name])

Pynite/FEModel3D.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,15 +1751,14 @@ def Km(self, combo_name='Combo 1', push_combo='Push', step_num=1, log=False, spa
17511751
Km = zeros((len(self.nodes)*6, len(self.nodes)*6))
17521752

17531753
# Add stiffness terms for each physical member in the model
1754-
if log: print('- Calculating the plastic reduction matrix')
17551754
for phys_member in self.members.values():
1756-
1755+
17571756
# Check to see if the physical member is active for the given load combination
17581757
if phys_member.active[combo_name] is True:
17591758

17601759
# Step through each sub-member in the physical member and add terms
17611760
for member in phys_member.sub_members.values():
1762-
1761+
17631762
# Get the member's global plastic reduction matrix
17641763
# Storing it as a local variable eliminates the need to rebuild it every time a term is needed
17651764
member_Km = member.Km(combo_name)
@@ -1768,25 +1767,25 @@ def Km(self, combo_name='Combo 1', push_combo='Push', step_num=1, log=False, spa
17681767
# 'a' & 'b' below are row/column indices in the member's matrix
17691768
# 'm' & 'n' are corresponding row/column indices in the structure's global matrix
17701769
for a in range(12):
1771-
1770+
17721771
# Determine if index 'a' is related to the i-node or j-node
17731772
if a < 6:
17741773
# Find the corresponding index 'm' in the global plastic reduction matrix
17751774
m = member.i_node.ID*6 + a
17761775
else:
17771776
# Find the corresponding index 'm' in the global plastic reduction matrix
17781777
m = member.j_node.ID*6 + (a-6)
1779-
1778+
17801779
for b in range(12):
1781-
1780+
17821781
# Determine if index 'b' is related to the i-node or j-node
17831782
if b < 6:
17841783
# Find the corresponding index 'n' in the global plastic reduction matrix
17851784
n = member.i_node.ID*6 + b
17861785
else:
17871786
# Find the corresponding index 'n' in the global plastic reduction matrix
17881787
n = member.j_node.ID*6 + (b-6)
1789-
1788+
17901789
# Now that 'm' and 'n' are known, place the term in the global plastic reduction matrix
17911790
if sparse is True:
17921791
row.append(m)
@@ -1810,7 +1809,7 @@ def Km(self, combo_name='Combo 1', push_combo='Push', step_num=1, log=False, spa
18101809
# else: Analysis._check_stability(self, Km)
18111810

18121811
# Return the global plastic reduction matrix
1813-
return Km
1812+
return Km
18141813

18151814
def FER(self, combo_name='Combo 1') -> NDArray[float64]:
18161815
"""Assembles and returns the global fixed end reaction vector for any given load combo.
@@ -2235,7 +2234,7 @@ def analyze(self, log=False, check_stability=True, check_statics=False, max_iter
22352234

22362235
# Identify which load combinations have the tags the user has given
22372236
combo_list = Analysis._identify_combos(self, combo_tags)
2238-
2237+
22392238
# Get the auxiliary list used to determine how the matrices will be partitioned
22402239
D1_indices, D2_indices, D2 = Analysis._partition_D(self)
22412240

@@ -2469,23 +2468,25 @@ def _not_ready_yet_analyze_pushover(self, log=False, check_stability=True, push_
24692468
# Apply the pushover load in steps, summing deformations as we go, until the full pushover load has been analyzed
24702469
while load_factor <= 1:
24712470

2472-
print(f'load_factor {load_factor}')
2473-
24742471
# Inform the user which pushover load step we're on
24752472
if log:
24762473
print('- Beginning pushover load step #' + str(step_num))
2474+
print(f'- Load_factor = {load_factor}')
24772475

24782476
# Run the next pushover load step
24792477
Analysis._pushover_step(self, combo.name, push_combo, step_num, P1_push, FER1_push, D1_indices, D2_indices, D2, log, sparse, check_stability)
24802478

24812479
# Update nonlinear material member end forces for each member
2482-
for member in self.members.values():
2483-
member._fxi = member.f(combo.name, push_combo, step_num)[0, 0]
2484-
member._myi = member.f(combo.name, push_combo, step_num)[4, 0]
2485-
member._mzi = member.f(combo.name, push_combo, step_num)[5, 0]
2486-
member._fxj = member.f(combo.name, push_combo, step_num)[6, 0]
2487-
member._myj = member.f(combo.name, push_combo, step_num)[10, 0]
2488-
member._mzj = member.f(combo.name, push_combo, step_num)[11, 0]
2480+
for phys_member in self.members.values():
2481+
2482+
for member in phys_member.sub_members.values():
2483+
2484+
member._fxi = member.f(combo.name, push_combo, step_num)[0, 0]
2485+
member._myi = member.f(combo.name, push_combo, step_num)[4, 0]
2486+
member._mzi = member.f(combo.name, push_combo, step_num)[5, 0]
2487+
member._fxj = member.f(combo.name, push_combo, step_num)[6, 0]
2488+
member._myj = member.f(combo.name, push_combo, step_num)[10, 0]
2489+
member._mzj = member.f(combo.name, push_combo, step_num)[11, 0]
24892490

24902491
# Move on to the next load step
24912492
step_num += 1

0 commit comments

Comments
 (0)