kinnala / adaptmesh

Mesh generation by the adaptive process
Other
35 stars 4 forks source link

holes #4

Closed gdmcbain closed 3 years ago

gdmcbain commented 3 years ago

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 commented 3 years ago

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

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

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

kinnala commented 3 years ago

It should accept the parameter in the latest commit, see https://github.com/kinnala/adaptmesh/blob/master/adaptmesh/__init__.py#L15. Plan was to release in a few weeks when I finish a paper revision.

gdmcbain commented 3 years ago

Ah, yes, master works. Thanks!