Skip to content

Bug in section.gross_properties in relation to calculate_moment_curvature() #303

@elliotmelcer

Description

@elliotmelcer

calculate_moment_curvature() affects section.gross_properties

I have noticed that the gross section properties of a section channge if calculate_moment_curvature() is run before evaluating them. Here is my code and a visualization of the cross-section (not included in the provided code). This seems similar to issue #297.

from structuralcodes import set_design_code
from structuralcodes.geometry import SurfaceGeometry, add_reinforcement_line
from structuralcodes.materials.concrete import create_concrete
from structuralcodes.materials.reinforcement import create_reinforcement
from structuralcodes.sections import GenericSection

set_design_code('ec2_2004')

# hp_geometry stuff
b  = 300      #mm
b1 = 50
b0 = 200
d = 200
d1 = 200
d0 = 400
cover = 50

polygon = Polygon(
    [
        (-b /2,  d/2),
        (-b /2, -d/2),
        (-b0/2, -d/2),
        (-b0/2, -d/2-d1),
        ( b0/2, -d/2-d1),
        ( b0/2, -d/2),
        ( b /2, -d/2),
        ( b /2,  d/2),
    ]
)

# --- Material Properties ---
# concrete
concrete_c40= create_concrete(fck=40, constitutive_law = 'parabolarectangle', alpha_cc = 0.85, gamma_c = 1.5)

# steel reinforcemenet
reinforcement = create_reinforcement(fyk=500, Es=200000, ftk=500, epsuk=0.025, density=7850, constitutive_law="elasticperfectlyplastic")

# --- concrete section ---
geometry = SurfaceGeometry(
    poly=polygon, material=concrete_c40
)

geometry = add_reinforcement_line(
    geometry,
    (-b0/2+cover, -d/2 - d1 + cover),
    (b0/2-cover, -d/2 - d1 + cover),
    20,
    reinforcement,
    3
)

def return_section_properties(sec: GenericSection) -> str:
    # --- Geometric Properties ---
    gross_props = sec.gross_properties

    cz = gross_props.cz
    iyy = gross_props.iyy
    e_iyy = gross_props.e_iyy
    ea = gross_props.ea

    props = (f"I_yy={iyy:.2e} mm^4, "
          f"EA={ea:.3e} N, "
          f"EI_yy={e_iyy:.4e} Nmm^2, "
          f"cz={cz:.2e} mm, ")
    return props


section = GenericSection(geometry, integrator="marin")

print(return_section_properties(section))
moment_curvature = section.section_calculator.calculate_moment_curvature()
print(return_section_properties(section))
Image

You'll notice that the output changes whether you do the moment curvature calculation before or after the print statement.

For configuration 1:

print(return_section_properties(section))
moment_curvature = section.section_calculator.calculate_moment_curvature()

The Output is:

I_yy=1.99e+09 mm^4, EA=2.455e+09 N, EI_yy=5.5603e+13 mm^4, cz=-9.31e+01 mm,

And for configuration 2:

moment_curvature = section.section_calculator.calculate_moment_curvature()
print(return_section_properties(section))

The output is:

I_yy=1.93e+09 mm^4, EA=2.455e+09 N, EI_yy=4.3822e+13 mm^4, cz=-7.39e+01 mm, 

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions