|
[Sponsors] |
February 11, 2014, 08:28 |
error c_face_loop
|
#1 |
Member
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 16 |
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 07:46. |
|
February 12, 2014, 07:25 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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)
|
|
February 12, 2014, 07:38 |
|
#3 |
Member
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 16 |
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? |
|
February 12, 2014, 09:25 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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. |
|
February 12, 2014, 14:38 |
|
#5 | |
Member
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 16 |
thank you very much. The problem has been solved by your guidelines.
Quote:
|
||
|
|