how to run this UDF ?
This UDF file is from help file,it is used to get the cell's centroids coordinates on the specified boundary face.and it passed the compilation. But the the result file "faces.out" was not generated after the computatoin completed. what's the problem? how to run this UDF correctly and get the result file?
# include "udf.h" FILE *fout; Print_Thread_Face_Centroids(Domain *domain, int id) { real x[ND_ND]; face_t f; Thread *t=Lookup_Thread(domain, id); fprintf(fout,"thread id%d\n",id); begin_f_loop(f,t) { F_CENTROID(x,f,t); fprintf(fout,"f%d %g %g\n",f,x[0],x[1]); } end_f_loop(f,t) fprintf(fout,"\n"); } DEFINE_ON_DEMAND(get_coords) { Domain *domain; domain = Get_Domain(1); fout = fopen("H:\Getpressure\faces.out","w"); Print_Thread_Face_Centroids(domain,5); Print_Thread_Face_Centroids(domain,3); fclose(fout); } |
Re: how to run this UDF ?
# include "udf.h"
FILE *fout; Print_Thread_Face_Centroids(Domain *domain, int id) { real x[ND_ND]; face_t f; Thread *t=Lookup_Thread(domain, id); fprintf(fout,"thread id%d\n",id); begin_f_loop(f,t) { F_CENTROID(x,f,t); fprintf(fout,"f%d %g %g\n",f,x[0],x[1]); } end_f_loop(f,t) fprintf(fout,"\n"); } DEFINE_ON_DEMAND(get_coords) { Domain *domain; domain = Get_Domain(1); fout = fopen("H:\Getpressure\faces.out","w+"); Print_Thread_Face_Centroids(domain,5); Print_Thread_Face_Centroids(domain,3); fclose(fout); } |
Re: how to run this UDF ?
sorry,it should change this sentence, fout = fopen("H:\Getpressure\faces.out","w+"); into: fout = fopen("faces.out","w+");
|
All times are GMT -4. The time now is 21:25. |