Skip to content

Commit

Permalink
Fix for finding max/min results in a mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
JWock82 committed Nov 14, 2023
1 parent a0ebb60 commit 48845da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
18 changes: 9 additions & 9 deletions PyNite/Mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ def max_shear(self, direction='Qx', combo=None):
xm, ym = 1, 1
xn, yn = -1, 1

# Step through each load combination the element utilizes
for load_combo in element.LoadCombos.values():
# Step through each load combination in the model
for load_combo in self.model.LoadCombos.values():

# Determine if this load combination should be evaluated
if combo == None or load_combo.name == combo:
if combo is None or load_combo.name == combo:

# Find the maximum shear in the element, checking each corner and the center
# of the element
Expand Down Expand Up @@ -202,10 +202,10 @@ def min_shear(self, direction='Qx', combo=None):
xn, yn = -1, 1

# Step through each load combination the element utilizes
for load_combo in element.LoadCombos.values():
for load_combo in self.model.LoadCombos.values():

# Determine if this load combination should be evaluated
if combo == None or load_combo.name == combo:
if combo is None or load_combo.name == combo:

# Find the minimum shear in the element, checking each corner and the center
# of the element
Expand Down Expand Up @@ -270,10 +270,10 @@ def max_moment(self, direction='Mx', combo=None):
xn, yn = -1, 1

# Step through each load combination the element utilizes
for load_combo in element.LoadCombos.values():
for load_combo in self.model.LoadCombos.values():

# Determine if this load combination should be evaluated
if combo == None or load_combo.name == combo:
if combo is None or load_combo.name == combo:

# Find the maximum moment in the element, checking each corner and the center
# of the element
Expand Down Expand Up @@ -338,10 +338,10 @@ def min_moment(self, direction='Mx', combo=None):
xn, yn = -1, 1

# Step through each load combination the element utilizes
for load_combo in element.LoadCombos.values():
for load_combo in self.model.LoadCombos.values():

# Determine if this load combination should be evaluated
if combo == None or load_combo.name == combo:
if combo is None or load_combo.name == combo:

# Find the minimum moment in the element, checking each corner and the center
# of the element
Expand Down
12 changes: 7 additions & 5 deletions Testing/test_tanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ def test_PCA_7_quad(self):

def test_PCA_7_rect(self):
"""
Tests against the example from Section 7 of "Circular Concrete Tanks
without Prestressing" by PCA.
Tests against the example from Section 7 of "Circular Concrete Tanks without Prestressing" by PCA.
"""

# Create a new finite element model
Expand Down Expand Up @@ -161,9 +160,12 @@ def test_PCA_7_rect(self):
My_max_Tim = (1 - 1/(beta*H))*w*R*H*t/(12*(1 - nu**2))**0.5
Qy_max_Tim = -(w*R*H*t)/(12*(1 - nu**2))**0.5*(2*beta - 1/H)

My_max = max([element.moment(element.width()/2, element.height())[1, 0] for element in tank_model.Plates.values()])
My_min = min([element.moment(element.width()/2, element.height()/2)[1, 0] for element in tank_model.Plates.values()])
Sx = max([element.membrane(element.width()/2, element.height()/2)[0, 0] for element in tank_model.Plates.values()])*t
# My_max = max([element.moment(element.width()/2, element.height())[1, 0] for element in tank_model.Plates.values()])
My_max = tank_model.Meshes['MSH1'].max_moment('My')
# My_min = min([element.moment(element.width()/2, element.height()/2)[1, 0] for element in tank_model.Plates.values()])
My_min = tank_model.Meshes['MSH1'].min_moment('My')
# Sx = max([element.membrane(element.width()/2, element.height()/2)[0, 0] for element in tank_model.Plates.values()])*t
Sx = tank_model.Meshes['MSH1'].max_shear('Qx')*t

# Check that the PyNite calculated values are within 5% of expected
# values.
Expand Down

0 comments on commit 48845da

Please sign in to comment.