打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
【转】CFD中定义抛物线速度入口的UDF

在ANSYSFluent中建三维管道模型后,需要利用UDF将入口速度写为抛物线型,可教案上都是二维,我不会UDF,能否有人帮写一个三维的UDF做参考,假定管道入口直径为0.1m,速度为2m/s。

我抄写的UDF如下:
#include "udf.h"
DEFINE_PROFILE(x_velocity,thread,nv)
{
  float x;
  float y;
  face_t f;
  begin_f_loop(f, thread)
{
   F_CENTROID(x,f,thread);
   y = x;
   F_PROFILE(f, thread, nv)
    = 2*(1-y*y/(0.04*0.04));
  }
  end_f_loop(f, thread)
}

 

 

 

 

UDF帮助上的例子(入口速度为20m/s)

#include "udf.h"

DEFINE_PROFILE(inlet_x_velocity, thread, position)
{
  realx[ND_ND];            
  real y;
  face_t f;

  begin_f_loop(f, thread)
    {
     F_CENTROID(x,f,thread);
     y = x[1];
     F_PROFILE(f, thread, position) = 20 -y*y/(.0745*.0745)*20;
    }
  end_f_loop(f, thread)
}


三维的抛物线速度入口(本例是圆管入口,速度1.23m/s, 入口尺寸为直径6mm):

#include "udf.h"

DEFINE_PROFILE(inlet_x_velocity, thread, position)
{
  floatx[ND_ND];               
  float y,z;
  face_t f;
  begin_f_loop(f, thread)
    {
     F_CENTROID(x,f,thread);
     y = x[1];
     z = x[2];
     F_PROFILE(f, thread, position) = 1.23- y*y/(0.003*0.003)*1.23-z*z/(0.003*0.003)*1.23;
    }
  end_f_loop(f, thread)
}

 

小木虫网友应助:

#include "udf.h"
DEFINE_PROFILE(inlet_x_velocity, thread, index)
{
real x[ND_ND];      
real y,z;
face_t f;
begin_f_loop(f, thread)
  {
   F_CENTROID(x,f,thread);
//  x=x[0];
   y=x[1];
   z=x[2];
   F_PROFILE(f, thread, index)=0.2*(1-y*y/(0.01*0.01)-z*z/(0.01*0.01));
   
  }
end_f_loop(f, thread)
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
fluent
FLUENT空调导流片扫风模拟
Fluent UDF【12】:常用的数据宏
教ChatGPT编写Fluent UDF
UDF 实现热响应测试【出口平均温度赋予入口温度】
DEFINE_PROFILE用法介绍(3)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服