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/)
-   -   UDF to extract the velocity (https://www.cfd-online.com/Forums/fluent-udf/160948-udf-extract-velocity.html)

siamak1438 October 16, 2015 00:22

UDF to extract the velocity
 
Hello Guys,
I need to define a plane in the middle of the geometry (3D) and then extract the velocity of each node in that plane.The Id of that plane is 6, so I wrote the following UDF abut it is not working. Which part do you think is not correct?

#include "udf.h"
#include "mem.h"
#define thread_ID 6

DEFINE_ON_DEMAND(INIT)
{
Domain *domain;
Thread *t;
cell_t c;

FILE *Fileoutput;
int n,Iter;

domain = Get_Domain(1);
t = Lookup_Thread(domain, thread_ID);
Fileoutput=fopen("VEL.txt","a+");

begin_c_loop(c, t)

{
fprintf(Fileoutput,"\n %f %f %f", C_U(c,t), C_V(c,t), C_W(c,t));
}

end_c_loop(c, t)

fclose(Fileoutput);

}

`e` October 17, 2015 00:32

Are you receiving any compiler errors, is the text file being opened and is any text being written to this file?

Try printing the velocities to the screen (using the Message() function inside your cell loop) to help debug your problem.

pakk October 19, 2015 07:32

Quote:

but it is not working
Be more specific.

Do you have problems with compiling? Interpreting? Loading? Running? Getting results? Showing results?


All times are GMT -4. The time now is 01:41.