CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   load txt file in fluent (http://www.cfd-online.com/Forums/fluent/98245-load-txt-file-fluent.html)

Yannian March 6, 2012 14:33

load txt file in fluent
 
Hi everyone,
Where should I put the txt file when I want to load it? Is it in the same document as case file and udf or in somewhere different?
Yannian

Yannian March 6, 2012 16:13

This is the code, Please point out what's wrong with the code and which directory the 'p.txt' should be put in.
Thanks!
Yannian

#include "udf.h"
DEFINE_PROFILE(pressure_inlet,thread,index)
{
FILE *fp;
int i;
real xp[16];
face_t f;
fp = fopen("p.txt","r");
for (i=1; i<16; i++)
{
fscanf(fp, "%f", &xp[i]);
}
for (i=1; i<16; i++)
{
Message("%3.2f",xp[i]);
}
printf("\n");
fclose(fp);
i=1;
begin_f_loop(f,thread) /* loops over all faces in the thread passed in the DEFINE macro argument */
{
F_PROFILE(f,thread,index) = radexp[i];
i=i+1;
}
end_f_loop(f,thread)
}


All times are GMT -4. The time now is 09:37.