From 48845da3e93d81e764315bff37f71d3286daa847 Mon Sep 17 00:00:00 2001 From: Craig Brinck Date: Mon, 13 Nov 2023 20:01:34 -0500 Subject: [PATCH] Fix for finding max/min results in a mesh --- PyNite/Mesh.py | 18 +++++++++--------- Testing/test_tanks.py | 12 +++++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/PyNite/Mesh.py b/PyNite/Mesh.py index ced6af37..5deeda20 100644 --- a/PyNite/Mesh.py +++ b/PyNite/Mesh.py @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/Testing/test_tanks.py b/Testing/test_tanks.py index 3c0f1679..6250b3b6 100644 --- a/Testing/test_tanks.py +++ b/Testing/test_tanks.py @@ -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 @@ -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.