robbievanleeuwen / section-properties

Analysis of an arbitrary cross-section in python using the finite element method.
https://sectionproperties.rtfd.io
MIT License
412 stars 92 forks source link

Units error in meshing module #413

Closed thomas-ward27 closed 4 months ago

thomas-ward27 commented 4 months ago

hi Robbie there is some bug in the meshing module when meshing in metres, I would expect both the following to give the same mesh

d=50
t=5
sections.box_girder_section(d=d, b_t=d,b_b=d, t_ft=t,t_fb=t,t_w=t)#, r_out=15, n_r=16)
rhs_mesh = rhs_geometry.create_mesh(mesh_sizes=[t/2])
rhs_section.plot_mesh(pause=False)

d/=1e3
t/=1e3
rhs_mesh = rhs_geometry.create_mesh(mesh_sizes=[t/2])
rhs_section.plot_mesh(pause=False)
github-actions[bot] commented 4 months ago

Thanks for opening your first issue in sectionproperties :raised_hands: Pull requests are always welcome :wink:

robbievanleeuwen commented 4 months ago

Hi @thomas-ward27, the mesh_sizes parameter describes the maximum mesh element area and not length, this is why you are not getting the same mesh. See the docs for more info.

The code in your original post is missing several references so I based my answer off the following, including the fix for the mesh size (requires an additional scaling factor to ensure the mesh size is in square metres). I get the same mesh for both cases.

import sectionproperties.pre.library.steel_sections as sections
from sectionproperties.analysis import Section

# millimetres
d=50
t=5
rhs_geometry = sections.box_girder_section(d=d, b_t=d,b_b=d, t_ft=t,t_fb=t,t_w=t)#, r_out=15, n_r=16)
rhs_mesh = rhs_geometry.create_mesh(mesh_sizes=[t/2])
rhs_section = Section(rhs_mesh)
rhs_section.plot_mesh()

# metres
d=50e-3
t=5e-3
rhs_geometry = sections.box_girder_section(d=d, b_t=d,b_b=d, t_ft=t,t_fb=t,t_w=t)#, r_out=15, n_r=16)
rhs_mesh = rhs_geometry.create_mesh(mesh_sizes=[(t/2)/1e3])
rhs_section = Section(rhs_mesh)
rhs_section.plot_mesh()
thomas-ward27 commented 4 months ago

Thanks Robbie, area makes sense sorry I didn't read the documentation before bothering you with that spam.

regards

Thomas

On Thu, Apr 4, 2024 at 1:46 AM Robbie van Leeuwen @.***> wrote:

Hi @thomas-ward27 https://github.com/thomas-ward27, the mesh_sizes parameter describes the maximum mesh element area and not length, this is why you are not getting the same mesh. See the docs https://sectionproperties.readthedocs.io/en/stable/user_guide/meshing.html for more info.

The code in your original post is missing several references so I based my answer off the following, including the fix for the mesh size (requires an additional scaling factor to ensure the mesh size is in square metres). I get the same mesh for both cases.

import sectionproperties.pre.library.steel_sections as sectionsfrom sectionproperties.analysis import Section

millimetresd=50t=5rhs_geometry = sections.box_girder_section(d=d, b_t=d,b_b=d, t_ft=t,t_fb=t,t_w=t)#, r_out=15, n_r=16)rhs_mesh = rhs_geometry.create_mesh(mesh_sizes=[t/2])rhs_section = Section(rhs_mesh)rhs_section.plot_mesh()

metresd=50e-3t=5e-3rhs_geometry = sections.box_girder_section(d=d, b_t=d,b_b=d, t_ft=t,t_fb=t,t_w=t)#, r_out=15, n_r=16)rhs_mesh = rhs_geometry.create_mesh(mesh_sizes=[(t/2)/1e3])rhs_section = Section(rhs_mesh)rhs_section.plot_mesh()

— Reply to this email directly, view it on GitHub https://github.com/robbievanleeuwen/section-properties/issues/413#issuecomment-2035881393, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQDTZHIDIRTU3VHDGOYDXSDY3SWINAVCNFSM6AAAAABFV7R3HGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZVHA4DCMZZGM . You are receiving this because you were mentioned.Message ID: @.***>