|
[Sponsors] |
October 2, 2009, 01:59 |
question on Macros: C_FACE and C_FACE_THREAD
|
#1 |
New Member
maye
Join Date: Oct 2009
Posts: 9
Rep Power: 17 |
#include <stdio.h>
#include "udf.h" #include "mem.h" #define UDF_FILE "maye_out.dat" DEFINE_ADJUST(timemean,domain) { Thread *t = Lookup_Thread(domain, 2); cell_t c; face_t f; Thread *tf; real xf[ND_ND]; float velx,vely,x1,y1; int m; FILE *fp1=fopen(UDF_FILE, "w"); i=1; { begin_c_loop(c,t) { c_face_loop(c,t,m) { f=C_FACE(c,t,m); tf=C_FACE_THREAD(c,t,m); F_CENTROID(xf,f,tf); x1=xf[0]; y1=xf[1]; velx=F_U(f,tf); vely=F_V(f,tf); fprintf(fp1,"%d %e %e %e %e\n",i,x1,y1,velx,vely); } } end_c_loop(c,t) } fclose(fp1); } I want to use the above UDF file to loop the face (domain 2) first. Within each cell, I want to loop the edges of the cell and get the coordinates and velocities at each center of edge by C_FACE and C_FACE_THREAD. However FLUENT can complied it but can not export the results. If I use C_FACE only and delete C_FACE_THREAD (tf should be changed to t), FLUENT could export but the results of edges' information are not the edges of each cell (irregular). I don't know why. Please help. Thanks! Last edited by maye761; October 2, 2009 at 02:40. |
|
October 2, 2009, 04:26 |
|
#2 |
New Member
maye
Join Date: Oct 2009
Posts: 9
Rep Power: 17 |
i just found that the problem is from F_U(f,tf) and F_V(f,tf). The coordinates are correct, but it seems that FLUENT does not allow me to get the velocities components on the cell's edges, but the scalar, say pressure, the results look ok.
|
|
October 2, 2009, 11:58 |
|
#3 |
New Member
maye
Join Date: Oct 2009
Posts: 9
Rep Power: 17 |
i tried to loop the nodes instead of loop the edges of each cell. However, FLUENT don't know what is "NODE_GX" and can not complie the following program. (The node coordinates are checked to be correct)
Node *node; c_node_loop(c,t,n) { node=C_NODE(c,t,n); fprintf(fp1,"%d %e %e %e \n",i,NODE_X(node),NODE_Y(node),NODE_GX(node)); } |
|
January 4, 2017, 22:37 |
|
#4 | |
New Member
Harry
Join Date: Sep 2011
Posts: 1
Rep Power: 0 |
Quote:
Can "NODE_GX" be run in your UDF now? |
||
|
|