找回密码
 注册
查看: 2362|回复: 5

请高手帮忙看看这个VOF模型中输出第二相高度随时间变化的udf应该怎么编?

[复制链接]
发表于 2007-12-25 09:21:25 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
[这个贴子最后由tiandw在 2007/12/25 10:07am 第 1 次编辑]

);   
}
编译通过,执行结果还是不对
请高手指点一下,应该如何编这个程序
发表于 2007-12-28 10:18:09 | 显示全部楼层

请高手帮忙看看这个VOF模型中输出第二相高度随时间变化的udf应该怎么编?

沿对称边界进行循环,
不过在进行高度判断时采用边界face相邻的cell单元的C_VOF(c,t)
试试呢?
 楼主| 发表于 2008-1-12 05:37:32 | 显示全部楼层

请高手帮忙看看这个VOF模型中输出第二相高度随时间变化的udf应该怎么编?

能不能写一下,对于两相流的domain thread有点搞不太懂
 楼主| 发表于 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如下:
&#35;include "stdio.h"
&#35;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



发表于 2008-5-12 09:06:54 | 显示全部楼层

请高手帮忙看看这个VOF模型中输出第二相高度随时间变化的udf应该怎么编?

楼主你好,我也是用VOF模型搞液滴撞击固体表面的,能不能留个联系方式,交流一下!
发表于 2008-5-29 11:46:49 | 显示全部楼层

请高手帮忙看看这个VOF模型中输出第二相高度随时间变化的udf应该怎么编?

[这个贴子最后由topshen在 2008/05/29 11:51am 第 2 次编辑]

对于二维,建议把
  if ((C_VOF(c,sec_th)<1)&&(C_VOF(c,sec_th)>0)) length=x[0];
改为
  if ((C_VOF(c,sec_th)<1)&&(C_VOF(c,sec_th)>0))
length[i++]=x[0];
注意在前面加上
int i=0;
real Length;
real length[2];
在循环完了之后Length=length[1]-length[0];
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表