CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Data logging in UDF (https://www.cfd-online.com/Forums/fluent/49399-data-logging-udf.html)

carno October 1, 2008 05:45

Data logging in UDF
 
Hi,

I am calculating many parameters in UDF used in transient analysis and I want to plot their graph with respect to time. I am not able to log the parameters in file directly from UDF. I have solved the problem temporarily by 'messaging' it out (printing on screen) and writing transcript file and opening that file in excel. It is very cumbersome and additionally excel has limitation of ~65000 rows.

I am sure this is not very difficult problem and might be faced by many. Can anybody send me the UDF script for data logging?

Thanks in advance for help.

grisu October 3, 2008 13:27

Re: Data logging in UDF
 
FILE *filepointer; /*First you need to define your filepointer*/

filepointer=fopen(filename,"a"); /*next open the file with filename for _a_ppending*/

fprintf(filename,"your-text, %5d\n", your-var); /*output a variable with leading text + newline*/

.... /*output whatever you want*/

fclose(filepointer); /*finally close the file*/

At least for my udf this is doing the job ;)

carno October 6, 2008 01:43

Re: Data logging in UDF
 
Great.. I will check this.


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