fluent udf:DEFINE_CG_MOTION 宏1

2017-01-16  by:CAE仿真在线  来源:互联网

fluent udf:DEFINE_CG_MOTION 宏1:

#include "udf.h"
#include "mem.h"
#include "dynamesh_tools.h"

static real v_x = 0.0,v_y=0.0,omega_z=0.0;
DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime)
{
face_t f;
cell_t c;
real f_glob[ND_ND],m_glob[ND_ND],x_cg[ND_ND],dv_x,dv_y,domega_z;
Domain *domain= Get_Domain (1);
Thread *tf1 = Lookup_Thread (domain, 3);
int i;

/* reset velocities */

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
if (!Data_Valid_P())
return;

for(i=0;i<=ND_ND;i++)
{
f_glob[i]=0;
m_glob[i]=0;
}

/* get the thread pointer for which this motion is defined */

for(i=0;i<ND_ND;i++)
x_cg[i]=DT_CG(dt)[i];


if(time<=0.001)
{
vel[1]=34.5;
Message ("\ntime=%f ,x=%.10lf ,y=%.10lf , force_x=%.1f ,force_y=%.1f ,moment_x=%f,moment_y=%f,moment_z=%f ,Vx=%f ,Vy=%f ,omega_z=%f\n", time,x_cg[0],x_cg[1],f_glob[0],f_glob[1],m_glob[0],m_glob[1],m_glob[2],v_x,v_y,omega_z);
return;
}

/* compute pressure force , viscosity force and moment on body by looping through all faces */
Compute_Force_And_Moment (domain, tf1, x_cg, f_glob, m_glob, TRUE);

/* compute change in velocity and angle velocity, i.e., dv = F * dt / mass
velocity update using explicit Euler formula */

dv_x = dtime * f_glob[0] / 39400;
v_x += dv_x;

dv_y = dtime * f_glob[1] / 39400;
v_y += dv_y;

domega_z=dtime*m_glob[2]/390000;
omega_z+=domega_z;


Message ("\ntime=%f ,x=%.10lf ,y=%.10lf , force_x=%.1f ,force_y=%.1f ,moment_x=%f,moment_y=%f,moment_z=%f ,Vx=%f ,Vy=%f ,omega_z=%f\n", time,x_cg[0],x_cg[1],f_glob[0],f_glob[1],m_glob[0],m_glob[1],m_glob[2],v_x,v_y,omega_z);

/* set components of velocity */
vel[0] = v_x,vel[1]=v_y,omega[2]=omega_z;
}


开放分享:优质有限元技术文章,助你自学成才

相关标签搜索:fluent udf:DEFINE_CG_MOTION 宏1 fluent流体分析培训 fluent培训 fluent技术教程 fluent在线视频教程 fluent资料下载 fluent分析理论 fluent化学反应流体气体流固耦合分析 fluent软件下载 fluent-udf编程开发教程 fluent代做 Fluent、CFX流体分析 HFSS电磁分析 

编辑
在线报名:
  • 客服在线请直接联系我们的客服,您也可以通过下面的方式进行在线报名,我们会及时给您回复电话,谢谢!
验证码

全国服务热线

1358-032-9919

广州公司:
广州市环市中路306号金鹰大厦3800
电话:13580329919
          135-8032-9919
培训QQ咨询:点击咨询 点击咨询
项目QQ咨询:点击咨询
email:kf@1cae.com