TAGGED: #fluent-#ansys, bubble-diamter, udf
-
-
March 14, 2025 at 3:15 pm
h.a.maldonadodeleon
SubscriberHi all,
I'm trying to set a UDF to set the bubble diameter for an Eulerian simulation while simulating the turbulence under the Dispersed model (as the density ratio is way beyond 1). While a similar UDF works perfectly for the Mixture model (for turbulence), it does not work with the modifications I've deemed necessary (i.e., pointing to the liquid - primary phase thread using the super_thread macro). Has anyone managed to define a similar UDF successfully? Any input is appreciated as the current formulation results in SIGSEV error.Â
#include "udf.h"
#include "math.h"
DEFINE_PROPERTY(calderbank_db, c, t)
{
/* Accessing the liquid domain */
Thread liq = THREAD_SUPER_THREAD(0); /* Pointing to liquid phase */
/* Define the variables */
real db; /* Bubble diamter placeholder */
/* Get local conditions from the dispersed (gas) phase */
real eps = C_D(c, liq); /* Obtain turbulence dissipation from liquid phase */
real eG = C_VOF(c, t); /* Volume fraction of the gas phase */
/* Liquid properties */
double density_liq = 998.2; /* Density of liquid phase (kg/m³) */
/* Ensure epsilon is positive to avoid division errors */
if (eps <= 0.0)
{
eps = 0.0000000001; /* Small value to prevent singularity */
}
if (eG > 0.3)
{
db = 0.0000001; /* almost zero db */
}
/* Calderbank's model (1958) for pure liquid */
/* db = C1 + C2 * ((surf_tension / rhoL)^0.6 / eps^0.4) * eG^0.5 */
db = 0.0009 + 4.15 * pow(0.072 / density_liq, 0.6) * 1 / (pow(eps, 0.4)) * pow(eG, 0.5);
return db;
} -
March 14, 2025 at 4:29 pm
Rob
Forum ModeratorThe primary phase doesn't have a diameter - that's the second phase(s).Â
-
March 14, 2025 at 9:46 pm
h.a.maldonadodeleon
SubscriberHi Rob,Â
Thanks for your input. However, the model requires as input the turbulent energy dissipation rate (EDR) of the continuous phase (liquid), which is why I need to access that variable from the secondary phase. From what I got when reading the manual, once I hook the UDF to the diameter of the secondary phase (gas), the thread is pointed to the gas phase, and with the super_thread macro I should be able to reach the liquid one. Is this the case?Â
-
March 17, 2025 at 11:13 am
Rob
Forum ModeratorThe turbulence is typically set at the mixture level, unless you've been altering the options in the Viscous panel? Â
-
March 17, 2025 at 11:20 am
h.a.maldonadodeleon
SubscriberÂ
Hi Rob,Â
As you mentioned, I’m making some changes to the viscous settings for the Turbulence Multiphase model (i.e., dispersed) due to the characteristics of my system. For now, the solution I found was the following – which seems to work for now:Â
Â
- Defining the mixture and liquid threads
- Get/Define the respective pointers to those threads
#include “udf.h”#include “math.h”Thread *mix; /* Define the mixture thread */Thread *liq; /* Define the liquid thread */DEFINE_PROPERTY(calderbank_db, c, t){/* Accessing the liquid domain */mix = THREAD_SUPER_THREAD(t); /* Pointing to mixture thread */liq = THREAD_SUB_THREAD(mix, 0); /* Pointing to liquid phase *//* Define the variables */real db; /* Bubble diamter placeholder *//* Get local conditions from the dispersed (gas) phase */real eps = C_D(c, liq); /* Obtain turbulence dissipation from liquid phase */real eG = C_VOF(c, t); /* Volume fraction of the gas phase *//* Liquid properties */double density_liq = 998.2; /* Density of liquid phase (kg/m³) *//* Ensure epsilon is positive to avoid division errors */if (eps <= 0.0){eps = 0.0000000001; /* Small value to prevent singularity */}if (eG > 0.3){db = 0.0000001; /* almost zero db */}/* Calderbank’s model (1958) for pure liquid *//* db = C1 + C2 * ((surf_tension / rhoL)^0.6 / eps^0.4) * eG^0.5 */db = 0.0009 + 4.15 * pow(0.072 / density_liq, 0.6) * 1 / (pow(eps, 0.4)) * pow(eG, 0.5);return db;}Â
Â
Â
-
- You must be logged in to reply to this topic.
-
2918
-
970
-
852
-
599
-
591
© 2025 Copyright ANSYS, Inc. All rights reserved.