meshpro / dmsh

:spider_web: Simple mesh generator inspired by distmesh.
GNU General Public License v3.0
210 stars 25 forks source link

coordinates and elements array in poisson problem #64

Closed nikosmatsa closed 3 years ago

nikosmatsa commented 3 years ago

I want to implement a simple poisson problem $-\Delta u = 10$ in a L shape domain given two matrices with coordinates and elements as shown in the link below (my so far effort).The problem is how can I insert them in order to have these specific coordinates?

https://github.com/nikosmatsa/Finite-Differences-Methods-for-PDE-/blob/main/Finite%20Element%20.ipynb

gdmcbain commented 3 years ago

If you've already got the mesh (points and cells), you don't need dmsh, you can go straight to meshio, define

mesh = meshio.Mesh(coordinates, [('tri', elements - 1)])

and either work with mesh directly in Python or save it in one of the many formats that meshio knows (XDMF, Exodus II, VTK, ...).

dmsh on the other hand could have been used to triangulate the domain given just the boundary; see, e.g., the example of dmsh.Polygon on the front page.