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

udf error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 30, 2013, 07:55
Default udf error
  #1
New Member
 
Phil
Join Date: Jun 2013
Posts: 11
Rep Power: 13
randomPhil is on a distinguished road
hi,

I am currently trying to write udf to time-average some LES flow properties that Fluent doesn't time-average as default.

As a starting point I have copied an execute_at_end udf from the manual, exactly as it is written in the manual, yet I get error messages when I try to compile or interpret it.

My udf is as follows:
#include "udf.h"

DEFINE_EXECUTE_AT_END(averager)
{

Domain *d;
Thread *t;
/* Integrate dissipation. */
real sum_diss=0.;
cell_t c;
d = Get_Domain(1); /* mixture domain if multiphase */

thread_loop_c(t,d)
{
begin_c_loop )c,t)
sum_diss += C_D(c,t) * C_VOLUME(c,t);
end_c_loop(c,t)
}
}

printf("Volume integral of turbulent dissipation: %g\n", sum_diss);
fflush(stdout);
}


And the error message I get is:
line 15: begin_c_loop: undeclared variable

Does anyone have any ideas?

Thanks
randomPhil is offline   Reply With Quote

Old   June 30, 2013, 09:41
Default
  #2
Member
 
Christopher Hershey
Join Date: Feb 2012
Location: East Lansing, Michigan
Posts: 41
Rep Power: 14
Hershey is on a distinguished road
It looks like your parentheses are backwards in your cell loop. Try this:

#include "udf.h"

DEFINE_EXECUTE_AT_END(averager)
{

Domain *d;
Thread *t;
/* Integrate dissipation. */
real sum_diss=0.;
cell_t c;
d = Get_Domain(1); /* mixture domain if multiphase */

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
sum_diss += C_D(c,t) * C_VOLUME(c,t);
}
end_c_loop(c,t)
}
}

printf("Volume integral of turbulent dissipation: %g\n", sum_diss);
fflush(stdout);
}
Hershey is offline   Reply With Quote

Old   June 30, 2013, 09:53
Default
  #3
Member
 
Christopher Hershey
Join Date: Feb 2012
Location: East Lansing, Michigan
Posts: 41
Rep Power: 14
Hershey is on a distinguished road
Actually, after looking at this UDF, you have an extra } after the end_c_loop(c,t). Remove it to make sure all brackets are balanced. After doing that, the UDF compiled on my system without error.
Hershey is offline   Reply With Quote

Reply

Tags
compiled, error, fluent, interpreted, udf


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
Undeclared Identifier Errof UDF SteveGoat Fluent UDF and Scheme Programming 7 October 15, 2014 08:11
Problem with UDF compiling for kTkLW model Wantami FLUENT 0 July 18, 2011 06:11
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
Installation OF1.5-dev ttdtud OpenFOAM Installation 46 May 5, 2009 03:32
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


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