Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve meshing #173

Merged
merged 8 commits into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions femwell/mesh/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,17 @@ def mesh_from_OrderedDict(
"SurfacesList",
meshtracker.get_gmsh_xy_surfaces_from_label(label),
)

gmsh.model.mesh.field.setNumbers(
n + 1,
"CurvesList",
meshtracker.get_gmsh_xy_lines_from_label(label),
)

gmsh.option.setNumber("Mesh.MeshSizeExtendFromBoundary", 0)
gmsh.option.setNumber("Mesh.MeshSizeFromPoints", 0)
gmsh.option.setNumber("Mesh.MeshSizeFromCurvature", 0)
Comment on lines +369 to +371
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simbilod didn't you put those options already somewhere? Or is that only in meshwell?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duarte-jfs is there a reason why you add the last three lines again?

it's already done in (and the two following lines)

gmsh.model.mesh.MeshSizeFromPoints = 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry for getting back to you so late. I just looked at this again. To be honest, I don't understand it either. But the behaviour is different if you incliude the lines as I did. No clue why

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it is also seems that gmsh.model.mesh.MeshSizeFromPoints = 0 is not equivalent to gmsh.option.setNumber("Mesh.MeshSizeFromPoints", 0) (and likewise for the other two lines). I tried to use them interchangeably and the behaviour is different

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then I'm totally fine with just merging it :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this will also add the mesh constraint on the curves and not just the surface (interior)

Meshwell has much more advanced resolution settings now, we should finish the migration #52


# Around surface
mesh_distance = mesh_setting["distance"]
gmsh.model.mesh.field.add("Distance", n + 2)
Expand Down
Loading