|
楼主 |
发表于 2012-11-1 23:24:24
|
显示全部楼层
还是UDF有关UDF编程读取一个txt文档 加载为模型热流密度边界条件的问题
原帖由 mayo_0 于 2012-11-1 18:04 发表
你数据读入了,没有赋值的代码啊。
用Profile多方便。
你说用DEFINE_PROFILE宏,然后用F_PROFILE赋值?我数据现在都不能读取呢,DEFINE_PROFILE能用来读取txt文档吗?只要我的代码里面有fp=fopen("U.txt","r");之类的打开文档的代码,编译之后加载边界条件Fluent就会直接退出。你看下下面的代码行不?
# include "udf.h"
DEFINE_PROFILE(inlet_left_velocity, thread, position)
{
real x[ND_ND]; /* this will hold the position vector */
face_t f;
FILE *fp;
real temp;
fp=fopen("U.txt","r");
begin_f_loop(f, thread)
{
fscanf(fp,"%f\n",&temp);
F_PROFILE(f, thread, position) = temp;
}
end_f_loop(f, thread)
fclose(fp);
} |
|