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/)
-   -   I/O of a real value by "DEFINE_RW_FILE" (UDF) (http://www.cfd-online.com/Forums/fluent-udf/32343-i-o-real-value-define_rw_file-udf.html)

Pietro Asinari October 18, 2003 05:05

I/O of a real value by "DEFINE_RW_FILE" (UDF)
 
Hi all,

I'm trying to add a real value to DATA file by "DEFINE_RW_FILE" macro (UDF). In the following, find the code. The first sub writes the correct value (I have verified the DATA file) while the second one fails. The same code works well if you consider an integer value (%d), like reported in the UDF manual. I have tried unsuccessfully other file formats (%e,%f,%1.6e,...).

What's the matter ?

Thanks a lot,

Pietro

------------------------------------------------------

#include "udf.h"

real XREAL;

DEFINE_RW_FILE(writer, fp) {

XREAL = 23.678;

printf("Writing UDF data to data file...\n");

fprintf(fp, "%g\n",XREAL); /* write to data file */

printf("\n XREAL = %g \n",XREAL); }

------------------------------------------------------

DEFINE_RW_FILE(reader, fp) {

printf("Reading UDF data from data file...\n");

fscanf(fp, "%g\n",&XREAL); /* read from data file */

printf("\n XREAL = %g\n",XREAL); }

------------------------------------------------------

Writing UDF data to data file... XREAL = 23.678 Done.

Reading UDF data from data file... XREAL = 5.44921e-315 Done.


pc_UNR August 15, 2015 19:08

Hi Pietro,
I want to know from you how to find the saved value of XREAL. I have saved my data and case file after a specific time for my case. I loaded the result in CFD_POST.
I couldn't see the saved data.
Please let me know about this.
Sorry it is not relevant to your question.
Appreciate!!


All times are GMT -4. The time now is 20:34.