Skip to content

Add tips and tricks to tutorials on meshing #237

Description

@duarte-jfs

The break_line() can still give some points on a polygon that get extremely close together which can lead to gmsh interpreting those points as equal, but shapely does not, and leads to the meshtracker asking gmsh to create a line with two points that while shapely treats as separate to equal points as interpreted by shapely. A fix is to add:

            else:
                lines_broken_dict[first_name] = (
                    MultiLineString(broken_shapes) if len(broken_shapes) > 1 else broken_shapes[0]
                )

        # Add lines, reusing line segments

        for line_name, line in lines_broken_dict.items():
            meshtracker.add_get_xy_line(line, line_name)

        # Add surfaces, reusing lines
        for polygon_name, polygon in polygons_broken_dict.items():
            polygon = polygon.simplify(1e-4, preserve_topology=True) <-----------ADD THIS
            meshtracker.add_xy_surface(polygon, polygon_name)

        # Embed lines in surfaces if required
        for index_surface in range(len(meshtracker.shapely_xy_surfaces)):
            polygon = meshtracker.shapely_xy_surfaces[index_surface]
            for index_segment in range(len(meshtracker.shapely_xy_segments)):
                line = meshtracker.shapely_xy_segments[index_segment]

                intersection = line - polygon.exterior
                if not intersection.is_empty and polygon.contains(intersection):
                    model.in_surface(
                        meshtracker.gmsh_xy_segments[index_segment],
                        meshtracker.gmsh_xy_surfaces[index_surface],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions