声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1477|回复: 1

[UDF专题] 用udf定义压力边界条件

[复制链接]
发表于 2008-8-31 16:47 | 显示全部楼层 |阅读模式

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

您需要 登录 才可以下载或查看,没有账号?我要加入

x
本人想用udf,定义两个压力边界条件,压力进口为:p=p0+p1*sin(wt),出口为p=p0+p1*sin(wt+a),p0为平均压力,p1为压力振幅,a为:两个压力波的相位差。我分别编了进出口的压力udf,录入时候后一个会把前一个覆盖,就是只能录入一个udf文件,希望高手给与指导。另外,以下两个为我的针对一个压力边界的udf,不清楚时间项的获得在循环外和循环内有什么区别,希望大虾指教。

#include "udf.h"

#define  w 314
/*w is the angular velocity w=2*pi*f, f=50  is frequency*/

DEFINE_PROFILE(Pressure_profile_in,t,i)
{
    face_t f;
    float time;   /* time is the iterative time*/
    float dp=132950; /*Dp is the amplitude of pressure */

        time=RP_Get_Real("flow-time");
/*        printf("the time is,%f\n",time);*/
  
        begin_f_loop(f,t)
    {
               
                double ss=w*time;
                F_PROFILE(f,t,i)=sin(ss+2.295)*dp;
/*                printf("the pressure is,%f\n",F_PROFILE(f,t,i));*/
          }
     end_f_loop(f,t)
}

另一个 的 time=RP_Get_Real("flow-time");在循环体内部。

#include "udf.h"

#define  w 314
/*w is the angular velocity w=2*pi*f, f=50  is frequency*/

DEFINE_PROFILE(Pressure_profile_in,t,i)
{
    face_t f;
    float time;   /* time is the iterative time*/
    float dp=132950; /*Dp is the amplitude of pressure */

        
/*        printf("the time is,%f\n",time);*/
  
        begin_f_loop(f,t)
    {
                time=RP_Get_Real("flow-time");
                double ss=w*time;
                F_PROFILE(f,t,i)=sin(ss+2.295)*dp;
/*                printf("the pressure is,%f\n",F_PROFILE(f,t,i));*/
          }
     end_f_loop(f,t)
}

两者有什莫区别?谢谢
回复
分享到:

使用道具 举报

发表于 2008-8-31 22:34 | 显示全部楼层
分别编udf?一个udf文件可以定义多个边界条件
这两个的区别是,第二个把time=。。。,读了n编,有点浪费
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-8 09:30 , Processed in 0.101545 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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