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

fluent计算力和力矩的udf如何编写,求指导!

[复制链接]
发表于 2015-1-30 19:04:14 | 显示全部楼层 |阅读模式

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

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

x
#include "udf.h"
#include "mem.h"
#include"math.h"
#include "dynamesh_tools.h"
static real v_x = 0.0,v_y=0.0,omega_z=0.0;
static real A=0.7532,L=0.64607,q=0.0;
static real CN=0.0,Cax=0.0,Cz=0.0,Mz=0.0,My=0.0,Mx=0.0;
DEFINE_CG_MOTION(force_compute,dt,vel,omega,time,dtime)
{
    face_t f;
    cell_t c;
    real f_glob[ND_ND],m_glob[ND_ND],x_cg[ND_ND];
    Domain *domain= Get_Domain (1);
    Thread *tf1 = Lookup_Thread (domain,15);
    int i;
   
    NV_S(vel, =, 0.0);
    NV_S(omega, =, 0.0);
   for(i=0;i<=ND_ND;i++)
    {
         f_glob[i]=0;
         m_glob[i]=0;
    }
   
    for(i=0;i<ND_ND;i++)
    x_cg[i]=DT_CG(dt)[i];

    Compute_Force_And_Moment (domain, tf1, x_cg, f_glob, m_glob, TRUE);
    Thread_loop_c(c,domain);
    q=0.5*C_R(c,dt)*sqrt(C_U(c,dt)*C_U(c,dt)+C_V(c,dt)*C_V(c,dt)+C_W(c,dt)+C_W(c,dt));
    Cax=f_glob[0]/A/q;
    CN=f_glob[1]/A/q;
    Cz=f_glob[2]/A/q;
    Mx=m_glob[0]/A/q/L;
    My=m_glob[1]/A/q/L;
    Mz=m_glob[2]/A/q/L;
   
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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