Python 中计算科学的网格生成
我需要一个 Python 模块/包来提供可以进行计算科学的网格?我不做图形,所以我不认为搅拌机包是我想要的。
有谁知道有什么好的套餐吗?
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 what I want.
Does anyone know of a good package?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
最有用的软件包可能是
此外,还有 optimesh 用于提高任何网格的质量。
(免责声明:我是 pygmsh、pygalmesh、dmsh、meshzoo 和 optimesh 的作者。)
The most useful packages out there are perhaps
In addition, there is optimesh for improving the quality of any mesh.
(Disclaimer: I'm the author of pygmsh, pygalmesh, dmsh, meshzoo, and optimesh.)
如果您尝试在网格上求解 FE 或 CFD 样式方程,您可以在 2 中使用 MeshPy和 3 个维度。 Meshpy 是现有工具 tetgen 和 三角形。
如果您正在寻找更典型的图形样式网格,PyCon 2011 上有一个有趣的演讲 “OpenGL 几何图形的算法生成”,描述了程序网格生成的实用方法。演示文稿中的代码可以在线获取。
如果您对根据数据重建表面感兴趣,您可以'不要经过 斯坦福 3D 扫描存储库,斯坦福兔子的家
编辑:
无依赖的替代方案可能是使用 gmsh 之类的东西,它是平台独立,并在后端使用与 meshpy 类似的工具。
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.
这是改编自 Kardontchik 端口的代码,
Here is code adapted from Kardontchik's port,
我建议使用 NumPy(特别是如果您以前使用过 MATLAB)。许多使用 Python 工作的计算科学家/机械工程师可能会同意,但我有偏见,因为它发现它在我去年的研究中占据了很大一部分。它是 SciPy 的一部分:链接
我喜欢 numpy.linspace(a,b,N) ,它生成一个由 a 到 b 等间隔值组成的 N 长度向量。您可以使用numpy.ndarray来创建一个N x M矩阵,或者如果您想要二维数组,请使用numpy.meshgrid。
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: Link
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.