Error: WorkBench Error: Could not register files of type:Udf
As the title, I have an error after initializing (it is still ok), but after running calculation it appears.
"Error: WorkBench Error: Could not register files of type:Udf" error photo: http://i62.tinypic.com/16q51u.png I think the problem is at the begining, with FILE *fid. I can not write this file. here's my code : ------------------------------------------------------------------------------- #include "udf.h" FILE *fid; DEFINE_PROFILE(flux_setget,t,i) { face_t f; int zoneid = THREAD_ID(t); /* Write the property and thread id values for the flux condition to file */ fid = fopen("flux-ids", "w"); fprintf(fid, "%d, %d\n", zoneid, i); fclose(fid); /* Set initial profile values */ begin_f_loop(f,t) { F_PROFILE(f,t,i) = 10; } end_f_loop(f,t) } DEFINE_ADJUST(flux_adjuster, domain) { int iprop; int izone; int n = 0; Thread *t; face_t f; Thread *c_thread; cell_t c; real pressure = 1; real newvel; /* Read in the property and thread id values stored by the BC UDF */ fid = fopen("flux-ids", "r"); fscanf(fid,"%d, %d", &izone, &iprop); fclose(fid); thread_loop_c(c_thread, domain) /*loops over all cell threads in domain*/ { /* Loop over cells in a thread to get information stored in cells. */ begin_c_loop(c, c_thread) { /* C_T gets cell temperature. The += will cause all of the cell temperatures to be added together. */ pressure += C_T(c, c_thread); n = n+1; } end_c_loop(c, c_thread) } pressure=pressure; /* Get the thread pointer based on the obtained zone id */ t = Lookup_Thread(domain, izone); /* Read the needed data, then calculate and set the new flux values */ begin_f_loop(f,t) { if (pressure < 330) newvel = 0; else newvel = sqrt(2*(fabs(pressure))/1.225); F_PROFILE(f,t,iprop) = newvel; } end_f_loop(f,t) } DEFINE_PROFILE(unsteady_pressure, thread, position) { face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = 5 + 4*sin(6.28* t); } end_f_loop(f, thread) } |
All times are GMT -4. The time now is 01:09. |