TAGGED: dpm, les, particle-tracking, udf
-
-
November 22, 2023 at 10:23 am
ll00023
SubscriberI tried to calculate the stockes number for a specific group of particles. here is the code.
This udf has been hooked up in DPM model and the number of scalar is set to 1.
the code has no compiling issue in this LES case. the case runs on HPC with 128 cores. memory info is listed below.
Â
but when the calculation started, then it crashed.
Â
#include "udf.h"#include "dpm.h"ÂDEFINE_DPM_SCALAR_UPDATE(StokesNumber,c,t,init,p){  cphase_state_t *cp;  cp = p->cphase;  /* cphase_state_t *c = &(p->cphase); */  real tau_p = 0;  real drag_factor;  real tau_f = 1e-16;  real C_mu = 0.09;  real l_int, u_f;  /* Compute particle relaxation time */  if (P_DIAM(p) != 0.0)  {tau_p = P_RHO(p)*pow(P_DIAM(p), 2.0)/C_MU_L(TP_CELL(p), TP_CELL_THREAD(p));drag_factor = DragCoeff(p); /* returns 18*Cd*Rep/24 ? Please check */tau_p /= drag_factor;  }  else  {tau_p = 0.;  }  /* Compute the fluid time scale    (based on integral length scale) */  if (C_D(TP_CELL(p), TP_CELL_THREAD(p)) > 0)  {    l_int = C_mu*pow(C_K(TP_CELL(p), TP_CELL_THREAD(p)), 1.5)/C_D(TP_CELL(p), TP_CELL_THREAD(p));  }  else  {l_int = 1.;  }  Â  /* Velocity magnitude*/  u_f = sqrt(pow(cp->V[0], 2.0) + pow(cp->V[1], 2.0) + pow(cp->V[2], 2.0));  if (u_f > 1e-12)  {tau_f = l_int/u_f;  }   else  {tau_f = 1.;  }  /* Stokes Number */  P_USER_REAL(p,0) = tau_p / tau_f;Â} -
November 22, 2023 at 12:44 pm
Rob
Forum ModeratorI can only point you at https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v232/en/flu_udf/flu_udf_DPMDEFINE.html%23flu_udf_sec_define_dpm_scalar_update Â
Simplify the code to start with just setting a single value for the scalar, if that works start turning on more of the maths until it breaks. Then review what causes the problem.Â
-
November 23, 2023 at 1:55 am
ll00023
Subscriberif I get rid of all other info and just give a stokes number a value. it can run. I will keet testing and update it here.
Thank you Rob.Â
-
November 23, 2023 at 11:36 am
Rob
Forum ModeratorGood, so the scalar part is OK. Now see if you can pass P_DIAM(p)Â or similar to the scalar. If that works, pass cell velocity.Â
-
November 25, 2023 at 1:09 am
ll00023
SubscriberP_USER_REAL(p,0) = cp->V[1]; is used to export y velocity of particle. no issue.
P_USER_REAL(p,0) = P_DIAM(p), no issue.
-
November 25, 2023 at 6:13 am
ll00023
Subscriber  if (C_D(TP_CELL(p), TP_CELL_THREAD(p)) > 0)  {    l_int = C_mu*pow(C_K(TP_CELL(p), TP_CELL_THREAD(p)), 1.5)/C_D(TP_CELL(p), TP_CELL_THREAD(p));  }  else  {l_int = 1.;  }when testing this code, it crashed FLUENT. -
November 25, 2023 at 8:19 am
ll00023
Subscriberis C_D or C_K obtained from LES case?Â
-
November 25, 2023 at 8:06 pm
ll00023
SubscriberC_D dissipation rate is not available for LES case. So I calculated the dissipation rate with sqrt (C_MU_T(c, t))/ C_STRAIN_RATE_MAG.
what's the difference of C_MU_T and C_MU_L in LES case?
When I calculated particle relaxation time, should I use Laminar viscosity?
-
November 28, 2023 at 1:54 pm
Rob
Forum ModeratorTurbulent viscosity will take the turbulence into account, so it's probably what you want in the UDF: to an extent that's for you to decide based on your model requirements.Â
-
November 28, 2023 at 11:15 pm
ll00023
Subscriber
-
- The topic ‘UDF crash’ is closed to new replies.
-
3074
-
977
-
906
-
858
-
792
© 2025 Copyright ANSYS, Inc. All rights reserved.