24小时热门版块排行榜    

查看: 1933  |  回复: 2

桐树花开A

新虫 (初入文坛)

[交流] fluent中降膜蒸发的气液交界面动力剪切力源项udf,导入出错,求指导。 已有2人参与

本人在做的管内液膜气液界面的剪切力动量源项udf,导入fluent中提示出错,不知道原因在哪,我是用VOF模型,剪切力计算中应用体积分数梯度,和气液两相相对速度,我采用DEFINE_ON_DEMAND来分配存储空间计算体积分数梯度,现在出错,本人是udf新手,想请教一下懂udf的人我这个程序的问题,十分感谢!
#include "udf.h"
#include "sg_mphase.h"
#define domain_ID 2
#define gas_volume_fraction 0.5
#define volume_fraction 0.99999
#define surface_force 0.6
#define g 9.8
#define d_tube 0.038

DEFINE_ADJUST(adjust_gradient,domain)
{
  Thread *t;
  cell_t c;
  face_t f;
  domain=Get_Domain(domain_ID);  
/*Fill UDS with the variable.*/
  thread_loop_c(t,domain)
  {
    begin_c_loop(c,t)
    {
      C_UDSI(c,t,0)=C_VOF(c,t);
     }
    end_c_loop(c,t)
  }
  thread_loop_f(t,domain)
  {
    if(THREAD_STORAGE(t,SV_UDS_I(0))!=NULL)
      begin_f_loop(f,t)
      {
        F_UDSI(f,t,0)=F_VOF(f,t);
       }
      end_f_loop(f,t)
    }
}
DEFINE_ON_DEMAND(store_gradient)
{   
   Domain *domain;
   cell_t c;
   Thread *t;
   domain=Get_Domain(domain_ID);  
/*Fill the UDM with magnitude of gradient.*/
   thread_loop_c(t,domain)
  {
    begin_c_loop(c,t)
    {
      C_UDMI(c,t,0)=NV_MAG(C_UDSI_G(c,t,0));
     }
    end_c_loop(c,t)
   }
}
        
DEFINE_ON_DEMAND(store_liquid_velocity)
{
  Domain *domain;
  cell_t c;
  Thread *t;
  domain=Get_Domain(domain_ID);
/*Fill the UDM with magnitude of velocity.*/
  thread_loop_c(c,t)
  {
    begin_c_loop(c,t)
    {
      if(C_VOF(c,t)==gas_volume_fraction)
      C_UDMI(c,t,1)=C_U(c,t);
     }
    end_c_loop(c,t)
   }
}

DEFINE_ON_DEMAND(store_vapor_velocity)
{
  Domain *domain;
  cell_t c;
  Thread *t;
  domain=Get_Domain(domain_ID);
/*Fill the UDM with magnitude of velocity.*/
  thread_loop_c(c,t)
  {
    begin_c_loop(c,t)
    {
     if(C_VOF(c,t)==volume_fraction)
     C_UDMI(c,t,2)=C_U(c,t);
     }
    end_c_loop(c,t)
   }
}

DEFINE_ON_DEMAND(thickness_liquid)
{
  Domain *domain;
  cell_t c;
  Thread *t;
  real x[ND_ND],y;
  domain=Get_Domain(3);
/*Fill the UDM with magnitude of thickness.*/
  thread_loop_c(c,t)
  {
    begin_c_loop(c,t)
    {
      if(C_VOF(c,t)==gas_volume_fraction)
      C_CENTROID(x,c,t);
      y=x[1];
      C_UDMI(c,t,3)=y;
     }
    end_c_loop(c,t)
   }
}

DEFINE_SOURCE(shear_source_y,c,t,mix_th,dS,eqn)
{
  Thread *pri_th,*sec_th;
  real source_y,fi,ll,p1,d0,d1,th1,re_gas,n;
  pri_th=THREAD_SUB_THREAD(mix_th,0);
  sec_th=THREAD_SUB_THREAD(mix_th,1);

  p1=surface_force/(C_R(c,sec_th)-C_R(c,pri_th))/g;
  ll=pow(p1,0.5);
  th1=C_UDMI(c,t,3)/ll;
  d0=2*C_UDMI(c,t,3);
  d1=d0/ll;
  re_gas=C_R(c,pri_th)*C_UDMI(c,t,2)*(d_tube-2*C_UDMI(c,t,3))/C_MU_T(c,pri_th);
  n=(1.8+3/d1)*3.95;
  fi=0.079*pow(re_gas,-0.25)*(1+pow(th1,n)*115);
if(C_VOF(c,pri_th)>=0.5&&C_VOF(c,pri_th)<=1.0)
  {
    source_y=C_UDMI(c,t,0)*fi*C_R(c,pri_th)*(C_UDMI(c,t,2)-C_UDMI(c,t,1))*fabs(C_UDMI(c,t,2)-C_UDMI(c,t,1));
    return source_y;
   }
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

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

fww2008

木虫 (小有名气)


小木虫: 金币+0.5, 给个红包,谢谢回帖
你好,我暂时在你的UDF中看到的问题是这样的,不知道对不对:
define on demand 只能手动激活,在迭代过程中是无效的(具体可参考UDF手册),而液相和气相的速度都需要在每次迭代计算前获取,因此速度的获取其实还是在define adjust中进行。
你写的这个udf应该是按照udf手册中的那个例子来的,但是那个例子是做后处理用的,不能用作迭代计算!
加油!
2楼2016-01-24 17:16:19
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

krydcs

新虫 (初入文坛)


小木虫: 金币+0.5, 给个红包,谢谢回帖
楼主问题解决了吗,同问
3楼2017-12-01 15:38:11
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 桐树花开A 的主题更新
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见