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

关于孔隙率的UDF程序

[复制链接]
发表于 2012-2-28 10:53:03 | 显示全部楼层 |阅读模式

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

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

x
以下是我编的一个程序,关于孔隙率变化的。二维模型,是200m的一个正方形,左下角坐标为(0,0),想要孔隙随x轴线性变化,从0.1到0.3。fluent提示第二行出现错误,不知道该怎么改正?
#include “udf.h”
DEFINE_PROFILE(prosity,thread,position)
{
  real x[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) =0.1+x/1000;
    }
  end_f_loop(f,thread)
}

[ 本帖最后由 iktguodong 于 2012-2-28 10:54 编辑 ]
图片2.png
图片2.png
 楼主| 发表于 2012-2-28 14:28:53 | 显示全部楼层

回复 1# iktguodong 的帖子

本人已经解决了这个问题,现在将正确的程序上传,希望对新手有所帮助。
#include "udf.h"

DEFINE_PROFILE(prosity,thread,position)
{
  real x[ND_ND];
  real a;
  face_t f;
  begin_f_loop(f,thread)
    {
     F_CENTROID(x,f,thread,);
     a=x[0];
     if(a>=0 && a<=200)
        {
      F_PROFILE(f,thread,position)=0.1+a/1000;
        }
        else if(a>200)
                {
                F_PROFILE(f,thread,position)=0;
        }
    }
  end_f_loop(f,thread)
}
发表于 2014-8-31 23:15:01 | 显示全部楼层

回复 2# iktguodong 的帖子

真心佩服,不仅是才学,还有乐于奉献的精神,我们菜鸟谢谢您~~~受教了
发表于 2015-10-26 21:49:54 | 显示全部楼层
这两个有什么区别吗?
发表于 2018-7-29 10:40:36 | 显示全部楼层
谢谢,奉献
发表于 2019-1-29 11:25:45
前辈,我最近也在学习孔隙率的udf,有两个问题想请教一下:
1. 定义时用DEFINE_PROFILE还是DEFINE_PROPERTY呢?
2. udf成功导入fluent后,在Porosity中设置孔隙率为多少呢?我发现Porosity中只有选择constant或者new input parameter,没有user-defined选项。
支持 反对

发表于 2019-2-12 15:24:54 | 显示全部楼层
You can either use F PROFILE or C PROFILE to define a viscous resistance profile in a
porous zone. Below are two sample UDFs that demonstrate the usage of F PROFILE and
C PROFILE, respectively. Note that porosity functions are hooked to ANSYS FLUENT in
the Porous Zone tab in the appropriate Fluid cell zone conditions dialog box.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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