|
楼主 |
发表于 2008-1-15 21:08:13
|
显示全部楼层
请高手帮忙看看这个VOF模型中输出第二相高度随时间变化的udf应该怎么编?
在pvxd的提示下udf可以正常运行了,输出的高度随时间连续变小
#include "stdio.h"
#include "udf.h"
DEFINE_EXECUTE_AT_END(profile)
{
FILE *fp;
face_t f;
real x[ND_ND];
real height;
Domain *d= Get_Domain(3);
Thread *t=Lookup_Thread(d,6);
Thread *mix_th=THREAD_SUPER_THREAD(t);
Thread *sec_th=THREAD_SUB_THREAD(mix_th,1);
cell_t c;
fp=fopen("C:\\fluent model\\profile\\1.txt","a");
begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
if ((C_VOF(c,sec_th)<1)&&(C_VOF(c,sec_th)>0)) height=x[1];
}
end_c_loop(c,t)
fprintf(fp,"%f,%f\n",(float)RP_Get_Real("flow-time"),(float)height);
fp=fclose(fp);
}
但是现在还有一个问题就是,我把对称边界改成液滴碰撞的底部wall边界时,求随时间变化的铺展长度时,输出的值不连续,随着时间增加,很多时刻对应的铺展长度是0
现在找不出原因,还请pvxd 指点一下!udf如下:
#include "stdio.h"
#include "udf.h"
DEFINE_EXECUTE_AT_END(profile)
{
FILE *fp;
real x[ND_ND];
real length;
Domain *d= Get_Domain(3);
Thread *t=Lookup_Thread(d,3);
Thread *mix_th=THREAD_SUPER_THREAD(t);
Thread *sec_th=THREAD_SUB_THREAD(mix_th,1);
cell_t c;
fp=fopen("C:\\fluent model\\profile\\1.txt","a");
begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
if ((C_VOF(c,sec_th)<1)&&(C_VOF(c,sec_th)>0)) length=x[0];
}
end_c_loop(c,t)
fprintf(fp,"%f,%f\n",(float)RP_Get_Real("flow-time"),(float)length);
fp=fclose(fp);
}
输出的结果如下:
0.000080,0.000281
0.000090,0.000000
0.000100,0.000000
0.000110,0.000356
0.000120,0.000000
0.000130,0.000394
0.000140,0.000000
0.000150,0.000000
0.000160,0.000469
0.000170,0.000000
0.000180,0.000000
0.000190,0.000000
0.000200,0.000000
0.000210,0.000000
0.000220,0.000000
0.000230,0.000000
0.000240,0.000000
0.000250,0.000000
0.000260,0.000000
0.000270,0.000000
0.000280,0.000000
0.000290,0.000000
0.000300,0.000000
0.000310,0.000000
0.000320,0.000000
0.000330,0.000000
0.000340,0.000000
0.000350,0.000000
0.000360,0.000000
0.000370,0.000000
0.000380,0.000000
0.000390,0.000000
0.000400,0.000000
0.000410,0.000000
0.000420,0.000000
0.000430,0.000000
0.000440,0.000000
0.000450,0.000000
0.000460,0.000000
0.000470,0.000000
0.000480,0.000000
0.000490,0.000000
0.000500,0.000000
0.000510,0.000000
0.000520,0.000000
0.000530,0.000000
0.000540,0.000000
0.000550,0.000000
0.000560,0.000000
0.000570,0.000000
0.000580,0.000000
0.000590,0.000000
0.000600,0.000000
0.000610,0.000000
0.000620,0.000000
0.000630,0.000000
0.000640,0.000000
0.000650,0.000000
0.000660,0.000000
0.000670,0.000000
0.000680,0.000000
0.000690,0.000000
0.000700,0.000000
0.000710,0.000000
0.000720,0.000000
0.000730,0.000000
0.000740,0.000000
0.000750,0.000000
0.000760,0.000000
0.000770,0.000000
0.000780,0.000000
0.000790,0.000000
0.000800,0.000000
|
|