1 / 26
文档名称:

UDF总结.doc

格式:doc   大小:235KB   页数:26页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

UDF总结.doc

上传人:zxwziyou8 2022/1/1 文件大小:235 KB

下载得到文件列表

UDF总结.doc

文档介绍

文档介绍:UDF使用技巧
1、查找相应的函数的时候,可以现在word里面找到相应的函数名字,然后依次去中文帮助文档、英文帮助文档和网页帮助文档,看看详细解释并找找是否有相应的例子。
2、打个比方来说,thread就是公路,连接的cell和face,cell和face就相当于公路上汽车停靠的站点,
cell_t这个面向的是单元,而face_t面向的是边或者面(二维或三维)在fluent循环过程中,一般是用thread作线程检索,而cell或者face作检索过程中位置(相当于指示位置的参数)参数的指示
3、对于UDF来说,积分就是做加法,把通过面上每个网格的质量流量相加
4、cell和face的区别,什么时候用cell,什么时候用face?
5、1. begin, end_c_loop macro is used for looping over all the cells in particular thread for serial processing.
2. For parallel processing, the cells inside a partition can be categorized as interior and exterior cells.
3. The macros begin, end_c_loop_int; begin, end_c_loop_ext and begin, end_c_loop_all are used for looping over interior, exterior and all the cells (in a partition) respectively.
4. In parallel simulations, both begin, end_c_loop and begin, end_c_loop_all macros will do the same job.
5. For faces the looping macro in parallel are begin, end_f_loop_int; begin, end_f_loop_ext and begin, end_f_loop for looping over interior, boundary and all faces respectively. For all practical purpose, the user need not separate the interior and boundary faces of a partition. Hence, begin, end_f_loop_int and begin, end_f_loop_ext macros are rarely used.
实际问题
1、DEFINE_UDS_UNSTEADY中的apu包括的函数是不是不包括当前时刻的变量,而su包含前一时刻的变量,所以用了C_STORAGE_R存储前一时刻的变量。
2、等于零是因为计算源项的时候温度还没有更新,所以两个温度值是相等的。这个时候其实是需要两个UDM,分别保存上一步和再上一步的温度。而且可以考虑全部在源项里完成,不用Adjust宏:
source=(C_UDMI(c,t,1)-C_UDMI(c,t,0))/TIME_STEP;
C_UDMI(c,t,0)=C_UDMI(c,t,1);
C_UDMI(c,t,1)=C_T(c,t);
return source;当然,在刚开始计算的时候要注意下UDM的初始问题,防止出错。从第三个时间步开始,就是正常的了。
这个方法挺好的,只要一开始的用DEFINE_INIT,对
C_UDMI(c,t,0)=0.;
C_UDMI(c,t,1)=0.;
一、数据类型
cell_t c
单元格标识符
face_t f
面标识符
Thread *t
指向线程的指针
Thread **pt
象限矩阵线程的指针
Node *node
指向节点的指针
Domain *d
指向定义域的指针
二、node宏函数
NODE_X(node)
节点在x方向上的坐标(real)
NODE_Y(node)
节点在y方向上的坐标(real)
NODE_Z(node)
节点在z方向上的坐标(real)
F_NNODES(f,t)
面上节点的数目(int)
三、cell宏函数
1、
C_CENTROID(x,c,t)
real x[ND_ND]
单元格的重心坐标x[]
注意:这句话直接使用,