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

Writing UDF to represent drag equations

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 26, 2015, 13:53
Default Writing UDF to represent drag equations
  #1
New Member
 
Join Date: Jan 2015
Posts: 11
Rep Power: 11
Dawood Al-Mosuli is on a distinguished road
Hello,
I am new with using UDF. I tried to write one to represent the drag equations in the attached file for 3 phase flow (1 liquid and 2 solid).

I tried to write one similar (below) to that provided in section 2.4.2 DEFINE_EXCHANGE_PROPERTY in UDF manual [UDF for customizing the default Syamlal drag law in Fluent] , but it doesn't work. It seems that I have a problem with defining inputs [I got error when defining the solid fraction Es].

/************************************************** *************
UDF for customizing the default Syamlal drag law in Fluent
************************************************** **************/

#include "udf.h"

#define pi 4.*atan(1.)
#define diam2 0.000163

DEFINE_EXCHANGE_PROPERTY(custom_drag,cell,mix_thre ad,s_col,f_col)
{
Thread *thread_l, *thread_s;
real x_vel_l, x_vel_s, y_vel_l, y_vel_s, abs_v, slip_x, slip_y,
rho_l, rho_s, mu_l, reyp, afac,
bfac, void_l, vfac, fdrgs, taup, k_g_s;

/* find the threads for the gas (primary) */
/* and solids (secondary phases) */

thread_l = THREAD_SUB_THREAD(mix_thread, s_col);/* gas phase */
thread_s = THREAD_SUB_THREAD(mix_thread, f_col);/* liquid phase*/

/* find phase velocities and properties*/

x_vel_l = C_U(cell, thread_l);
y_vel_l = C_V(cell, thread_l);

x_vel_s = C_U(cell, thread_s);
y_vel_s = C_V(cell, thread_s);

slip_x = x_vel_l - x_vel_s;
slip_y = y_vel_l - y_vel_s;

rho_l = C_R(cell, thread_l);
rho_s = C_R(cell, thread_s);

mu_l = C_MU_L(cell, thread_l);
void_l = C_VOF(cell, thread_l);/* gas vol frac*/


k_g_s =(6 / 27) * (3.6*Es / pow(El,2.0) + pow (El,2.0)) + (0.11 + ( 2*K /(3 * pow(Vs, 2.0))));


return k_g_s;
}




I got the error : Es: undeclared variable
Can any one give me instructions about my mistakes and how to write a correct one.
Dawood Al-Mosuli is offline   Reply With Quote

Old   April 27, 2015, 06:02
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
You should have posted your UDF question in Fluent UDF and Scheme Programming. There are no attached files in your post.

Quote:
Originally Posted by Dawood Al-Mosuli View Post
I got the error : Es: undeclared variable
Can any one give me instructions about my mistakes and how to write a correct one.
If you have not declared "Es" then this variable is an undeclared variable and you should first declare this variable before attempting to access this variable.
`e` is offline   Reply With Quote

Reply


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
How to Mix AIR and WATER Elvis1991 FLUENT 12 December 1, 2016 13:28
Writing UDF (DEFINE_PROFIL) for two surfaces Geisel Fluent UDF and Scheme Programming 5 June 21, 2010 09:38
About UDF for pressure Drag mkrao FLUENT 2 February 8, 2009 06:51
Actual drag force from dimensionless equations slaxmi CFX 10 September 14, 2007 20:20
Inviscid Drag at subsonic, subcritical Mach # Axel Rohde Main CFD Forum 1 November 19, 2001 13:19


All times are GMT -4. The time now is 07:33.