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

UDF for source term: ACCESS_VIOLATION

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 7, 2011, 15:05
Default UDF for source term: ACCESS_VIOLATION
  #1
New Member
 
YuanLiu
Join Date: Aug 2010
Posts: 10
Rep Power: 16
xiaoyoyo is on a distinguished road
Hi all,
I am writing UDFs for Antal wall lubrication force and turbulent dispersion force as source of x_momentum equation (as well as y and z direction). They can be compiled correctly, while when i start the calculation, Fluent gave me the error message:FLUENT received fatal signal (ACCESS_VIOLATION).

I also tried intepreted them, and I got the same error.

Can anybody help me to check my code? Thank you in advance!

Below is my UDF for x_momentum equation

#include
"udf.h"
#define dia32 0.0025 /* bubble size*/
#define CT 0.1 /* coefficient*/
#define CW1 0.01 /* coefficient*/
#define CW2 0.05 /* coefficient*/
DEFINE_SOURCE(xmom_source,cell,thread,dS,eqn)
{
real x_vel_g, x_vel_l, y_vel_g, y_vel_l, z_vel_g, z_vel_l, slip_x, slip_y, slip_z,
abs_v,rho_g, rho_l, reyb, void_g, k_l, g_alpha, CWL, dis, ratio_d, vector_w, U_ax,
source_WLx, source_TDx, source_x;
Thread *thread_g, *thread_l;
thread_l = THREAD_SUB_THREAD(thread, 0);
/* primary pahse: liquid*/
thread_g = THREAD_SUB_THREAD(thread, 1);/* Secondary phase: gas*/
/* find phase velocities and properties*/
x_vel_g = C_U(cell, thread_g);
y_vel_g = C_V(cell, thread_g);
z_vel_g = C_W(cell, thread_g);
x_vel_l = C_U(cell, thread_l);
y_vel_l = C_V(cell, thread_l);
z_vel_l = C_W(cell, thread_l);
rho_g = C_R(cell, thread_g);
rho_l = C_R(cell, thread_l);
slip_x = x_vel_g - x_vel_l;
slip_y = y_vel_g - y_vel_l;
slip_z = z_vel_g - z_vel_l;
void_g = C_VOF(cell, thread_g);
/* gas vol fraction */
dis = C_WALL_DIST(cell,thread); /* distance to wall*/
k_l = C_K(cell,thread_l); /*liquid turbulent kinetic engergy*/
/* U_ax = slip_x-(slip_x*vector_w)*vector_w; */
/* compute CWL */
CWL = MAX(0,CW1/dia32+CW2/dis);
/* compute ratio_d */
ratio_d = dis/dia32;
/*compute wall lubrication force*/
if (ratio_d <= 5.0)
{
source_WLx = -1*CWL*void_g*rho_l*(slip_x)*(slip_x);
}
else
{
source_WLx = 0;
}
/*compute turbulent dispersion force*/
if (NULL != THREAD_STORAGE(thread,SV_VOF_G))
{
g_alpha = C_VOF_G(cell,thread_g)[0]; /*gradient of air volume fraction*/
}
else
{
g_alpha = 0;
}
source_TDx = -1*CT*rho_l*k_l*g_alpha;
source_x = source_WLx + source_TDx;
dS[eqn] = 0;
return source_x;
}
xiaoyoyo 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
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 16:45
UDF Time-dependent term in source Ronnfors FLUENT 0 October 16, 2009 12:25
UDF Source Term Christian FLUENT 4 August 1, 2009 06:53
gradient source term UDF ak6g08 Fluent UDF and Scheme Programming 0 July 9, 2009 07:37
UDF Source Term Units? Brian FLUENT 1 October 24, 2005 10:15


All times are GMT -4. The time now is 15:01.