|
[Sponsors] |
February 7, 2020, 12:31 |
question on udf
|
#1 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 6 |
Hello
I am using a udf for drag model in multiphase flow. My system has a primary phase and a secondary phase. I read the fluent user's manual and found the drag model udf code. I read the description of the codes and found that the primary and secondary phases should be mentioned using indexes as 0 for primary and unit increments for each secondary phase. Details in the link (https://www.afs.enea.it/project/nept...udf/node61.htm). A part of the code reads as below. DEFINE_EXCHANGE_PROPERTY(custom_drag,cell,mix_thre ad,s_col,f_col) { Thread *thread_g, *thread_s; real x_vel_g, x_vel_s, y_vel_g, y_vel_s, abs_v, slip_x, slip_y, rho_g, rho_s, mu_g, reyp, afac, bfac, void_g, vfac, fdrgs, taup, k_g_s; /* 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*/ I don't see the index used anywhere. My question is, how does it distinguish the phases? thank you |
|
February 9, 2020, 15:39 |
Fluent provides that
|
#2 |
Senior Member
|
As soon as you choose from and to phase within the drag or any other interface exchange term, Fluent provides those values to the UDF via last two arguments of the DEFINE_ function, i.e., f_col and s_col in your code.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 10, 2020, 11:09 |
|
#3 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 6 |
Hello
Sorry I couldn't answer the phrasing, "from and to phase"? Could you please elaborate? |
|
February 10, 2020, 12:51 |
From and To
|
#4 |
Senior Member
|
From and To refer to the phases in the first and second column in the mass transfer mechanism.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 10, 2020, 18:05 |
|
#5 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 6 |
Hello vinerm
I have not included mass transfer. It is a bubble column in which I have just included drag, lift, and turbulence interaction. Quoting your previous sentence: 'As soon as you choose from and to phase within the drag or any other interface exchange term'... Is it possible to choose from and to phase while declaring drag? Apologies!!! if I have understood the sentence incorrectly. Kindly help. And the below is a part of the code that I have found. DEFINE_EXCHANGE_PROPERTY(drag_coefficient, cell, mix_thread, s_col, f_col) { Thread* thread_f, * thread_g; real x_vel_f, x_vel_g, y_vel_f, y_vel_g, z_vel_f, z_vel_g; real rho_f, diam, ci_K, fi_n, fac; real slip_x, slip_y, slip_z, abs_v; real reyp, c_D; thread_f = THREAD_SUB_THREAD(mix_thread, s_col); /* liquid phase */ thread_g = THREAD_SUB_THREAD(mix_thread, f_col); /* gas phase*/ Do the last two lines thread_f and thread_g assign the values to liquid phase (primary phase) and gas phase (secondary) respectively? How do we know out of the two thread_f and thread_g which one refers to gas and liquid phase? |
|
February 11, 2020, 03:55 |
Columns
|
#6 |
Senior Member
|
For a few things, the order in Fluent is important. This is true for interphase exchange terms as well. Whether it is mass transfer or drag, phase shown in the first column is reported by Fluent as last argument and phase in the second column as second last argument. For the drag, you cannot choose; choice is only for mass transfer mechanisms or may be for a few others.
The last two terms in the code are not applying anything; those are used to fetch the threads belonging to primary and secondary phases. These can be used by the user to carry out some operation. Whichever phase is in the first column in the drag dialogue box in the case is referred to by s_col in your code.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 11, 2020, 16:24 |
|
#7 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 6 |
Hello vinerm
Under drag force window, gas phase is in column one and liquid phase is in column two. My udf is shown below. So in the below code, thread_f should be used to calculate diameter of the air bubble instead of thread_g (shown in bold letters). So based on this what I understand is that I have used the formula for gas phase in place of liquid phase. Kindly correct me if I have got it wrong. #include "udf.h" /*#define pi 4.*atan(1.)*/ DEFINE_EXCHANGE_PROPERTY(drag_coefficient, cell, mix_thread, s_col, f_col) { Thread* thread_f, * thread_g; real x_vel_f, x_vel_g, y_vel_f, y_vel_g, z_vel_f, z_vel_g; real rho_f, diam, ci_K, fi_n, fac; real slip_x, slip_y, slip_z, abs_v; real reyp, c_D; thread_f = THREAD_SUB_THREAD(mix_thread, s_col); /* liquid phase */ thread_g = THREAD_SUB_THREAD(mix_thread, f_col); /* gas phase*/ x_vel_f = C_U(cell, thread_f); y_vel_f = C_V(cell, thread_f); z_vel_f = C_W(cell, thread_f); x_vel_g = C_U(cell, thread_g); y_vel_g = C_V(cell, thread_g); z_vel_g = C_W(cell, thread_g); slip_x = x_vel_g - x_vel_f; slip_y = y_vel_g - y_vel_f; slip_z = z_vel_g - z_vel_f; diam = C_PHASE_DIAMETER(cell, thread_g); rho_f = C_R(cell, thread_f); ci_K = 0.32; fi_n = 0.68; abs_v = sqrt(slip_x * slip_x + slip_y * slip_y + slip_z * slip_z); fac = 2 - fi_n; reyp = rho_f * pow(abs_v, fac) * pow(diam, fi_n) / (ci_K); if (reyp < 135) c_D = ((16 / reyp) * (1 + (0.173 * pow(reyp, 0.657)))) + (0.413 / (1 + (16300 * pow(reyp, -1.09)))); else c_D = 0.95; return c_D; } |
|
February 11, 2020, 16:40 |
Your UDF is correct
|
#8 |
Senior Member
|
The way it is being done in the UDF is correct. The last argument refers to first column, i.e., f_col corresponds to gas for your case. thread_g is also for f_col. So, your bubble diameter calculation is correct.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 11, 2020, 16:57 |
|
#9 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 6 |
Quoting your earlier response, "Whichever phase is in the first column in the drag dialogue box in the case is referred to by s_col in your code."
Does this not mean that gas phase is s_col in my case? Please correct me if I am wrong. |
|
February 12, 2020, 03:07 |
Apologies
|
#10 |
Senior Member
|
Sorry, it is the other way around. Second column is being referred to by s_col and first column by f_col. In other words, whichever phase is selected in the first column is reported by Fluent as its last argument in the macro.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 12, 2020, 12:49 |
|
#11 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 6 |
Thank you vinerm. I will work on this.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A general question on using UDF for defining reaction kinetics | Morijef | Fluent UDF and Scheme Programming | 0 | September 19, 2018 15:37 |
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF | acasas | CFD Freelancers | 1 | January 23, 2015 07:26 |
Yet another UDF question. | Bee | FLUENT | 0 | October 9, 2006 03:46 |
Basic question: UDF for wall heat flux | Carl | FLUENT | 1 | August 5, 2006 19:01 |
UDF question | Meghesh | FLUENT | 1 | November 2, 2004 08:24 |