 ## Fluids

Topics relate to Fluent, CFX, Turbogrid and more

• ariyan zare
Subscriber

Hi

I have developed a simple Drag force model code. my computational domain includes 4 different zones. the drag coefficient formulation is the same for all zones, except the constants will change. To specify which formulation applies to each zone, I plan to utilize conditional statements with the "IF" condition based on the zone_ID. could you please help me on how and where I should consider "IF" statement and which macro should be used?

#include "udf.h"

{
real r_vel_g,z_vel_g,r_vel_l,z_vel_l,abs_u,slip_r,slip_ z,rho_g,void_g,mu_g,drag_f;

/* find the threads for the gas(primary) */
/* find the threads for the liquid(secondary) */

/* find phase velocity and properties */
r_vel_g=C_U(c,gas);
z_vel_g=C_V(c,gas);
r_vel_l=C_U(c,liq);
z_vel_l=C_V(c,liq);
slip_r=r_vel_g-r_vel_l;
slip_z=z_vel_g-z_vel_l;

/* absolute slip */
abs_u=sqrt(pow(slip_r,2)+pow(slip_z,2));

/* properties */
rho_g=C_R(c,gas);
mu_g=C_MU_L(c,gas);
void_g=C_VOF(c,gas);

/* drag calculation */

/* Zone_ID=1 */
drag_f=121564*mu_g/void_g+11*rho_g*abs_u;

/* Zone_ID=2 */
drag_f=141266*mu_g/void_g+21*rho_g*abs_u;

/* Zone_ID=3 */
drag_f=181786*mu_g/void_g+11*rho_g*abs_u;

/* Zone_ID=4 */
drag_f=201454*mu_g/void_g+51*rho_g*abs_u;

return drag_f;
}

• Rob
Forum Moderator

The problem you face it tagging the cell to the cell zone - that's doable, but may not be easy.

Why is drag different between zones, and how many coefficients do you need?

Note, I can give some pointers but need to tread carefully around the "expert knowledge" rules staff work to.

• ariyan zare
Subscriber

Hi Rob

drag coefficient is different between zone because of porous matrix and celar fluid domains. As both permeability and porosity can affect the gas-liquid interaction formulation I need to define different fomrulation for different zones. consider the following equation from the aforementioned code:

drag_f=121564*mu_g/void_g+11*rho_g*abs_u;

I want to keep the same drag coefficient fommulation while adjusting the constants 121564 and 11 for four different zones (zone_ID=2,4,6,7).

Can I use the following code?

/* Zone_ID=2 */
drag_f=121564*mu_g/void_g+11*rho_g*abs_u;

/* Zone_ID=4 */
drag_f=141266*mu_g/void_g+21*rho_g*abs_u;

/* Zone_ID=6 */
drag_f=181786*mu_g/void_g+11*rho_g*abs_u;

• Rob 