Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

    • ll00023
      Subscriber

      I 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;
       
      }

    • Rob
      Forum Moderator

      I 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. 

    • ll00023
      Subscriber

      if 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. 

    • Rob
      Forum Moderator

      Good, 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. 

    • ll00023
      Subscriber

      P_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.

    • 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.
    • ll00023
      Subscriber

      is C_D or C_K obtained from LES case? 

    • ll00023
      Subscriber

      C_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?

    • Rob
      Forum Moderator

      Turbulent 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. 

    • ll00023
      Subscriber

      Thank you for the explanation, Rob. I made a mistake about formula sqrt (C_MU_T(c, t))/ C_STRAIN_RATE_MAG, which should be 1/ C_STRAIN_RATE_MAG  since the mu cancelled by using and . now the result looks reasonable to me for 25 micron particle, which the Stokes number should be lower than 1.

Viewing 9 reply threads
  • The topic ‘UDF crash’ is closed to new replies.