CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Data minning on an arbitrary zone... (https://www.cfd-online.com/Forums/fluent-udf/78039-data-minning-arbitrary-zone.html)

gary7 July 10, 2010 22:43

Data minning on an arbitrary zone...
 
Hi everybody, I'm trying to get data on a surface in the field which I define it as a new surface...does anybody know
how I can get the flow field variables like velocity u, v, w on the specified surface and save them in file?
And what if the surface is not coincident with that cell nodes or cell centers? can I still get the data on the corresponding node projection on the surface?

I really appreciate any help,

gary7 July 15, 2010 10:28

any help? idea? suggestion?

gearboy July 15, 2010 21:14

Quote:

Originally Posted by gary7 (Post 266753)
Hi everybody, I'm trying to get data on a surface in the field which I define it as a new surface...does anybody know
how I can get the flow field variables like velocity u, v, w on the specified surface and save them in file?
And what if the surface is not coincident with that cell nodes or cell centers? can I still get the data on the corresponding node projection on the surface?

I really appreciate any help,

Resolution:
/************************************************** ***************************
* Udf to retrieve the cells and thread (and subsequently all other variables)
* through which a surface, created for postprocessing, passes
* Written by Suman Basu of Fluent India
************************************************** **************************/
#include "udf.h"
#include "surf.h"
#define SURFID 4 /*this is the id of the surface of interest
could be checked from Surface->Manage GUI panel*/
DEFINE_ON_DEMAND(loop_over_surface)
{
int phase_domain_index;
real x[ND_ND];
cell_t cell;
CX_Cell_Id c;
Surface surf=SurfaceList[SURFID];
int i;
Thread *cell_thread;
FILE *fp;
fp=fopen("store.dat","a");
Message("%d",surf.np);
for(i=0;i<surf.np;i++)
{
c=surf.points[i].cell;
cell=RP_CELL(&c);
cell_thread=RP_THREAD(&c);
C_CENTROID(x,cell,cell_thread);
/*writes the X and Y coordinates of the cell centroid and cell index in the file*/
fprintf(fp,"%g %g %d\n",x[0],x[1],cell);
}
fclose(fp);
}

gary7 July 26, 2010 13:07

Thank you so much gearboy. It's perfect. This code returns the values on the centers of the cells through which the surface has passed. Since the surface is not necessarily passing through the cell centers but do you know how I can obtain the flow variables on the surface?
By the UDF you provided it is possible to obtain the cells through which the surface is passing do you know how the cell nodes coordinate can be obtained?
I mean by knowing the cell index and thread how I can find the coordinates of its nodes?

Thank you in advance,


All times are GMT -4. The time now is 00:34.