|
[Sponsors] |
April 25, 2002, 08:46 |
UDF programming problem
|
#1 |
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 |
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 |
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 |
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. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM | Rizwan | Fluent UDF and Scheme Programming | 40 | March 18, 2018 06:05 |
Problem with my udf | july | Fluent UDF and Scheme Programming | 3 | June 20, 2010 06:56 |
problem with udf programming in fluent | saranyasimi | Main CFD Forum | 0 | December 1, 2009 12:19 |
UDF problem | mansha goraya | FLUENT | 0 | October 29, 2007 00:31 |
udf compiling problem | akr | FLUENT | 3 | August 22, 2007 07:14 |