CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

a define_source problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 11, 2010, 22:06
Unhappy a define_source problem
  #1
New Member
 
daniel
Join Date: Mar 2010
Posts: 4
Rep Power: 16
danielchen37 is on a distinguished road
dear all:
i come across a udf problem. the case ran well without the udfs. but when the udfs were compiled, built and loaded, the error signal would appear and the interation would not process a bit.
here is the error signal:

Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
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: ()

the udfs are compiled and loaded successfully as:
xforce.c
yforce.c
zforce.c
uds.c
Generating Code...
# Generating udf_names.c because of makefile xforce.obj yforce.obj zforce.obj uds.obj
udf_names.c
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj xforce.obj yforce.obj zforce.obj uds.obj
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Creating library libudf.lib and object libudf.exp
Done.
"E:/hyc/hyc/RE1000"
Opening library "E:\hyc\hyc\RE1000\libudf"...
Library "E:\hyc\hyc\RE1000\libudf\ntx86\3d\libudf.dll" opened
xforce_source
yforce_source
zforce_source
uds_source
Done.

and here is one code of my udfs and the rest of the udfs all share with the same structure:
#include"udf.h"
#include"mem.h"
#include"metric.h"
DEFINE_SOURCE(xforce_source,c,t,dS,eqn)
{
real dens;
real u;
real v;
real w;
real ux;
real uy;
real uz;
real cp;
real A;
real con;
real tx;
real tgx;
real source;
real x[ND_ND];
real ur;
real sc;
real sp;
C_CENTROID(x,c,t);
dens=C_R(c,t);
u=C_U(c,t);
v=C_V(c,t);
w=C_W(c,t);
ux=C_DUDX(c,t);
uy=C_DUDY(c,t);
uz=C_DUDZ(c,t);
A=C_UDSI(c,t,0);
tx=C_T_G(c,t)[0];
con=-0.02;
ur=v*uy+u*uz;
sc=dens*ur+con*A*tx;
sp=dens*ux;
source=sp*u+sc;
dS[eqn]=sp;
return source;
}

please tell me what's wrong with my udf and how could i correct it.
thank you!
danielchen37 is offline   Reply With Quote

Old   March 12, 2010, 01:14
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by danielchen37 View Post
dear all:
i come across a udf problem. the case ran well without the udfs. but when the udfs were compiled, built and loaded, the error signal would appear and the interation would not process a bit.
here is the error signal:

Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
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: ()

the udfs are compiled and loaded successfully as:
xforce.c
yforce.c
zforce.c
uds.c
Generating Code...
# Generating udf_names.c because of makefile xforce.obj yforce.obj zforce.obj uds.obj
udf_names.c
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj xforce.obj yforce.obj zforce.obj uds.obj
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Creating library libudf.lib and object libudf.exp
Done.
"E:/hyc/hyc/RE1000"
Opening library "E:\hyc\hyc\RE1000\libudf"...
Library "E:\hyc\hyc\RE1000\libudf\ntx86\3d\libudf.dll" opened
xforce_source
yforce_source
zforce_source
uds_source
Done.

and here is one code of my udfs and the rest of the udfs all share with the same structure:
#include"udf.h"
#include"mem.h"
#include"metric.h"
DEFINE_SOURCE(xforce_source,c,t,dS,eqn)
{
real dens;
real u;
real v;
real w;
real ux;
real uy;
real uz;
real cp;
real A;
real con;
real tx;
real tgx;
real source;
real x[ND_ND];
real ur;
real sc;
real sp;
C_CENTROID(x,c,t);
dens=C_R(c,t);
u=C_U(c,t);
v=C_V(c,t);
w=C_W(c,t);
ux=C_DUDX(c,t);
uy=C_DUDY(c,t);
uz=C_DUDZ(c,t);
A=C_UDSI(c,t,0);
tx=C_T_G(c,t)[0];
con=-0.02;
ur=v*uy+u*uz;
sc=dens*ur+con*A*tx;
sp=dens*ux;
source=sp*u+sc;
dS[eqn]=sp;
return source;
}

please tell me what's wrong with my udf and how could i correct it.
thank you!
Note that gradient variables are
available only when the equation for that variable is being solved. For example, if you
are defining a source term for energy, your UDF can access the cell temperature gradient
(using C_T_G), but it cannot get access to the x-velocity gradient (using C_U_G). The reason for this is that the solver continually removes data from memory that it doesn't need. In order to retain the gradient data (when you want to set up user-defined scalar transport equations, for example), you can prevent the solver from freeing up memory by issuing the text command

solve/set/expert

and then answering yes to the question Keep temporary solver memory from being freed?.

Note that when you do this, all of the gradient data is retained, but the calculation requires more memory to run.
gearboy is offline   Reply With Quote

Old   March 12, 2010, 03:13
Default thank you so much, gearboy!
  #3
New Member
 
daniel
Join Date: Mar 2010
Posts: 4
Rep Power: 16
danielchen37 is on a distinguished road
dear gear boy:
thank you so much for solving my problem!
i'll try and wish it could work!
danielchen37 is offline   Reply With Quote

Old   March 12, 2010, 23:48
Default the error remains
  #4
New Member
 
daniel
Join Date: Mar 2010
Posts: 4
Rep Power: 16
danielchen37 is on a distinguished road
dear all
the error remains. help me!
danielchen37 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 05:43
Incoherent problem table in hollow-fiber spinning Gianni FLUENT 0 April 5, 2008 11:33
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 15:52


All times are GMT -4. The time now is 20:05.