CFD Online URL
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

new propety

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Display Modes
Old   December 9, 2013, 08:01
Default new propety
  #1
Member
 
shahrbanoo
Join Date: Mar 2013
Posts: 58
Rep Power: 3
shahrbanoo is on a distinguished road
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
DEFINE_PROPERTY(Power_law_model,cell,thread)
{
float visc,trace;
float u[3],v[3],w[3];
int i;
for(i=0; i<3; i++)
{
u[i] = C_U_G(cell,thread)[i];
v[i] = C_V_G(cell,thread)[i];
w[i] = C_W_G(cell,thread)[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?
please help me...
shahrbanoo is offline   Reply With Quote

Old   December 9, 2013, 09:06
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 383
Rep Power: 6
pakk is on a distinguished road
You don't have to worry about this.

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 likes this.
pakk is offline   Reply With Quote

Old   December 9, 2013, 12:57
Default
  #3
Member
 
shahrbanoo
Join Date: Mar 2013
Posts: 58
Rep Power: 3
shahrbanoo is on a distinguished road
thank u so much Mr PaKK
The error went away!!
shahrbanoo is offline   Reply With Quote

Old   December 10, 2013, 03:55
Default
  #4
Member
 
shahrbanoo
Join Date: Mar 2013
Posts: 58
Rep Power: 3
shahrbanoo is on a distinguished road
Hi
I want to run my case
but when I initialize it, says:
Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()

why is this error for?
regards
shahrbanoo is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:52.