fluent udf:DEFINE_CG_MOTION 宏1

2017-01-16  by:CAE仿真在線  來源:互聯(lián)網(wǎng)

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;
}


開放分享:優(yōu)質(zhì)有限元技術(shù)文章,助你自學(xué)成才

相關(guān)標(biāo)簽搜索:fluent udf:DEFINE_CG_MOTION 宏1 Fluent培訓(xùn) Fluent流體培訓(xùn) Fluent軟件培訓(xùn) fluent技術(shù)教程 fluent在線視頻教程 fluent資料下載 fluent分析理論 fluent化學(xué)反應(yīng) fluent軟件下載 UDF編程代做 Fluent、CFX流體分析 HFSS電磁分析 

編輯
在線報名:
  • 客服在線請直接聯(lián)系我們的客服,您也可以通過下面的方式進行在線報名,我們會及時給您回復(fù)電話,謝謝!
驗證碼

全國服務(wù)熱線

1358-032-9919

廣州公司:
廣州市環(huán)市中路306號金鷹大廈3800
電話:13580329919
          135-8032-9919
培訓(xùn)QQ咨詢:點擊咨詢 點擊咨詢
項目QQ咨詢:點擊咨詢
email:kf@1cae.com