CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   new propety (https://www.cfd-online.com/Forums/fluent-udf/127336-new-propety.html)

 shahrbanoo December 9, 2013 08:01

new propety

Hi dears...
I had a code for defining new viscousity for blood, but when I interpret it, it says:
C:\Users\NoneStop\Desktop\viscous.c: line 18: function returning double returns float.
the code is here:
# include "udf.h"
# define n 0.67
# define alpha 1.0
# define muo 0.0042
{
float visc,trace;
float u[3],v[3],w[3];
int i;
for(i=0; i<3; i++)
{
}
trace = 0.5*(2*pow(u[0],2) + pow(v[0]+u[1],2) + 2*pow(v[1],2) + pow(v[2]+w[1],2) + 2*pow(w[2],2) + pow(w[0]+u[2],2));
visc = 0.5*muo*pow(1+alpha*trace,0.67);
return visc;
}
what should I do?

 pakk December 9, 2013 09:06

You are running Fluent in double precision, but the udf you wrote returns a value in single precision. The interpreter gives a warning about this, but for viscosity it is no problem to use single precision.

If you want to get rid of this warning, you can:
- Run Fluent in single precision (probably not preferred)
- Change the variable "visc" to a double (define it as "double visc" instead of "float visc".
- Explicitly cast the result into a double: change "return visc;" into "return (double)visc;"
disclaimer: I did not test these options, my syntax may be slightly wrong.

But you can also choose to ignore the warning.

 shahrbanoo December 9, 2013 12:57

thank u so much Mr PaKK
The error went away!!

 shahrbanoo December 10, 2013 03:55

Hi
I want to run my case
but when I initialize it, says:
Error: