CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Why my UDF return Zero?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2015, 05:40
Default Why my UDF return Zero?
  #1
Member
 
Siamak
Join Date: Jul 2014
Location: Australia
Posts: 36
Rep Power: 11
siamak1438 is on a distinguished road
Hello Friends,
I am going to calculate the following expression in FLUENT to plot the vorticity in my 2D model.

D=(du/dx+dv/dy)^2-4(du/dx*dv/dy-du/dy*dv/dx)
I write the following UDF:

DEFINE_ON_DEMAND(vorticity)

{
Domain *domain;
cell_t c;
Thread *t;
domain=Get_Domain(1);
thread_loop_c (t,domain)
{
begin_c_loop (c,t)
{
C_UDMI(c,t,0) = pow((C_DUDX(c,t)+C_DVDY(c,t)),2)+4*(C_DUDX(c,t)*C_ DVDY(c,t)-C_DUDY(c,t)*C_DVDX(c,t));
}
end_c_loop (c,t)
}

Message("Done!");
}

But when I run the execution on demand, it returns zero, that means this code is not working?
I change the formula and write C_UDMI(c,t,0) = C_DUDX(c,t) and again it returns zero. Why velocity derivatives are not working?
Thank you in advance for your assistance
Siamak
siamak1438 is offline   Reply With Quote

Old   August 27, 2015, 07:16
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 12
Bruno Machado is on a distinguished road
Add this line before your message and compute manually the values to make sure you are reading them correctly:

if((c%10000) == 0)
Message("DUDX %f, DVDY %f, DUDY%f, DVDX %f\n", C_DUDX(c,t), C_DVDY(c,t), C_DUDY(c,t), C_DVDX(c,t));
Bruno Machado is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error during interpreting UDF for VoF vekh Fluent UDF and Scheme Programming 9 March 12, 2018 02:57
UDF diffusivity (strain rate)-UDS Lilly Fluent UDF and Scheme Programming 0 September 6, 2013 03:47
I need UDF help. S.Whitney FLUENT 0 October 15, 2007 12:29
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 10:25.