注册 登录
流体中文网 返回首页

gearboy的个人空间 http://cfluid.com/?15372 [收藏] [复制] [分享] [RSS]

日志

根据坐标来得到cell

已有 1453 次阅读2013-4-17 13:43 |个人分类:UDF使用技巧

Here is the example, Note: the location of the specified point must be in the computational domain, otherwise error will occur.

#include "udf.h"
DEFINE_ON_DEMAND(find_cell)
{
cell_t c;
Thread *t;
CX_Cell_Id cx_cell;
real NV_VEC(pt);
real c_centroid[ND_ND];
NV_D(pt, =, 0.5, 0.3, 0.2); //coordinate of your specified location,it must be in the domain coordinate range
CX_Start_ND_Point_Search();
cx_cell=*CX_Find_Cell_With_Point(pt);
CX_End_ND_Point_Search();
c=RP_CELL(&cx_cell); //the right cell number
t = RP_THREAD(&cx_cell); // the thread
C_CENTROID(c_centroid,c,t);
Message0("coordinate of the specified point: x=%g,y=%g,z=%g\n",pt[0],pt[1],pt[2]);
Message0("coordinate of the cell found: x=%g,y=%g,z=%g\n",c_centroid[0],c_centroid[1],c_centroid[2]);
}

发表评论 评论 (1 个评论)

回复 vcd2003 2013-5-23 18:29
:hug:

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

返回顶部