Daisy
Subscriber

Hi,

I was trying to use a UDF for drag. However, whenever I am trying to enable the UDMIs it gives error as follows

 

Node 0: Process 3124: Received signal SIGSEGV.

#include "udf.h"
//#include "math.h"
DEFINE_EXCHANGE_PROPERTY(tsuchiya,cell,mix_thread,f_col,s_col)
{
//#if !RP_HOST
Thread *thread_w, *thread_a;
float x_vel_w,x_vel_a,y_vel_w,y_vel_a,z_vel_w,z_vel_a,slip_x,slip_y,slip_z,abs_v;
float alpha_w,alpha_a,rho_w,rho_a,mu_w,mu_a,diam,drag;
float re,etov,adrag,bdrag;
float diam_w,CD,drags;

/* find the threads for the water (primary) */
/* and gas (secondary phases) */
thread_w = THREAD_SUB_THREAD(mix_thread, f_col);     /* water phase*/
thread_a = THREAD_SUB_THREAD(mix_thread, s_col);     /* air phase */


/* find water phase velocities*/
x_vel_w = C_U(cell, thread_w);
y_vel_w = C_V(cell, thread_w);
z_vel_w = C_W(cell, thread_w);

/* find air phase velocities*/
x_vel_a = C_U(cell, thread_a);
y_vel_a = C_V(cell, thread_a);
z_vel_a = C_W(cell, thread_a);

/* find slip velocities air-water*/
slip_x = x_vel_w - x_vel_a;
slip_y = y_vel_w - y_vel_a;
slip_z = z_vel_w - z_vel_a;

/* to compute volume fraction in cells */
alpha_w= C_VOF(cell, thread_w);
alpha_a= C_VOF(cell, thread_a);
diam= C_PHASE_DIAMETER(cell, thread_a);

/* to compute density and viscosity in cells */
rho_w= C_R(cell, thread_w);
rho_a= C_R(cell, thread_a);
mu_w= C_MU_L(cell, thread_w);
mu_a= C_MU_L(cell, thread_a);

/* compute slip velocity */
abs_v = sqrt((slip_x*slip_x) + (slip_y*slip_y) + (slip_z*slip_z));   /* air-water slip velocity */

/*pair interaction*/

    /*compute Reynold’s number water as continuous*/
    re = (rho_w*abs_v*diam)/mu_w; 
             /* air-water*/ 
    etov = 9.81*(rho_w-rho_a)*(diam*diam)/0.072; 

    /* to compute the drag coefficient C_D*/
    adrag = (24.0/re)*(1.0+(0.15*pow(re,0.687)));     /* air-water slip velocity */
    bdrag = (8.0*etov)/((3.0*etov)+12.0);

    if (adrag > bdrag)
    {
        CD = adrag;
    }
    else
    {
        CD = bdrag;
    }
     
/*slag-water*/

    drags = (3.0*CD*(1.0- alpha_a)*rho_w*alpha_w*alpha_a*abs_v)/(4.0*diam);   /*air-water interaction*/
 /*water as continuous phase*/  
    drag = MAX(drags, 0.0001); 

/*UDMI*/

C_UDMI(cell, mix_thread,1) = drag;           /*interaction air-water*/

return drag;
//#endif 

==============================================================================

The fl process could not be started.