CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   write UDF results to .txt file (http://www.cfd-online.com/Forums/fluent-udf/112242-write-udf-results-txt-file.html)

C.C January 24, 2013 10:20

write UDF results to .txt file
 
Hi all,

I want see what is interpreted by fluent when I change the wall law in a UDF... If I use a printf command I see the values printed on the screen and it is working well. When I try use a fprintf command to write them on a txt file I get some errors and it is not working...
My UDF is:
/*------------------------------------*/
#include"udf.h"
FILE *fp
DEFINE_WALL_FUNCTIONS(wall_law,f,t,c0,t0,wf_ret,yP lus,Emod)
{
real wf_value;

real M[ND_ND];
real Q[ND_ND];
int a,b;
F_CENTROID(M,f,t);
C_CENTROID(Q,c0,t0);
a=THREAD_ID(t0);
b=THREAD_ID(t);


switch (wf_ret)
{
case UPLUS_LAM:
wf_value=yPlus;
break;
case UPLUS_TRB:
wf_value=log(yPlus)/KAPPA+log(Emod)/KAPPA;
break;
case DUPLUS_LAM:
wf_value=1.0;
break;
case DUPLUS_TRB:
wf_value=1./(KAPPA*yPlus);
break;
case D2UPLUS_TRB:
wf_value=-1./(KAPPA*yPlus*yPlus);
break;
default:
printf("Wall function return value unavailable\n");
}

fprintf(fp, "%f %f %i %i %i %f %f %f %f\n", M[0], Q[0], a, b, wf_ret, wf_value, yPlus, Emod, KAPPA)
return wf_value;
}
/*-----------------------------*/

I'm a beginner on this.
Please, anyone can help me...


All times are GMT -4. The time now is 13:27.