udf error
hi,
I am currently trying to write udf to time-average some LES flow properties that Fluent doesn't time-average as default. As a starting point I have copied an execute_at_end udf from the manual, exactly as it is written in the manual, yet I get error messages when I try to compile or interpret it. My udf is as follows: #include "udf.h" DEFINE_EXECUTE_AT_END(averager) { Domain *d; Thread *t; /* Integrate dissipation. */ real sum_diss=0.; cell_t c; d = Get_Domain(1); /* mixture domain if multiphase */ thread_loop_c(t,d) { begin_c_loop )c,t) sum_diss += C_D(c,t) * C_VOLUME(c,t); end_c_loop(c,t) } } printf("Volume integral of turbulent dissipation: %g\n", sum_diss); fflush(stdout); } And the error message I get is: line 15: begin_c_loop: undeclared variable Does anyone have any ideas? Thanks |
It looks like your parentheses are backwards in your cell loop. Try this:
#include "udf.h" DEFINE_EXECUTE_AT_END(averager) { Domain *d; Thread *t; /* Integrate dissipation. */ real sum_diss=0.; cell_t c; d = Get_Domain(1); /* mixture domain if multiphase */ thread_loop_c(t,d) { begin_c_loop(c,t) { sum_diss += C_D(c,t) * C_VOLUME(c,t); } end_c_loop(c,t) } } printf("Volume integral of turbulent dissipation: %g\n", sum_diss); fflush(stdout); } |
Actually, after looking at this UDF, you have an extra } after the end_c_loop(c,t). Remove it to make sure all brackets are balanced. After doing that, the UDF compiled on my system without error.
|
All times are GMT -4. The time now is 23:19. |