24小时热门版块排行榜    

查看: 1793  |  回复: 1

乙凡良

新虫 (小有名气)

[求助] fluent udf中流场初始化要加随机脉动,如何加,求大神? 已有1人参与

如题,想用fluent中udf在流场初始化时加个随机脉动,编了个udf却未能实现,请教大神?

#include "udf.h"
#include "time.h"
#include "stdlib.h"


DEFINE_INIT(my_init2_function, domain)
{
cell_t c;
Thread *t;
real xc[ND_ND];
int number;
real ans;
/* loop over all cell threads in the domain */
thread_loop_c (t,domain)
{
/* loop over all cells */
begin_c_loop_all (c,t)
{
C_CENTROID(xc,c,t);

srand(time(0));
number=rand()%2001;
ans=number*1.0/10000;
C_U(c,t)=1.02+ans*1.02;
C_V(c,t)=ans;
C_W(c,t)=ans;

}
end_c_loop_all (c,t)
}
}
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

mycc

专家顾问 (正式写手)

【答案】应助回帖

感谢参与,应助指数 +1
为什么不成功?是UDF不成功,还是出来的结果不符合你的要求?
项目汇总:http://www.cfluid.com/forum.php?mod=viewthread&tid=114340&extra=
2楼2016-06-17 08:27:35
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 乙凡良 的主题更新
信息提示
请填处理意见