找回密码
 注册
查看: 1633|回复: 0

为什么不能计算受力问题

[复制链接]
发表于 2012-2-24 16:08:10 | 显示全部楼层 |阅读模式

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

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

x
DEFINE_EXECUTE_AT_END(force)
{
Domain *d;                 
Thread *t ;
face_t f;
real   x[ND_ND];
real   f_glob[ND_ND],m_glob[ND_ND],x_cg[ND_ND];
real   total_f[ND_ND];
real   time = RP_Get_Real("flow-time");
int i;
#if !RP_NODE   
FILE *file= fopen("force.txt", "a+");
#endif
if(time>100.0)
{
#if !RP_HOST
  d=Get_Domain(1);
  t=Lookup_Thread(d,6);
  if (!Data_Valid_P ())   
   return;
   NV_S(f_glob, =, 0.0);
   NV_S(m_glob, =, 0.0);
   NV_S(x_cg, =, 0.0);
   NV_S(total_f,   =, 0.0);

  for(i=0;i<=ND_ND;i++)
   x_cg = 0.0;
  Compute_Force_And_Moment (d,t,x_cg,f_glob,m_glob,TRUE);

    #if RP_3D
  {
        total_f[0]=f_glob[0];
        total_f[1]=f_glob[1]-9.8*body_mass;
                total_f[2]=f_glob[2];
    Message ("================================================================);
    Message (" ================================================================);
    Message (" ================================================================);
    Message ("  ===============================================================);
  }
   #endif
#endif /*if!RP_HOST*/
  node_to_host_real(total_f, ND_ND);
  node_to_host_real(f_glob, ND_ND);
  node_to_host_real(m_glob, ND_ND);
  node_to_host_real(x_cg, ND_ND);
   
#if RP_HOST
   if (file != NULL)
       {
        #if(RP_3D)
       {
            fprintf (file, "=============================================");
                fclose (file);
          }
                 #endif
          }
       else
          Message ("\nWarning: cannot write %s file");
   #endif  /*#if RP_HOST×/
}
}

求助,这段程序用了老是会出错,且force.txt 在time 100时没有数据输入,且会卡住不能计算,用的是计算三维物体受力问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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