UDF Error Message
Hi everyone. I have written a UDF to allow me to vary the inertial resistance of a porous zone at a particular time step. However, when I try interpreting the UDF into Fluent, I get the following error message:
"chip-exec: valve_1: wrong return type: void udf function expected" Can anyone tell me what I am doing wrong? My UDF is below... Thanks! #include "udf.h" DEFINE_SOURCE(valve_1, c, t, dS, eqn) { int timestep; real inertia_term; timestep = N_TIME; inertia_term = 10000.; if (timestep == 3) inertia_term = 0.; else inertia_term = 10000.; return inertia_term; } |
Re: UDF Error Message
I don't know what happened to your case exactly, but I guess that you had hooked the udf in a wrong panel maybe. hope it helps
Joey |
Re: UDF Error Message
Thanks Joey. Although you didn't exactly answer my question, you did point me in the right direction.
The issue wasn't that I hooked up the UDF wrong, I just used the wrong type. The Fluent manual uses an example with porous material for the DEFINE_SOURCE macro. However, this macro can only be used to change the mass, momentum, viscosity, and energy source terms. It cannot be used to change the inertial or viscous resistances. To change those, the DEFINE_PROFILE macro must be used. Searching through the archives, I found that this issue has come up before. For posterity's sake, here is the UDF that did what I wanted: #include "udf.h" DEFINE_PROFILE(valve_2, t, i) { face_t f; real x[ND_ND]; int timestep; real inertia_term; timestep = N_TIME; inertia_term = 0.; begin_f_loop(f, t) { F_CENTROID(x,f,t); if (timestep == 3) inertia_term = 10000.; else inertia_term = 0.; F_PROFILE(f,t,i)=inertia_term; } end_f_loop(f,t) } |
All times are GMT -4. The time now is 00:04. |