|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Ravi
Join Date: May 2017
Posts: 32
Rep Power: 9 ![]() |
Dear All,
I am simulating the flow through a bubbling fluidized bed, where different nozzles are placed at various locations in the bed region. I modified the Gobin drag model to include both the Wen-Yu and Ergun modes of operation. I get a floating point exception error everytime I run it. The code is as follows: // Header files #include "udf.h" #define pi 4.*atan(1.) #define part_dia 3.e-4 #define spher 0.9 // Macros definition: Exchange Property DEFINE_EXCHANGE_PROPERTY(custom_drag, cell, mix_thread, s_col, f_col) { Thread* thread_g, * thread_s; // Define pointers for gas (primary) and solid (secondary) phases in the mixture /* Defining properties */ real x_vel_g, x_vel_s, y_vel_g, y_vel_s, z_vel_g, z_vel_s, abs_v, slip_x, slip_y, slip_z, rho_g, rho_s, mu_g, Re_p, afac, bfac, void_g, void_p, vfac, fdrgs_WY, fdrgs_Erg, fdrgs_Gobin, tau_p, k_g_s_WY, k_g_s_Erg, k_g_s_Gobin; /* find the threads for the gas (primary) */ /* and solids (secondary phases) */ thread_g = THREAD_SUB_THREAD(mix_thread, s_col);/* gas phase */ thread_s = THREAD_SUB_THREAD(mix_thread, f_col);/* solid phase*/ /* 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_s = C_U(cell, thread_s); y_vel_s = C_V(cell, thread_s); z_vel_s = C_W(cell, thread_s); slip_x = x_vel_g - x_vel_s; slip_y = y_vel_g - y_vel_s; slip_z = z_vel_g - z_vel_s; rho_g = C_R(cell, thread_g); rho_s = C_R(cell, thread_s); mu_g = C_MU_L(cell, thread_g); /*compute slip velocity */ abs_v = sqrt(slip_x * slip_x + slip_y * slip_y + slip_z * slip_z); /*compute Reynolds number */ Re_p = rho_g * abs_v * part_dia / mu_g; /* compute particle relaxation time */ tau_p = rho_s * part_dia * part_dia / 18. / mu_g; void_g = C_VOF(cell, thread_g);/* gas vol frac*/ void_p = C_VOF(cell, thread_s);/* particle vol frac*/ /*compute drag and return Gobin drag coeff, k_g_s*/ /* Wen - Yu drag model */ afac = 1 - void_p; if (Re_p < 1000) fdrgs_WY = (24 / Re_p) * (1 + (0.15 * pow(Re_p, 0.687))) * pow(void_g,-1.7); else fdrgs_WY = 0.44 * pow(void_g, -1.7); // k_g_s_WY = (3 / 4) * fdrgs_WY * ((afac * void_p * rho_g * abs_v) / spher * part_dia) * pow(afac, -2.65); /* Ergun drag model */ fdrgs_Erg = (200 * (1 - void_g)/Re_p) + (7/3); //k_g_s_Erg = (150 * (pow(1 - void_g, 2) * mu_g) / (void_g * pow(part_dia * spher, 2))) + ((1.75 * (1 - void_g) * rho_g * abs_v) / (part_dia * spher)); /* Gobin drag model */ if (void_g >= 0.7) fdrgs_Gobin = fdrgs_WY; //k_g_s_Gobin = k_g_s_WY; else fdrgs_Gobin = fmin(fdrgs_WY, fdrgs_Erg); //k_g_s_Gobin = fmin(k_g_s_WY, k_g_s_Erg); return fdrgs_WY; //return fdrgs_Erg; //return fdrgs_Gobin; } I have commented out the Gobin drag law to test whether the individual existing models, i.e., Wen-Yu and Ergun modes, work properly or not. However, I see that the floating point error still persists. I have also run the UDF on simpler geometries (cylindrical, as an example), but I still get the same error. I have tried both compiling and interpreting the code. While the compiler does not show any issues, the interpreter mentions that there is an issue with the usage of the fmin function. I would like to obtain inputs from you about how to go about this issue. |
|
![]() |
![]() |
![]() |
Tags |
drag modification, fluent - udf, fluidized bed |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
RANS shape optimization all gradients are zero | cfd-jg | SU2 Shape Design | 0 | April 24, 2024 09:52 |
EMMS drag model UDF | NAD | Fluent UDF and Scheme Programming | 26 | November 19, 2017 07:49 |
udf for drag models in fluent | mohsen0488 | Fluent UDF and Scheme Programming | 0 | September 24, 2013 11:12 |
UDF for drag law - Eulerian Model | fevi84 | Fluent UDF and Scheme Programming | 0 | July 16, 2012 13:41 |
Low Reynolds Number Drag Law - UDF | Daggemann | FLUENT | 0 | April 30, 2009 05:02 |