CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

Problem UDF for Turbulen viscosity

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

LinkBack Thread Tools Display Modes
Old   October 26, 2012, 15:40
Default Problem UDF for Turbulen viscosity
Fer Villa
Join Date: Apr 2012
Posts: 35
Rep Power: 7
fevi84 is on a distinguished road
Hi all,

How i can retrieve variables of different domains inside the same macro? I have retrieve the liquid density value, gas density value and turbulent viscosity inside the same macro. I want set up the Turbulent viscosity in the secondary phase using "dispersed" as Turbulent Multiphase Model in the k-e model.

I tried with the following udf:

DEFINE_TURBULENT_VISCOSITY(mu_t_ke_air, c, phase_t)
Thread *mt; /* mixture or super thread*/
Thread **all_phase_threads; /* An array of all the phase threads */

mt = THREAD_SUPER_THREAD(phase_t);
all_phase_threads = THREAD_SUB_THRADS(mt);

/* all_phase_threads[0] is primary thread, */
/* all_phase_threads[1] first secondary phase thread */

real mu_tg;
real rho_l = C_R(c,all_phase_threads[0]);
real rho_g = C_R(c,all_phase_threads[1]);
real mu_tl = C_MU_T(c,all_phase_threads[0]);
mu_tg = mu_tl*rho_g/rho_l;

return mu_tg;


But, this udf gave the following erro:

THREAD_SUB_THRADS is an undeclared variable.

Anyone know why gave this erro. If anyone knows another way to do it, using other pointer, etc..., please tell me.

fevi84 is offline   Reply With Quote

Old   January 17, 2017, 15:18
New Member
Ekta J
Join Date: Jul 2014
Posts: 5
Rep Power: 4
Ekta J is on a distinguished road
Hello, Does anyone know the correct udf for modifying turbulent viscosity in k-epsilon per phase model? (for Euler-Euler)

I am using the following udf (modified as per my knowledge, from the basic udf for k-epsilon mixture model) But it does not seem to be taking the correct value of k, epsilon etc from the fluent:

#include "udf.h"


real rho_g, KE_g, D_g, mu_t_g;

rho_g = C_R(c, t); /* gas phase density */
KE_g = C_K(c, t); /* gas phase Kinetic energy */
D_g = C_D(c, t); /* gas phase epsilon */

mu_t_g= 0.09*rho_g*KE_g*KE_g/D_g;

C_UDMI(c,t,2) = mu_t_g; // (Calculated above)

return mu_t_g;

Ekta J is offline   Reply With Quote


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with divergence TDK FLUENT 11 July 31, 2016 06:03
UDF using problem, error happens-heip!! Michael FLUENT 1 December 9, 2008 08:51
Problem in compiling property(density) UDF satish2968 FLUENT 3 October 31, 2008 16:06
parallel UDF problem kerem FLUENT 2 June 20, 2006 06:56
Problem of Turbulent Viscosity Ratio Limited David Yang FLUENT 3 June 3, 2002 06:13

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