Mesh generation with overlapping geometries
See original GitHub issueDescribe the bug Hi Robbie
I’ve been playing around with how merging sections works and noted a few odd things happening that may either be bugs or simply limitations in the code or the way geometry can be merged that might need further investigation or at a the very least some additional coverage in the documentation if these are limitations.
Merging two geometries where they are touching or overlapping has mixed effects on the mesh generated. API documentation seems to only briefly discuss/note that overlapping geometries can be merged and cleaning the geometry will attempt to fix any issues with the mesh. I have noted in testing some scenarios that the mesh seems to be created but seems to bug out a bit and assume this is not intended!
Consider the following 4 scenarios which might cover practical use cases for generating merged sections to demonstrate the varying results in the mesh being generated:-
- If the two geometries just touch, and no closed regions are created the mesh seems to be generated as intended. Assuming this is the intended behaviour.
- If the two geometries just overlap, say one goes into the other by 5mm, the mesh seems to be created ok, with facets on the lines of overlap. Assuming this is the intended behaviour. Though see point on the control point in 3 below as may also trigger incorrect mesh if control point is in the overlap region.
- If the two geometries fully overlap such that part of the geometry completely crosses the other, the mesh seems to bug out as shown in this screenshot. Assuming either this is a bug or simply not possible to generate geometry like this. In practice you might use this method to model plates on either side of a central plate to simply generating the model. But might need to be split into another geometry for each projection, or add documentation around this limitation? I am assuming its something to do with there being no control point within one ‘part’ of the section as the mesh seems ok within the regions with the control point specified (similar to what was discussed in #1)
- If the two geometries are merged such that a closed internal ‘hole’ is created, again the meshing seems to bug out and takes the closed region as being solid. There does not seem to be any way to account for the hole being a hole. Again the mesh seems to bug out with a larger mesh in the hole region. I assume this is not intended, nor does there seem to be any practical way to join predefined sections with the formation of a hole and get the code to treat it as a hole. I assume in this case the only way to do it would be to generate the whole thing as one custom section and define the hole? Or is there something I’m missing here to get it working as intended?
To Reproduce Run the code below to demonstrate all 4 scenarios:
import sectionproperties.pre.sections as sections
from sectionproperties.analysis.cross_section import CrossSection
# Scenario 1 - just touching, assume this is intended behaviour regarding meshing
geometry1 = sections.AngleSection(d=150, b=100, t=8, r_r=12, r_t=5, n_r=16, shift=[230, 200])
geometry1.rotate_section(angle=180, rot_point=[230, 200])
geometry2 = sections.ISection(d=250, b=250, t_f=20, t_w=10, r=10, n_r=10)
geometry = sections.MergedSection([geometry1, geometry2])
geometry.clean_geometry(verbose=True)
mesh = geometry.create_mesh(mesh_sizes=[5, 5])
section = CrossSection(geometry, mesh)
section.display_mesh_info()
section.plot_mesh()
# Scenario 2 - slightly overlapping, assume this is the intended behaviour (provided control point is not in the overlapped region)
geometry1 = sections.AngleSection(d=150, b=100, t=8, r_r=12, r_t=5, n_r=16, shift=[223, 200])
geometry1.rotate_section(angle=180, rot_point=[223, 200])
geometry2 = sections.ISection(d=250, b=250, t_f=20, t_w=10, r=10, n_r=10)
geometry = sections.MergedSection([geometry1, geometry2])
geometry.clean_geometry(verbose=True)
mesh = geometry.create_mesh(mesh_sizes=[5, 5])
section = CrossSection(geometry, mesh)
section.display_mesh_info()
section.plot_mesh()
# Scenario 3 - two geometries completely overlapping, mesh only generated correctly within the regions with the control points?
geometry1 = sections.AngleSection(d=150, b=100, t=8, r_r=12, r_t=5, n_r=16, shift=[150, 200])
geometry1.rotate_section(angle=180, rot_point=[150, 200])
geometry2 = sections.ISection(d=250, b=250, t_f=20, t_w=10, r=10, n_r=10)
geometry = sections.MergedSection([geometry1, geometry2])
geometry.clean_geometry(verbose=True)
mesh = geometry.create_mesh(mesh_sizes=[5, 5])
section = CrossSection(geometry, mesh)
section.display_mesh_info()
section.plot_mesh()
# Scenario 4 - just touching but formation of a closed region, as no way to recognise the formation of the 'hole'?
geometry1 = sections.AngleSection(d=150, b=100, t=8, r_r=12, r_t=5, n_r=16, shift=[230, 170])
geometry1.rotate_section(angle=180, rot_point=[230, 170])
geometry2 = sections.ISection(d=250, b=250, t_f=20, t_w=10, r=10, n_r=10)
geometry = sections.MergedSection([geometry1, geometry2])
geometry.clean_geometry(verbose=True)
mesh = geometry.create_mesh(mesh_sizes=[5, 5])
section = CrossSection(geometry, mesh)
section.display_mesh_info()
section.plot_mesh()
Expected behavior Some way of accounting for these scenarios without having to resort to defining custom sections (in the case of scenario 4) or more geometry elements (in the case of scenario 3)?
Or outline any limitations in the geometry merging method in the documentation?
Desktop (please complete the following information):
- OS: Windows 10
- Version - latest master commit 90f8ffb485c631a0e497ae3d86a682316e0747b7
Many thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:16 (8 by maintainers)
Hi Agent6-6-6,
Thanks for looking into this. I am really at the mercy of the meshing algorithm I chose to implement when it comes to mesh generation as this is a topic that is well outside of my area of knowledge. Having said that, triangle is an excellent mesh generation tool and I am probably (almost definitely) not fully utilising its potential!
Regarding the above examples:
geometry.add_hole([200, 100])
- you can see this in action in the example below. Although there may be some way to program a way of detecting this issue, for me at least, this is a problem that is beyond my expertise when you consider that arbitrary sections can be formed from merging an infinite number of arbitrary sub-sections. I would advise the user to check the mesh and add holes as required.Here’s a bonus fifth scenario building on scenario four - a welded angle to i-section with variables for weld size and section separation:
Also it may be because you are trying to do a draft PR? I only have a free account so it may not work: