CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

write UDF results to .txt file

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 24, 2013, 10:20
Default write UDF results to .txt file
  #1
C.C
Member
 
CC
Join Date: Jun 2011
Posts: 52
Rep Power: 6
C.C is on a distinguished road
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...
C.C 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
funkySetFields compilation error tayo OpenFOAM 39 December 3, 2012 06:18
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57
2.0.x on Mac OSX niklas OpenFOAM Installation on Windows, Mac and other Unsupported Platforms 74 March 28, 2012 16:46
ParaView Compilation jakaranda OpenFOAM Installation 3 October 27, 2008 12:46
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 20:51


All times are GMT -4. The time now is 15:14.