CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

question on Macros: C_FACE and C_FACE_THREAD

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 2, 2009, 00:59
Default question on Macros: C_FACE and C_FACE_THREAD
  #1
New Member
 
maye
Join Date: Oct 2009
Posts: 9
Rep Power: 9
maye761 is on a distinguished road
#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 01:40.
maye761 is offline   Reply With Quote

Old   October 2, 2009, 03:26
Default
  #2
New Member
 
maye
Join Date: Oct 2009
Posts: 9
Rep Power: 9
maye761 is on a distinguished road
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.
maye761 is offline   Reply With Quote

Old   October 2, 2009, 10:58
Default
  #3
New Member
 
maye
Join Date: Oct 2009
Posts: 9
Rep Power: 9
maye761 is on a distinguished road
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));
}
maye761 is offline   Reply With Quote

Old   January 4, 2017, 22:37
Default
  #4
New Member
 
Harry
Join Date: Sep 2011
Posts: 1
Rep Power: 0
heshun is on a distinguished road
Quote:
Originally Posted by maye761 View Post
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));
}
Hi,

Can "NODE_GX" be run in your UDF now?
heshun is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On



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