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

holes #4

Closed
gdmcbain opened this issue Jan 20, 2021 · 3 comments
Closed

holes #4

gdmcbain opened this issue Jan 20, 2021 · 3 comments

Comments

@gdmcbain
Copy link

The example of holes,

from adaptmesh import triangulate

m = triangulate([(0., 0.),
                 (1., 0.),
                 (1., 1.),
                 (0., 1.),],
                holes=[[(.25, .25),
                        (.75, .25),
                        (.75, .75),
                        (.25, .75)]])

raises

Traceback (most recent call last):
  File "holes.py", line 3, in <module>
    m = triangulate([(0., 0.),
TypeError: triangulate() got an unexpected keyword argument 'holes'
@gdmcbain
Copy link
Author

The application here is reproducing one of FEniCS's tutorials in scikit-fem, unsteady incompressible two-dimensional Navier–Stokes flow over a cylinder; gdmcbain/fenics-tuto-in-skfem#5.

There I had used pygmsh; this being written before the change in licence and especially before everything was broken in pygmsh 7. kinnala/scikit-fem#482

https://github.com/gdmcbain/fenics-tuto-in-skfem/blob/8af478a47250ec41c634f3f056cddd2215fedbcc/08_navier_stokes_cylinder/st08_navier_stokes_cylinder.py#L49-L58

Then I had been using https://github.com/nschloe/dmsh

from pathlib import Path

import dmsh
import skfem
import skfem.io.json

length = 2.2
height = 0.41
radius = 0.05

geo = dmsh.Difference(
    dmsh.Rectangle(0.0, length, 0.0, height),
    dmsh.Circle([.2, .2], radius)
)

points, triangles = dmsh.generate(geo, 0.025, tol=1e-9)
mesh = skfem.MeshTri(points.T, triangles.T)
mesh.define_boundary("inlet", lambda x: x[0] == .0)
mesh.define_boundary("outlet", lambda x: x[0] == length)

skfem.io.json.to_file(mesh, Path(__file__).with_suffix('.json'))

which was working well for a few months but it's been bitten a couple of times recently with upstream changes to dmsh and its dependency meshplex resulting variously in

  • Exception: Mesh._validate(): Mesh contains a vertex not belonging to any element.
  • AttributeError: 'MeshTri' object has no attribute 'node_coords' (this being meshplex.MeshTri, not skfem.MeshTri)
  • UserWarning: Mesh._validate(): Mesh contains duplicate vertices.

so I thought I might dump dmsh and look for alternatives.

What's the status of holes for adaptmesh.triangulate?

@kinnala
Copy link
Owner

kinnala commented Jan 20, 2021 via email

@gdmcbain
Copy link
Author

Ah, yes, master works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants