Mesh Generation for Computational Science in Python

后端 未结 3 1641
半阙折子戏
半阙折子戏 2021-01-02 09:38

I have a need for a Python module/package that provides a mesh on which I can do computational science? I am not doing graphics, so I don\'t think the blender package is wha

相关标签:
3条回答
  • 2021-01-02 10:01

    The most useful packages out there are perhaps

    • mshr,
    • pygalmesh,
    • dmsh,
    • pygmsh, and
    • MeshPy.

    I've created a repo showcasing a number of examples.

    In addition, there is optimesh for improving the quality of any mesh.

    (Disclaimer: I'm the author of pygmsh, pygalmesh, dmsh, and optimesh.)

    0 讨论(0)
  • 2021-01-02 10:03

    I recommend using NumPy (especially if you've used MATLAB before). Many computational scientists / mechanical engineers working in python might agree, but I'm biased as it found it's way into much of the last year of my research. It's part of SciPy: http://numpy.scipy.org/ I was fond of numpy.linspace(a,b,N) which makes an N length vector of equally spaced values from a to b. You can use numpy.ndarray to make a N x M matrix, or if you want 2D arrays use numpy.meshgrid.

    0 讨论(0)
  • 2021-01-02 10:06

    If you're trying to solve FE or CFD style equations on a mesh you can use MeshPy in 2 and 3 dimensions. Meshpy is a nice wrapper around the existing tools tetgen and triangle.

    If you're looking for more typical graphics style meshes, there was an interesting talk at PyCon 2011 "Algorithmic Generation of OpenGL Geometry", which described a pragmatic approach to procedural mesh generation. The code from the presentation is available online

    If you're interested in reconstruction of surfaces from data, you can't go past the Standford 3D Scanning Repository, home of the Stanford Bunny

    Edit:

    A dependancy free alternative may be to use something like gmsh, which is platform independent, and uses similar tools to meshpy in its back-end.

    0 讨论(0)
提交回复
热议问题