Skip to content

fix: gross properties sign#131

Merged
mortenengen merged 1 commit intodevfrom
fix-gross-properties-sign
Aug 7, 2024
Merged

fix: gross properties sign#131
mortenengen merged 1 commit intodevfrom
fix-gross-properties-sign

Conversation

@talledodiego
Copy link
Collaborator

@talledodiego talledodiego commented Aug 7, 2024

Fixed issue mentioned in #113: the gross properties were not working with section defined with negative coordinates.

This code now works as expected (tested both with default Marin and Fiber integrator)

# Imports
from shapely import Polygon
from structuralcodes.materials.concrete import ConcreteEC2_2004
from structuralcodes.geometry import SurfaceGeometry,CompoundGeometry
from structuralcodes.sections import GenericSection

# Materials
concrete = ConcreteEC2_2004(25)
# Create Geometry and Section
poly = Polygon(((0, 0), (350, 0), (350, 500), (0, 500)))
geo = SurfaceGeometry(poly, concrete)
# Passing Compound as following is no longer necessary with PR#130
sec = GenericSection(CompoundGeometry([geo]))
# sec = GenericSection(CompoundGeometry([geo]),integrator='fiber',mesh_size=0.001)

poly_neg = Polygon(((0, 0), (-350, 0), (-350, -500), (0, -500)))  # -500 instead of 500
geo_neg = SurfaceGeometry(poly_neg, concrete)
# Passing Compound as following is no longer necessary with PR#130
sec_neg = GenericSection(CompoundGeometry([geo_neg]))
# sec_neg = GenericSection(geo_neg,integrator='fiber',mesh_size=0.001)

print(f'I11 = {round(sec.gross_properties.i11*1e-4)} cm4') 
print(f'I11_neg = {round(sec_neg.gross_properties.i11*1e-4)} cm4')
print(f'Sy = {round(sec.gross_properties.sy*1e-3)} cm3') 
print(f'Sy_neg = {round(sec_neg.gross_properties.sy*1e-3)} cm3')

print(f'I22 = {round(sec.gross_properties.i22*1e-4)} cm4') 
print(f'I22_neg = {round(sec_neg.gross_properties.i22*1e-4)} cm4')
print(f'Sz = {round(sec.gross_properties.sz*1e-3)} cm3') 
print(f'Sz_neg = {round(sec_neg.gross_properties.sz*1e-3)} cm3')

The output is:

I11 = 364583 cm4
I11_neg = 364583 cm4
Sy = 43750 cm3
Sy_neg = -43750 cm3
I22 = 178646 cm4
I22_neg = 178646 cm4
Sz = 30625 cm3
Sz_neg = -30625 cm3

Fixed issue mentioned in #113: the gross properties were not working with section defined with negative coordinates.
@talledodiego talledodiego added the bug Something isn't working label Aug 7, 2024
@talledodiego talledodiego added this to the v0.0.1 milestone Aug 7, 2024
@mortenengen mortenengen removed this from the v0.0.1 milestone Aug 7, 2024
@mortenengen mortenengen changed the title fix gross properties sign fix: gross properties sign Aug 7, 2024
Copy link
Member

@mortenengen mortenengen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good!

@mortenengen mortenengen merged commit f154f5b into dev Aug 7, 2024
@mortenengen mortenengen deleted the fix-gross-properties-sign branch August 7, 2024 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done 🚀

Development

Successfully merging this pull request may close these issues.

2 participants