# UDF programming problem

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 25, 2002, 08:46 UDF programming problem #1 Christian Guest   Posts: n/a Hello everybody! I have to use an if-statement within the user-defined-function for turbulent viscosity. The code is as follows: DEFINE_TURBULENT_VISCOSITY(cabot_mu_t, c, t) { real mu_t; real D_y; real utau; real rho = C_R(c, t); real yplus; real mu_lam = C_MU_L(c, t); real uzz = mu_lam * C_DWDY(c, t); Thread *WANDNAEHE1 = Lookup_Thread(domain, 8); mu_t = C_MU_T(c, t); if (t == WANDNAEHE1) { yplus = zgrid / mu_lam * SQR (uzz) * rho; if (yplus >= 1) { utau = SQR(uzz/rho); D_y = (1-exp(-(yplus/17))) * (1-exp(-(yplus/17))); mu_t = ((0.42 * zgrid) * utau * D_y); } } return mu_t; } The fluid zone with ID=8 is defined to consist of only wall-neighboring cells. There are no problems during the compilation process, but the if-statement does not work. My question is as follows: Is it allowed to use thread-definitions in if statements? And why the hell does Fluent not execute the computation for mu_t although some of the cells in thread t have to be in thread WANDNAEHE1, too. All not variables that are not declared within this exerpt are declared "globally". If anybody knows to help me I would be very grateful! Chrsitian

 April 25, 2002, 18:58 Re: UDF programming problem #2 Greg Perkins Guest   Posts: n/a This looks like a basic oversight. I can't see any definition for the value of the variable zgrid. Its likely that this will be initialised to zero and thus you'll never have a condition that yplus >= 1, hence you'll never set mu_t using your own code. Greg

 April 25, 2002, 19:07 Re: UDF programming problem #3 Johnix Guest   Posts: n/a Hi, Are you using Fluent 6.0? I have only used 5.5 so far. I am not sure whether there is such a macro, DEFINE_TURBULENT_VISCOSITY, maybe different names. Anyway, I think there is an obvious problem in your code, i.e. where the value of "domain" comes from since "domain" is not in the arguments list of this function? Maybe you can statically(globally) define a var to send value to "domain" ... Cheers

 April 26, 2002, 04:08 Re: UDF programming problem #4 Christian Guest   Posts: n/a Hello and thanks for your help! As I said in the posting all variables that are not defined in this excerpt are defined before in the UDF. so that could not have been the problem. As I can say by now there is no error within the UDF, it seemed to have been an error in the Fluent case file. I managed to fix it but I have no explanation how i occurred. Anyway, thanks again! Christian @Johnix - I am using Fluent 6.0 but I think the DEFINE_TURBULENT_VISCOSITY makro existed in Fluent 5, too.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Rizwan Fluent UDF and Scheme Programming 32 May 8, 2015 06:05 july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56 saranyasimi Main CFD Forum 0 December 1, 2009 13:19 mansha goraya FLUENT 0 October 29, 2007 01:31 akr FLUENT 3 August 22, 2007 07:14

All times are GMT -4. The time now is 23:02.

 Contact Us - CFD Online - Top