CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   'execute on demand' shut down fluent automatically (

czhao86 September 26, 2013 10:11

'execute on demand' shut down fluent automatically

#include "udf.h"

extern float plasma[4];

int i;
FILE *rfile; /* declare a FILE pointer */

rfile = fopen("try.txt", "r"); /* open file for reading */
Message("file opened\n");

/* loop to read file */
i=0; /* initialize before to loop */
for (i=0;i<4;i++)
fscanf (rfile, "%f", &plasma[i]); /* that supposes one value per line */

Message("file closed\n");

I am trying to import data from a text file named 'try.txt'. After compiling the UDF, and Fluent will close when I click 'execute' under 'execute on demand'. I put try.txt in the same folder as the UDF. Anyone have some idea? Thanks.

czhao86 September 26, 2013 15:42

It turns out that I need to interpret a UDF before do the execute. I don't know why, but it is working now.

All times are GMT -4. The time now is 01:45.