找回密码
 注册
查看: 1029|回复: 0

有人帮忙看一下这个UDF吗?

[复制链接]
发表于 2006-2-24 13:08:09 | 显示全部楼层 |阅读模式

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

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

x
#include "udf.h"
#define PI 3.14159
#define GRAV 9.81
#define H2.0
#define D6.0
#define T6.0
#define L40.86

DEFINE_PROFILE(x_velocity, thread, position)
{
  real x[ND_ND];    /* this will hold the position vector                */
  real y;
  real AA,BB,CC,DD,EE,FF,GG,LL,ZZ,K;      /* y=position vector, AA,BB,etc are temporary stores */
  face_t f;
  begin_f_loop(f, thread)
    {
      real t = RP_Get_Real("flow-time");
  F_CENTROID(x,f,thread);
      y = x[1];
      ZZ= y - D;
  K = 2*PI/L;
  AA=  cosh (K*(ZZ + D));
  BB=  cosh (K* D);
  CC = sinh (K*D);
  DD=  cos  (PI/2.0 -2.0 *PI*(t/T));
  EE=  cos (2.0*(PI/2.0 -2.0 *PI*(t/T)));
  FF=  cosh (2.0*K*D);
  GG=  cosh (2.0*(K*(ZZ + D)));
  
  LL= D+(H*DD/2.0)+(PI*H*H/(8.0*L))*(BB/pow (CC,3.0))*(2.0+FF)*EE;
  
  if (y <= LL)        /* added ';='; sign after ';<'; to see change               */  
     F_PROFILE(f,thread,position)=H/2.0*(GRAV*T/L)*AA*DD/BB+0.75*PI*PI*H*H/(L*T)*GG*EE/pow(CC,4.0);
      
   else               /* line &#35;35  */
         F_PROFILE(f, thread, position) = 0;
  }
  end_f_loop(f, thread)
}

DEFINE_PROFILE(y_velocity, thread, position)
{
  real x[ND_ND];    /* this will hold the position vector                */
  real y;
  real K,MM,NN,OO,PP,QQ,RR,SS,TT,ZZZ;      /* y=position vector, AA,BB,etc are temporary stores */
  face_t f;
  begin_f_loop(f, thread)
    {
      real t = RP_Get_Real("flow-time");
  F_CENTROID(x,f,thread);
      y = x[1];
      ZZZ= y - D;
  K = 2*PI/L;
  
  MM=  sinh (K*(ZZZ + D));
  NN=  cosh (K* D);
  OO=  cos (PI/2.0 - (2.0 *PI* t/T));
  QQ=  sin (PI/2.0 - (2.0 *PI* t/T));
  RR=sinh (K*D);
  SS=cosh (2.0*K*D);
  TT=sinh (2.0*(K*(ZZZ + D)));
  
  PP= D+(H*OO/2.0)+(PI*H*H/(8.0*L))*(NN/pow (RR,3.0))*(2.0+SS)*OO;
  
  if (y <= PP)          /* added ';='; sign after ';<'; to see change            */
     F_PROFILE(f,thread,position)=H/2.0*(GRAV*T/L)*MM*QQ/NN+0.75*PI*PI*H*H/(L*T)*TT*QQ/pow(RR,4.0);
      
   else               
         F_PROFILE(f, thread, position) = 0;
  }
  end_f_loop(f, thread)
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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