| 查看: 3606 | 回复: 2 | ||
[求助]
fluent UDF 读取txt文件数据,并存入数组赋值给入口速度~
|
|
#include "udf.h" DEFINE_PROFILE(inlet_z_volecity,thread,position) { double volecity_1[1000]; real x[ND_ND]; real y; real y1; face_t f; int i,j=0; /**define varibles, file pointer**/ FILE *fp; /**open the file in the read-only mode**/ fp=fopen("aa.txt","r" ;if(fp==NULL) printf(" Can't open the file. Sorry.\n" ;else { /**initialise the the fluent_mode array**/ for(i=0;i<1000;i++) { fscanf(fp,"%lf\n",&volecity_1); } } fclose(fp); begin_f_loop(f,thread) { F_CENTROID(x,f,thread); y=x[1]; y1=volecity_1[j]; F_PROFILE(f, thread, position)=10*y1; j++; } end_f_loop(f,thread) } 这是我的代码,udf新新手,用interpreted 可以编译过去,但是就是给速度赋值的时候y1貌似一直都是0,不知道为什么。求大神帮忙解释解释,谢谢啦。 |
» 猜你喜欢
基于基元I统一理论的量子力学本源推导
已经有1人回复
推荐一款可以AI辅助写作的Latex编辑器SmartLatexEditor,超级好用,AI润色,全免费
已经有20人回复
物理学I论文润色/翻译怎么收费?
已经有162人回复
【EI|Scopus 双检索】第六届智能机器人系统国际会议(ISoIRS 2026)
已经有1人回复
2026年第四届电动车与车辆工程国际会议(CEVVE 2026)
已经有0人回复
2楼2021-01-21 17:47:00
3楼2021-10-10 16:04:19













;
回复此楼
