#include "udf.h"
#include "dynamesh_tools.h"
#define BMODULUS 1.7e9
#define R 37.65
#define bat 13.0
#define sat 5.0
#define N 9.0
#define n 1500.0
DEFINE_CG_MOTION(piston1, dt, vel1, omega, time, dtime)
{
real dfai1, w, vp1;
dfai1 = 2*3.14159265*0.5/9.0;
w = 2*3.14159265*n/60;
vp1=R*w*sin(w*time+dfai1)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/1000;
/* set x-component of velocity */
vel1[0] = -vp1*sin(sat*3.14159265/180)*sin(w*time+dfai1);
/* set y-component of velocity */
vel1[1] = -vp1*sin(sat*3.14159265/180)*cos(w*time+dfai1);
/* set z-component of velocity */
vel1[2] = vp1*cos(sat*3.14159265/180);
}
DEFINE_CG_MOTION(piston2, dt, vel2, omega, time, dtime)
{
real dfai2, w, vp2;
dfai2 = 2*3.14159265*1.5/9.0;
w = 2*3.14159265*n/60;
vp2=R*w*sin(w*time+dfai2)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/1000;
/* set x-component of velocity */
vel2[0] = -vp2*sin(sat*3.14159265/180)*sin(w*time+dfai2);
/* set y-component of velocity */
vel2[1] = -vp2*sin(sat*3.14159265/180)*cos(w*time+dfai2);
/* set z-component of velocity */
vel2[2] = vp2*cos(sat*3.14159265/180);
}
DEFINE_CG_MOTION(piston3, dt, vel3, omega, time, dtime)
{
real dfai3, w, vp3;
dfai3 = 2*3.14159265*2.5/9.0;
w = 2*3.14159265*n/60;
vp3=R*w*sin(w*time+dfai3)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/1000;
/* set x-component of velocity */
vel3[0] = -vp3*sin(sat*3.14159265/180)*sin(w*time+dfai3);
/* set y-component of velocity */
vel3[1] = -vp3*sin(sat*3.14159265/180)*cos(w*time+dfai3);
/* set z-component of velocity */
vel3[2] = vp3*cos(sat*3.14159265/180);
}
DEFINE_CG_MOTION(piston4, dt, vel4, omega, time, dtime)
{
real dfai4, w, vp4;
dfai4 = 2*3.14159265*3.5/9.0;
w = 2*3.14159265*n/60;
vp4=R*w*sin(w*time+dfai4)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/1000;
/* set x-component of velocity */
vel4[0] = -vp4*sin(sat*3.14159265/180)*sin(w*time+dfai4);
/* set y-component of velocity */
vel4[1] = -vp4*sin(sat*3.14159265/180)*cos(w*time+dfai4);
/* set z-component of velocity */
vel4[2] = vp4*cos(sat*3.14159265/180);
}
DEFINE_CG_MOTION(piston5, dt, vel5, omega, time, dtime)
{
real dfai5, w, vp5;
dfai5 = 2*3.14159265*4.5/9.0;
w = 2*3.14159265*n/60;
vp5=R*w*sin(w*time+dfai5)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/1000;
/* set x-component of velocity */
vel5[0] = -vp5*sin(sat*3.14159265/180)*sin(w*time+dfai5);
/* set y-component of velocity */
vel5[1] = -vp5*sin(sat*3.14159265/180)*cos(w*time+dfai5);
/* set z-component of velocity */
vel5[2] = vp5*cos(sat*3.14159265/180);
}
DEFINE_CG_MOTION(piston6, dt, vel6, omega, time, dtime)
{
real dfai6, w, vp6;
dfai6 = 2*3.14159265*5.5/9.0;
w = 2*3.14159265*n/60;
vp6=R*w*sin(w*time+dfai6)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/1000;
/* set x-component of velocity */
vel6[0] = -vp6*sin(sat*3.14159265/180)*sin(w*time+dfai6);
/* set y-component of velocity */
vel6[1] = -vp6*sin(sat*3.14159265/180)*cos(w*time+dfai6);
/* set z-component of velocity */
vel6[2] = vp6*cos(sat*3.14159265/180);
}
DEFINE_CG_MOTION(piston7, dt, vel7, omega, time, dtime)
{
real dfai7, w, vp7;
dfai7 = 2*3.14159265*6.5/9.0;
w = 2*3.14159265*n/60;
vp7=R*w*sin(w*time+dfai7)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/1000;
/* set x-component of velocity */
vel7[0] = -vp7*sin(sat*3.14159265/180)*sin(w*time+dfai7);
/* set y-component of velocity */
vel7[1] = -vp7*sin(sat*3.14159265/180)*cos(w*time+dfai7);
/* set z-component of velocity */
vel7[2] = vp7*cos(sat*3.14159265/180);
}
DEFINE_CG_MOTION(piston8, dt, vel8, omega, time, dtime)
{
real dfai8, w, vp8;
dfai8 = 2*3.14159265*7.5/9.0;
w = 2*3.14159265*n/60;
vp8=R*w*sin(w*time+dfai8)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/(cos(sat*3.14159265/180)*(1-cos(w*time+dfai8)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/1000;
/* set x-component of velocity */
vel8[0] = -vp8*sin(sat*3.14159265/180)*sin(w*time+dfai8);
/* set y-component of velocity */
vel8[1] = -vp8*sin(sat*3.14159265/180)*cos(w*time+dfai8);
/* set z-component of velocity */
vel8[2] = vp8*cos(sat*3.14159265/180);
}
DEFINE_CG_MOTION(piston9, dt, vel9, omega, time, dtime)
{
real dfai9, w, vp9;
dfai9 = 2*3.14159265*8.5/9.0;
w = 2*3.14159265*n/60;
vp9=R*w*sin(w*time+dfai9)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/(cos(sat*3.14159265/180)*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))*(1+cos(sat*3.14159265/180)*tan(bat*3.14159265/180)*tan(sat*3.14159265/180))/1000;
/* set x-component of velocity */
vel9[0] = -vp9*sin(sat*3.14159265/180)*sin(w*time+dfai9);
/* set y-component of velocity */
vel9[1] = -vp9*sin(sat*3.14159265/180)*cos(w*time+dfai9);
/* set z-component of velocity */
vel9[2] = vp9*cos(sat*3.14159265/180);
}
我要仿真的是写柱塞的一个柱塞泵,没个柱塞我都建立了局部坐标,所以在全局坐标中需要转化,您看我编译的有问题吗?还有,您说的运动的底面用层变是怎么设置呢?在Gambit中设置边界条件的时候在动网格这里我该怎么设置呢?将运动柱塞的底面设置为Wall吗? |