资源简介
六自由度运动-动网格udf,刚体分离等等都会用到的通用udf
代码片段和文件信息
/*#include “udf.h“*/
#define MASS 800.0 /* mass of object kg */
#define IXX 200.0 /* moment of intertia Nms^2 */
#define IYY 2880.0 /* moment of intertia Nms^2*/
#define IZZ 2880.0 /* moment of intertia Nms^2 */
#define IXZ 0.0 /* moment of intertia Nms^2 */
#define IXY 0.0 /* moment of intertia Nms^2 */
#define IYZ 0.0 /* moment of intertia Nms^2 */
#define LF 0.75 /* distance front ejector foot in front of cg m */
#define LR 0.75 /* distance rear ejector foot behind cg m */
#define F_EJECT_PEAK 10000.0 /* peak ejector force */
#define CGY0 7.7 /* y coordinate of cg at t=0 m */
#define NUM_CALLS 1 /* number of times routine called */
#define R2D 180./M_PI
#define N3V_ROTP_X(xr)N3V_DOT(x r[0])
#define N3V_ROTP_Y(xr)N3V_DOT(x r[1])
#define N3V_ROTP_Z(xr)N3V_DOT(x r[2])
#define N3VD_DOT(xy0y1y2)N3D_OP(+(x)[0]*(y0)(x)[1]*(y1)(x)[2]*(y2))
#define N3V_ROTN_X(xr)N3VD_DOT(x r[0][0]r[1][0]r[2][0])
#define N3V_ROTN_Y(xr)N3VD_DOT(x r[0][1]r[1][1]r[2][1])
#define N3V_ROTN_Z(xr)N3VD_DOT(x r[0][2]r[1][2]r[2][2])
#define N3V_ROTN_V(yopxr)\
N3D_D((y)[0](y)[1](y)[2]opN3V_ROTN_X(xr)N3V_ROTN_Y(xr)N3V_ROTN_Z(xr))
#define N3V_ROTP_V(yopxr)\
N3D_D((y)[0](y)[1](y)[2]opN3V_ROTP_X(xr)N3V_ROTP_Y(xr)N3V_ROTP_Z(xr))
static int calls=0 last_call=0 first_time=1;
DEFINE_CG_MOTION(fall dt cg_vel cg_omega time dtime)
/* fall = name shown in Fluent GUI
dt = thread
cg_vel = old/updated cg velocity (global)
cg_omega = old/updated angular velocity (global)
time = current time
dtime = time step
*/
{
static int id1=3; /* Face ID of the missile body */
static real f_glob[3]; /* Total forces (global) */
static real af_glob[3]; /* Aerodynamic forces (global) */
static real af_body[3]; /* Aerodynamic forces (body) */
static real m_glob[3]; /* Moment (global) */
static real m_body[3]; /* Moment (body) */
static float v_old_glob[3]; /* Velocity at previous time (global) */
static float om_old_body[3]; /* Angular velocity at previous time
rad/sec (body) */
static float om_body[3]; /* Updated angular velocity rad/sec (body) */
static real al_body[3]; /* angular acceleration rad/sec/sec (body) */
static real x_cg[3]; /* CG location */
static float euler_angle[3]; /* Euler angles: [0] = phi=roll=about x
[1] = theta=pitch=about y
[2] = psi=yaw=about z
(radians) */
static float euler_angle_old[3];
static real euler_rate[3]; /* time derivative of euler_angle */
static real cfctcs;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10157 2020-03-19 21:34 六自由度运动-动网格udf.c
- 上一篇:遗传算法解决车辆的CVRP问题
- 下一篇:简易五子棋qt实现
评论
共有 条评论