Skip to content

Boundary layer working oddly on long edges #506

@TheCrowned

Description

@TheCrowned

There seems to be some weird issue with boundary refinement through the addition of a boundary layer. If the line along which to refine is too long, the refinement will be spotty. Instead, if I add more points to the boundary and refine all the edges connecting them, then the refinement is nice and smooth. Switch between points1 and points2 in the code below to see the difference.

Here is the (bad) result with points1:
bad-refinement

Here is the (good) result with points2:
good-refinement

Obviously the expected outcome (at least to me) is the second.
Tested with pygmsh version 7.1.14.

import pygmsh

points1 = [ (0,0,0), (10,0,0), (10,1,0), (0,1,0) ]
points2 = [ (0,0,0) ] + [ (x,0,0) for x in range(11) ] + [ (10,1,0), (0,1,0) ]

points = points2
with pygmsh.geo.Geometry() as geom:
    poly = geom.add_polygon(points, mesh_size=0.05)

    # Refine
    refine_lines = [poly.curve_loop.curves[i] for i in range(len(points)-3)]
    field0 = geom.add_boundary_layer(
        edges_list=refine_lines,
        lcmin=0.01,
        lcmax=0.05,
        distmin=0.15, # distance up until which mesh size will be lcmin
        distmax=0.25, # distance starting at which mesh size will be lcmax
    )
    geom.set_background_mesh([field0], operator="Min")

    mesh = geom.generate_mesh()
    mesh.write('mesh.xdmf')

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