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

【求助】UDF并行计算的时候出现错误。

[复制链接]
发表于 2015-3-8 09:35:46 | 显示全部楼层 |阅读模式

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

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

x
#include "udf.h"
#define body_mass   50.61  //the mass of the body
#define body_im   11.548  //质量惯矩Im
static real body_inertial[3]={0.0,0.07336,0.00659};  //moments of inertia in 3D,here you can change the initial value
static real body_vel_prev[3]={0.0,0.0,0.0};// velocity of the body,here you can change the initial value
static real body_omega_prev[3]={0.0,0.0,0.0};// angular velocity of the body,here you can change the initial value
static real body_centroid[3]={0.0,0.0,0.0};//centroid of the body,here you can change the initial value
static real cc[3]={0.0,8.926,17.849};//阻尼-假设为0.5%*2mw
static real accel[3]={0.0,0.0,0.0};//加速度
static real n_body_centroid[3]={0.0,0.0,0.0};//新坐标
static real n_accel[3]={0.0,0.0,0.0};//新加速度

DEFINE_CG_MOTION(yundong,dt,vel,omega,time,dtime)
{
#if !RP_HOST
  Thread *tread;
  Domain *domin;
  FILE *fd;
  face_t  f;
  real force[ND_ND];//the total force on the body.  
  real moment[ND_ND];//the total momentum on the body.  
  real d_vel[ND_ND];
  real d_omega[ND_ND];
  int i=0;
  int j=0;
  int k=0;
  real ai[8];
  real eq_body_inertial[3];//等效刚度
  real eq_force[3];//等效荷载
  real eq_moment[3];//等效扭矩
#endif  
#if !RP_HOST
  tread=DT_THREAD(dt);
  domin = THREAD_DOMAIN (tread);
  NV_S(vel, =, 0.0);
#endif
#if !RP_HOST
  if (time>1.5)
{
  Compute_Force_And_Moment(domin, tread, body_centroid, force, moment, TRUE);
          ai[0]=4/dtime/dtime;
          ai[1]=2/dtime;
          ai[2]=4/dtime;
          ai[3]=1;
          ai[4]=1;
          ai[5]=0;
          ai[6]=dtime/2;
          ai[7]=dtime/2;
        
          eq_body_inertial[1]=body_inertial[1]+ai[0]*body_mass+ai[1]*cc[1];//竖向
                eq_force[1]=force[1]+body_mass*(ai[0]*body_centroid[1]+ai[2]*body_vel_prev[1]+ai[3]*accel[1])+cc[1]*(ai[1]*body_centroid[1]+ai[4]*body_vel_prev[1]+ai[5]*accel[1]);
                n_body_centroid[1]=eq_force[1]/eq_body_inertial[1];//新质心位置-竖向
                n_accel[1]=ai[0]*(n_body_centroid[1]-body_centroid[1])-ai[2]*body_vel_prev[1]-ai[3]*accel[1];//新加速度-竖向
                body_vel_prev[1]=body_vel_prev[1]+ai[6]*accel[1]+ai[7]*n_accel[1];//新速度及速度更新-竖向
  

          eq_body_inertial[2]=body_inertial[2]+ai[0]*body_im+ai[1]*cc[1];//扭转
                eq_moment[2]=moment[2]+body_im*(ai[0]*body_centroid[2]+ai[2]*body_omega_prev[2]+ai[3]*accel[2])+cc[2]*(ai[1]*body_centroid[2]+ai[4]*body_omega_prev[2]+ai[5]*accel[2]);
                n_body_centroid[2]=eq_moment[2]/eq_body_inertial[2];//新质心位置-扭转
                n_accel[2]=ai[0]*(n_body_centroid[2]-body_centroid[2])-ai[2]*body_omega_prev[2]-ai[3]*accel[2];//新加速度-扭转
                body_omega_prev[2]=body_omega_prev[2]+ai[6]*accel[2]+ai[7]*n_accel[2];//新速度及速度更新-扭转


                vel[1] =(n_body_centroid[1]-body_centroid[1])/dtime;
          moment[2] =(n_body_centroid[2]-body_centroid[2])/dtime;

          body_centroid[1]=n_body_centroid[1];//质心更新-竖向
                accel[1]=n_accel[1];//加速度更新-竖向
          body_centroid[2]=n_body_centroid[2];//质心更新-扭转
                accel[2]=n_accel[2];//加速度更新-扭转               
        
        
          fd=fopen("zhixinniu.dat","a";
          fprintf(fd,"%f,%f,%f\n", time, body_centroid[1], body_centroid[2]);
          fclose(fd);

}        
#endif   
}
   

在运行至1.5s,就是if time>1.5s后,就回出现Get_Partition_Statistics: Out of memory的错误。

单行的时候就不会出现这种情况,是并行命令的原因吗?

求大神帮助!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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