找回密码
 注册
查看: 3307|回复: 7

UDF计算问题

[复制链接]
发表于 2010-9-6 08:50:29 | 显示全部楼层 |阅读模式

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

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

x
UDF计算问题
我的UDF程序解释,编译已经成功,而且在FLUENT操作界面上,自定义函数已经可见。可是在进行插值计算时,出现下列错误提示:
Error:
FlUENT received fatal signal (ACCESS_VIOLATION)
1.Note exact event leading to error
2.Save case/data under new name
3.Exit program and restart to continue
4.Report error to your distributor
请教各位高手,这是什么原因造成的,如何修改,避免错误!
发表于 2010-9-17 17:16:23 | 显示全部楼层
我也有这样的错误。不过你少写了点吧,我的是Error: chip-exec: function "ly_cell_force_x" not found.
函数已经编译了,但是提示找不到,你也是这样的吗??
发表于 2010-9-18 12:01:54 | 显示全部楼层
ERROR后面跟着四个提醒也是个经典错误了,谁遇见谁挠头!很多方面都可以造成这个错误,不止是udf
 楼主| 发表于 2010-9-20 10:11:50 | 显示全部楼层
哪位大侠解决了呢?
 楼主| 发表于 2010-9-20 10:22:22 | 显示全部楼层

回复 2# 爱电脑 的帖子

我没有提示找不到,就提示有错误!你的问题解决了吗?
发表于 2010-9-20 13:24:17 | 显示全部楼层
只有把你的udf贴出来大家才能帮你看
发表于 2010-9-24 12:39:53 | 显示全部楼层
我也是这个问题,udf通过编译,初始化时候,就出现这个错误,怎么解决啊?
 楼主| 发表于 2010-9-26 08:37:10 | 显示全部楼层
/*********************************************************/
/*add the electricity field using the user-defined scalar*/
/*********************************************************/
#include "udf.h"
/*define which user-defined scalars to use*/
#define DIELECTRIC_CONSTANT (1.00005)
#define CAPACITANCE (0.05)
#define REAL_CONSTANT (1.0)
#define ion_move (2.3E-5)
enum  
{
VOLT,/*define voltage*/
ELE_CHARG_DENSITY,/*define charge quantity*/
N_REQUIRED_UDS
};
/*user define the memory*/
enum
{
E_X,
E_Y,
E_Z,
E_M,
N_REQUIRED_UDM
};
#define C_VOLT(c,t) C_UDSI(c,t,VOLT)
#define C_VOLT_G(c,t) C_UDSI_G(c,t,VOLT)
#define Q C_UDSI(c,t,ELE_CHARG_DENSITY)
#define C_EX(c,t) C_UDMI(c,t,E_X)
#define C_EY(c,t) C_UDMI(c,t,E_Y)
#define C_EZ(c,t) C_UDMI(c,t,E_Z)
#define C_EE(c,t) C_UDMI(c,t,E_M)
DEFINE_DIFFUSIVITY(volt_diffusivity,c,t,i)
{
real diffusivity;
diffusivity=1.0;
return diffusivity;
}
DEFINE_SOURCE(voltage_source,c,t,dS,eqn) /*define the source*/
{
real volt_source;
volt_source=Q/DIELECTRIC_CONSTANT;
dS[eqn]=0;
return volt_source;
}
DEFINE_UDS_FLUX(current_density,f,t,i)
/*define the current flux*/
{
Thread *t0,*t1=NULL;
cell_t c0,c1=-1;
real NV_VEC(current);
real NV_VEC(A);
/* neighboring cells of face f, and their (corresponding) threads */
t0=F_C0_THREAD(f,t);
c0=F_C0(f,t);
if (NULL!= F_C1_THREAD(f,t))
/* Alternative: if (! BOUNDARY_FACE_THREAD_P(t)) */
{
      t1=F_C1_THREAD(f,t);
      c1=F_C1(f,t);
    }
  else
    {
      t1=NULL;
      c1=-1;
    }
  /* If Face lies at domain boundary, use face values; */
  /* If Face lies IN the domain, use average of adjacent cells. */
  if (NULL==t1)
  /* Alternative: if (BOUNDARY_FACE_THREAD_P(t)) */
    {
      NV_D(ion_vel, =, F_U(f,t), F_V(f,t), F_W(f,t));
      NV_NV(current,=,ion_move*electricity_intensity,+,ion_vel)
    }
  else
    {
      NV_D(ion_vel, =, C_U(c0,t0), C_V(c0,t0), C_W(c0,t0));
      NV_D(current, =, ion_move*electricity_intensity,+,ion_vel)
      }
  /* Now ion_vel contains our "ion_vel" from above. */
  /* Next, get the face normal vector: */
  F_AREA(A, f, t);
  /* Finally, return the dot product of both.  */
  /* Fluent will multiply the returned value   */
  /* by phi_f (the scalar's value at the face) */
  /* to get the "complete" advective term*/
  return NV_DOT(current, A);
void update_E(Domain *domain)
{
Thread* t;
cell_t c;
real dVolt[ND_ND];
thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
NV_V(dVolt,=,C_VOLT_G(c,t));
ND_VEC(C_EX(c,t)=-dVolt[0],C_EY(c,t)=-dVolt[1],C_EZ(c,t)=-dVolt[2]);
C_EE(c,t)=NV_MAG(dVolt);
}
end_c_loop(c,t);
}
这是我的UDF语句,希望各位高手帮忙看看,找找错误!编译已经成功,而且在FLUENT操作界面上,自定义函数已经可见。可是在进行插值计算时,出现下列错误提示:
Error:
FlUENT received fatal signal (ACCESS_VIOLATION)
1.Note exact event leading to error
2.Save case/data under new name
3.Exit program and restart to continue
4.Report error to your distributor
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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