使用python查找管道的中心线 [英] Finding centre line of a pipe using python

查看:182
本文介绍了使用python查找管道的中心线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在用 Python 编写用于通过管道的流的代码.在这方面,我必须找到一条穿过由 nastran 网格定义的 3D 管道几何形状的中心线(具有三个或四个边缘的单元,我可以访问其坐标).我在 Python 中使用 pyNastran 模块来获取所有相关数据和函数.我的问题是找到管道中心线的最有效方法是什么.管道是一个 3d 管道,在所有方向都有弯曲.(我有一个数组中网格上每个点的所有坐标)

I am currently writing a code in Python for flows through pipes. In this regard, I have to find a centre line passing thorough a 3D pipe geometry defined by a nastran mesh (cells with three or four edges whose coordinates i can access). I am using the pyNastran module in Python to get all the relevant data and functions. My question is what would be the most efficient way of finding the centre line of the pipe. The pipe is a 3d pipe with bends in all direction. ( I have all the coordinates of every single point on the mesh in an array)

推荐答案

这不是那么容易的话题 :-/问题是中心线不是局部属性.

That is not so easy topic :-/ Problem is that center line is not local property.

当然,中心线上的每个点对应于管道的一个切片或更简单地对应于管道表面的一个周长.对于根据局部特征定义这种关系的任何类型,很容易找到弯曲或改变管道直径的示例,这些示例会产生奇怪"的结果.

For sure, each point on center line corresponds to one slice through pipe or simpler to one perimeter on pipe surface. For any kind of defining that relation on local characteristics, it is easy to find example with bendings or changing pipe diameter that produces 'strange' result.

解决此问题的一种方法是查找此处需要的具有相似属性的主题.就像我们希望切片平行"并均匀地通过管道.在一个项目中,我们使用热扩散/传递来解决一个问题.想法是设置边界条件,在管道一侧设置边界条件 1,在另一侧设置边界条件 0.热量会从一侧传递到另一侧,isoterm 将具有良好的特性.

One way to solve it is to look for topics that have similar properties that are needed here. Like we want slices to be 'parallel' and to uniformly pass through pipe. On one project we used heat diffusion/transfer to tackle a problem. Idea is to put boundary conditions, on one pipe side set boundary condition 1 and on the other side boundary condition 0. Heat will transfer from one side to the other and isoterm will have good properties.

之后,选择中心线离散化(在 [0-1] 上),为每个点找到该温度上的等项并找到该等项的质心.连接这些中心将产生中心线.

After that, choose center line discterization (on [0-1]), for each point find isoterm on that temperature and find center of mass of that isoterm. Connecting these centers will produce center line.

可以在 3D(体积)和 2D(表面)情况下进行扩散.在表面上做可能会更快.

It is possible to make diffusion on 3D (volume) and 2D (surface) case. It is probably faster to do it on surface.

这篇关于使用python查找管道的中心线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆