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

write UDF results to .txt file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread 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: 73
Rep Power: 15
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


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 Off
Pingbacks are On
Refbacks are On


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


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