-
-
October 5, 2023 at 2:39 am
ariyan zare
SubscriberHi
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"DEFINE_EXCHANGE_PROPERTY(DRAG,c,mix_thread,s_col,f _col)
{
Thread *gas, *liq;
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) */
gas=THREAD_SUB_THREAD(mix_thread,s_col);
liq=THREAD_SUB_THREAD(mix_thread,f_col);/* 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;
} -
October 5, 2023 at 9:23 am
Rob
Forum ModeratorThe 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.
-
October 6, 2023 at 4:35 am
ariyan zare
SubscriberHi Rob
Thank you fo your kind reply
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 */
if (mix_thread == 2)
drag_f=121564*mu_g/void_g+11*rho_g*abs_u;
else if (mix_thread == 4)
/* Zone_ID=4 */
drag_f=141266*mu_g/void_g+21*rho_g*abs_u;
else if (mix_thread == 6)
/* Zone_ID=6 */
drag_f=181786*mu_g/void_g+11*rho_g*abs_u;
else if (mix_thread == 7)
/* Zone_ID=7 */
drag_f=201454*mu_g/void_g+51*rho_g*abs_u; -
October 6, 2023 at 3:13 pm
Rob
Forum ModeratorTry it, I'm not sure if you need c or mix_thread in this case.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- legend min and max
- Ensight hot iron palette from an image
- Streamlines in EnSight using MRI data
- Import MRI data into Ensight
- FLUENT APPLICATIION ERROR
- Total Surface Heat Flux Calculation in Fluent
- Drop Test of a Water-Filled Tube
- Difference between “total pressure” and “absolute pressure”?
- Minimum Orthogonal Quality Less than 0.01 For Transonic Airfoil Flow Analysis
- obtaining pressure distribution by making points in ansys
-
8808
-
4658
-
3153
-
1688
-
1478
© 2023 Copyright ANSYS, Inc. All rights reserved.