@@ -141,21 +141,38 @@ def test_concrete_circular_section():
141141def test_concrete_column_section ():
142142
143143 concrete = pre .Material (
144- name = 'Concrete' , elastic_modulus = 30.1e3 , poissons_ratio = 0.2 , yield_strength = 32 ,
145- density = 2.4e-6 , color = 'lightgrey'
144+ name = "Concrete" ,
145+ elastic_modulus = 30.1e3 ,
146+ poissons_ratio = 0.2 ,
147+ yield_strength = 32 ,
148+ density = 2.4e-6 ,
149+ color = "lightgrey" ,
146150 )
147151 steel = pre .Material (
148- name = 'Steel' , elastic_modulus = 200e3 , poissons_ratio = 0.3 , yield_strength = 500 ,
149- density = 7.85e-6 , color = 'grey'
152+ name = "Steel" ,
153+ elastic_modulus = 200e3 ,
154+ poissons_ratio = 0.3 ,
155+ yield_strength = 500 ,
156+ density = 7.85e-6 ,
157+ color = "grey" ,
150158 )
151159
152160 geometry = cs .concrete_column_section (
153- b = 300 , d = 600 , dia_bar = 40 , bar_area = 500 , cover = 40 , n_bars_b = 3 , n_bars_d = 6 ,
154- conc_mat = concrete , steel_mat = steel , filled = False , n_circle = 4
155- ) # NOTE: Bar diam and Bar area do not match. This is intentional.
161+ b = 300 ,
162+ d = 600 ,
163+ dia_bar = 40 ,
164+ bar_area = 500 ,
165+ cover = 40 ,
166+ n_bars_b = 3 ,
167+ n_bars_d = 6 ,
168+ conc_mat = concrete ,
169+ steel_mat = steel ,
170+ filled = False ,
171+ n_circle = 4 ,
172+ ) # NOTE: Bar diam and Bar area do not match. This is intentional.
156173 geometry .create_mesh (mesh_sizes = [500 ])
157174
158- # check geometry is created correctly
175+ # check geometry is created correctly
159176 conc_area = 0
160177 steel_area = 0
161178
@@ -170,24 +187,25 @@ def test_concrete_column_section():
170187 )
171188
172189 net_area = 300 * 600
173- actual_steel_area = 14 * 500.
174-
190+ actual_steel_area = 14 * 500.0
191+
175192 check .almost_equal (conc_area , net_area - actual_steel_area , rel = r_tol )
176193 check .almost_equal (steel_area , actual_steel_area , rel = r_tol )
177194
178195 bar_centroids = [tuple (geom .geom .centroid .coords [0 ]) for geom in geometry .geoms [1 :]]
179196
180197 from collections import Counter
198+
181199 x_coords = Counter (round (coord [0 ], 0 ) for coord in bar_centroids )
182200 y_coords = Counter (round (coord [1 ], 0 ) for coord in bar_centroids )
183201
184202 # Validate that we have 14 bars with the correct x-coordinates
185- check .equal (x_coords .get (60 ) , 6 )
203+ check .equal (x_coords .get (60 ), 6 )
186204 check .equal (x_coords .get (150 ), 2 )
187205 check .equal (x_coords .get (240 ), 6 )
188206
189207 # Validate that we have 14 bars with the correct y-coordinates
190- check .equal (y_coords .get (60 ) , 3 )
208+ check .equal (y_coords .get (60 ), 3 )
191209 check .equal (y_coords .get (156 ), 2 )
192210 check .equal (y_coords .get (252 ), 2 )
193211 check .equal (y_coords .get (348 ), 2 )
@@ -198,16 +216,20 @@ def test_concrete_column_section():
198216def test_add_bar ():
199217 rect = ps .rectangular_section (b = 400 , d = 600 )
200218 steel = pre .Material (
201- name = 'Steel' , elastic_modulus = 200e3 , poissons_ratio = 0.3 , yield_strength = 500 ,
202- density = 7.85e-6 , color = 'grey'
219+ name = "Steel" ,
220+ elastic_modulus = 200e3 ,
221+ poissons_ratio = 0.3 ,
222+ yield_strength = 500 ,
223+ density = 7.85e-6 ,
224+ color = "grey" ,
203225 )
204226 rect = cs .add_bar (rect , area = 500 , x = 100 , y = 100 , material = steel )
205227 rect = cs .add_bar (rect , area = 500 , x = 200 , y = 200 , material = steel )
206228 rect_area = rect .geoms [0 ].geom .area
207- steel_area = 2 * 500.
208- check .almost_equal (rect_area , 400 * 600 - steel_area )
209-
229+ steel_area = 2 * 500.0
230+ check .almost_equal (rect_area , 400 * 600 - steel_area )
231+
210232 bar_1 = rect .geoms [1 ]
211233 bar_2 = rect .geoms [2 ]
212234 check .almost_equal (bar_1 .calculate_centroid (), (100 , 100 ))
213- check .almost_equal (bar_2 .calculate_centroid (), (200 , 200 ))
235+ check .almost_equal (bar_2 .calculate_centroid (), (200 , 200 ))
0 commit comments