CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF problem (https://www.cfd-online.com/Forums/fluent/50296-udf-problem.html)

Travis January 15, 2009 15:34

UDF problem
 
I'm trying to write a UDF for a modified v2f turbulence model. I'm getting the following error:

Error: (path)\v2f.c: line 142: function returning double returns float.

That section of code reads like this:

DEFINE_UDS_FLUX(user_flux, f, t, eqn) {

switch (eqn) { case K: return F_FLUX(f,t); break;

case E: return F_FLUX(f,t); break;

case V2: return F_FLUX(f,t); break;

case F: return 0.0; <--- This is the line with the error break;

default: return 0.0; }

}

Any thoughts on why I'm getting that error?

KJ Larsen January 21, 2009 12:48

Re: UDF problem
 
Hello Travis

The error is because the function returns a double and the finickity compiler must consider 0.0 to be a float but not a double (not sure how this is possible). You could define a global variable double zero = 0.0; although this could just move the problem somwhere else. Internet defines the double range as +/-1.7E+/-108 which does annoyingly omit 0. Afraid I don't know what to do... Normally initialise everything that isn't an integer to be a real. Define_UDS_Flux's definition in udf.h seems to suggest real is the type of value it wants to return.

Hope that is helpful. Kris


All times are GMT -4. The time now is 21:03.