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

error c_face_loop

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 11, 2014, 07:28
Default error c_face_loop
  #1
Member
 
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 15
behest is on a distinguished road
Dear all,
I've written a UDF to compute the length scale of DES; the problem is that a error is obtained when I want to compile in Fluent. the error relates line 21 (c_face_loop(c,c_thread,n)). the UDF is as below:
#include "udf.h"

DEFINE_ON_DEMAND(rls)
{
Domain *domain=Get_Domain(ROOT_DOMAIN_ID);
Thread *c_thread;
cell_t c;
face_t f;
Thread *tf;
Node *node;
int n,k,counter;
real delx,dely,delz,deltamax,maxx=0,maxy=0,maxz=0;
float x[10],y[10],z[10];

thread_loop_c(c_thread,domain) /*loops over all cell threads in domain*/
{
begin_c_loop(c,c_thread) /* loops over cells in a cell thread */
{
c_face_loop(c,c_thread,n) /* loops over faces in a cell thread */
{
f=C_FACE(c,c_thread,n);
tf = C_FACE_THREAD(c,c_thread,n);
counter=0;
f_node_loop(f,c_thread,n) /* loops over nodes in a face thread */
{
node=F_NODE(c,c_thread,n);
x[counter]=NODE_X(node);
y[counter]=NODE_Y(node);
z[counter]=NODE_Z(node);
++counter;
}
for (i=0; i<(counter-1); ++i)
{
for (k=i+1; k<counter; k++)
{
delx=fabs(x[i]-x[k]);
dely=fabs(y[i]-y[k]);
delz=fabs(z[i]-z[k]);
if (delx>maxx)
{
maxx=delx;
}
if (dely>maxy)
{
maxy=dely;
}
if (delz>maxz)
{
maxz=delz;
}
}
}
}
deltamax=0;
if (deltamax<maxx)
{
deltamax=maxx;
}
if (deltamax<maxy)
{
deltamax=maxy;
}
if (deltamax<maxz)
{
deltamax=maxz;
}
C_UDMI(c,c_thread,0)=sqrt(C_K(c,c_thread))/(0.09*0.61*deltamax*C_O(c,c_thread));
}
end_c_loop(c,c_thread)
}
}

It would be appricaiated if you make a comment about this problem.

Last edited by behest; February 12, 2014 at 06:46.
behest is offline   Reply With Quote

Old   February 12, 2014, 06:25
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
This code compiles for me without any problem. Which version of Fluent are you using? (I tested it in 14.5.0, 3d, single precision)
pakk is offline   Reply With Quote

Old   February 12, 2014, 06:38
Default
  #3
Member
 
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 15
behest is on a distinguished road
Hello, Thank you very much. As you said, when this code would be compiled, any errors is occured. you are right. Before that, I used interprate at first and I recieved the error, but when I apply compile, the error is not existed too.

any way, I wrote the udf and it is compile too; now, how can I pick the result up? actually, when I want to execute on demand, I recived an error as below:

Error:
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0\win6 4\3ddp\fl1450s.exe 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: #f

Do you know how will it be solved?

Quote:
Originally Posted by pakk View Post
This code compiles for me without any problem. Which version of Fluent are you using? (I tested it in 14.5.0, 3d, single precision)
behest is offline   Reply With Quote

Old   February 12, 2014, 08:25
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
ACCESS_VIOLATION means that the program is trying to access something which is impossible.

It could for example mean that in the line "x[counter]=NODE_X(node);", NODE_X(node) is not defined. Or that x[counter] is not defined.
You have to find out where it went wrong. See how far the program got by writing something to the screen, for example. Debug it.
behest likes this.
pakk is offline   Reply With Quote

Old   February 12, 2014, 13:38
Default
  #5
Member
 
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 15
behest is on a distinguished road
thank you very much. The problem has been solved by your guidelines.

Quote:
Originally Posted by pakk View Post
ACCESS_VIOLATION means that the program is trying to access something which is impossible.

It could for example mean that in the line "x[counter]=NODE_X(node);", NODE_X(node) is not defined. Or that x[counter] is not defined.
You have to find out where it went wrong. See how far the program got by writing something to the screen, for example. Debug it.
behest 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



All times are GMT -4. The time now is 17:28.