找回密码
 注册
查看: 3699|回复: 2

关于用F_P(f,t)读取压力时出错

[复制链接]
发表于 2011-3-29 22:35:19 | 显示全部楼层 |阅读模式

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

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

x
下面是从UDF帮助里弄出来的UDF:
#include "udf.h"
static real v_prev = 10.0;

DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime)
{
  Thread *t;
  face_t f;
  real NV_VEC(A);
  real force, dv;

  /* reset velocities */
  NV_S(vel, =, 0.0);
  NV_S(omega, =, 0.0);

  if (!Data_Valid_P())
    return;

  /* get the thread pointer for which this motion is defined */
  t = DT_THREAD(dt);
}
  /* compute pressure force on body by looping through all faces */
  force = 0.0;
  begin_f_loop(f,t)
    {
      F_AREA(A,f,t);
      force += F_P(f,t) * NV_MAG(A);
    }
  end_f_loop(f,t)

  /* compute change in velocity, i.e., dv = F * dt / mass
     velocity update using explicit Euler formula */
  dv = dtime * force / 50.0;
  v_prev += dv;
  Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev,
  force);

  /* set x-component of velocity */
  vel[0] = v_prev;
}
不知道为什么F_P(f,t) 读取不了压力导致运行不了,出现如下错误:
FLUENT received fatal signal (ACCESS_VIOLATION))m
1. Note exact events leading to error
2. Save case/data under new name
3. Exit program and restart to continue
4. Report error to your distributor
Error Object: ()
而将F_P(f,t) 去掉,网格就可以动起来了,采用这个udf模拟一个运动的方块如何

在作用力的运动情况,请问各位高手是什么原因啊?

[ 本帖最后由 紫金黄朝 于 2011-3-29 23:04 编辑 ]
发表于 2011-12-30 16:01:31 | 显示全部楼层

回复 1# 紫金黄朝 的帖子

你这个解决没有啊,我的QQ312224066,求指教
发表于 2011-12-30 16:35:29 | 显示全部楼层

回复 1# 紫金黄朝 的帖子

NV_S(vel, =, 0.0);
  NV_S(omega, =, 0.0);

这个的意思是这么用吗?我在CFD online上看见的解释是:
I want to know the meaning of the following expression.

1. real NV_VEC(psi), NV_VEC(A);       2. NV_D(psi, =, F_U(f,t), F_V(f,t), F_W(f,t));

3. NV_S(psi, *=, F_R(f,t));            4. NV_DS(psi_vec, =, F_U(f,t), F_V(f,t), F_W(f,t), *, dens);

answer:

VEC for vector, D for directions and S for scalar;

real NV_VEC(psi--- defines a vector psi[0]i+psi[1]j+psi[2]k

NV_D(psi,=,u,v,w)--- assigns values in 3directions to a vector

psi = ui+vj+wk

NV_S(psi,*=,R) => psi = psi * R (assigns/modifies magnitude)

NV_DS(psi_vec,=,u,v,w,*,dens) =>direction & scalar operations

psi_vec = (ui+vj+wk)*dens;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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