Fluids

Fluids

UDF for DPM-BC particle steady-unsteady tracking

    • dk89
      Subscriber

      Hi all,

      I have created the following UDF as a DPM-BC on the blade for a compressor rotor domain. The aim of the UDF is to record some particle variables when the particles hit the blade. The if, else if conditions specify the spanwise positions of the particle impact (0%, 20% etc). So, when the particle hits the blade, its trajectory will be terminated (PATH ABORT). All particle impact variables are recorded in the text file 'DepositionOntheblade'.

      This UDF works well for particle steady tracking. However, there is something wrong for unsteady tracking. Specifically for unsteady tracking the number of particle impacts is always higher than the injected particles (around 3 times). I have ensured that the number of particles in the parcel is one. Moreover, I think that the setup of my simulation is correct. I ran the simulation with a trap DPM (instead of the UDF) on the blade and the result was reasonable. Thus, I believe that the problem is on the UDF.

      Should I modify my UDF to run it with unsteady tracking? Do you have any suggesitons on that? Thank you for your time.

      DEFINE_DPM_BC(SumanEtalTrapModel, p, t, f, f_normal, dim)

      {


      FILE *data;

      int i;

      int span;

      float rad;

      float ap;

      float vol;

      float mp;

      float alpha;

      float vmag;

      real normal[3];


      FILE* fp;

      Thread* tcell = P_CELL_THREAD(p);

      cell_t c = P_CELL(p);

      Domain* d;



      if (p->type == DPM_TYPE_INERT)

      {

      alpha = M_PI / 2. - acos(MAX(-1., MIN(1., NV_DOT(f_normal, P_VEL(p)) / MAX(NV_MAG(P_VEL(p)), DPM_SMALL))));

      vmag = sqrt(pow(P_VEL(p)[0], 2) + pow(P_VEL(p)[1], 2)+ pow(P_VEL(p)[2], 2));


      if ((P_POS(p)[0]>=0.176665146 && P_POS(p)[0]<=0.186795016) && (P_POS(p)[1]>=-0.0210187427 && P_POS(p)[1] <=0.0144877797) && (P_POS(p)[2]>=0.00023646355 && P_POS(p)[2]<=0.0430445385))


      {

      span=0;

      fp=fopen("DepositionOntheblade.txt","a");

      fprintf(fp,"%d %f %f %f %f %f %f %f %f ", span, alpha, P_POS(p)[0], P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],vmag);

      fclose(fp);

      return PATH_ABORT;

      }

      else if((P_POS(p)[0]>=0.191616452 && P_POS(p)[0]<=0.198106401) && (P_POS(p)[1]>=-0.0216748797 && P_POS(p) [1]<=0.0170190389) && (P_POS(p)[2]>=0.00089093758 && P_POS(p)[2]<=0.0413243457))

      {

      span=20;

      fp=fopen("DepositionOntheblade.txt","a");

      fprintf(fp,"%d %f %f %f %f %f %f %f %f ", span, alpha, P_POS(p)[0], P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],vmag);

      fclose(fp);

      return PATH_ABORT;

      }

      else if((P_POS(p)[0]>=0.2065327 && P_POS(p)[0]<=0.209707843) && (P_POS(p)[1]>=-0.0224789778 && P_POS(p)[1]<=0.0190786038) && (P_POS(p)[2]>=-0.00177163905 && P_POS(p)[2]<=0.0395848001))

      {

      span=40;

      fp=fopen("DepositionOntheblade.txt","a");

      fprintf(fp,"%d %f %f %f %f %f %f %f %f ", span, alpha, P_POS(p)[0], P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],vmag);

      fclose(fp);

      return PATH_ABORT;

      }

      else if((P_POS(p)[0]>=0.220793618 && P_POS(p)[0]<=0.222460753) && (P_POS(p)[1]>=-0.0233967754 && P_POS(p)[1]<=0.0207071351) && (P_POS(p)[2]>=0.0028857503 && P_POS(p)[2]<=0.0378233108))

      {

      span=60

      fp=fopen("DepositionOntheblade.txt","a");

      fprintf(fp,"%d %f %f %f %f %f %f %f %f ", span, alpha, P_POS(p)[0], P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],vmag);

      fclose(fp);

      return PATH_ABORT;

      }

      else if((P_POS(p)[0]>=0.232182063 && P_POS(p)[0]<=0.236409901) && (P_POS(p)[1]>=-0.0243090873 && P_POS(p)[1]<=0.0221135229) && (P_POS(p)[2]>=0.00431068635 && P_POS(p)[2]<=0.0360408684))

      {

      span=80;

      fp=fopen("DepositionOntheblade.txt","a");

      fprintf(fp,"%d %f %f %f %f %f %f %f %f ", span, alpha, P_POS(p)[0], P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],vmag);

      fclose(fp);

      return PATH_ABORT;

      }

      else if((P_POS(p)[0]>=0.243562539 && P_POS(p)[0]<=0.25109266) && (P_POS(p)[1]>=-0.0251354541 && P_POS(p)[1]<=0.0234104503) && (P_POS(p)[2]>=0.00634454636 && P_POS(p)[2]<=0.0341620966))

      {

      span=100;

      fp=fopen("DepositionOntheblade.txt","a");

      fprintf(fp,"%d %f %f %f %f %f %f %f %f ", span, alpha, P_POS(p)[0], P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],vmag);

      fclose(fp);

      return PATH_ABORT;

      }

      }


      }

    • Surya Deb
      Ansys Employee
      Hello,
      Can you please check the particle tracks for the transient case?
      Also create a plane in front of the blade and sample the particles crossing it if possible.
      Regards SD
    • mashimaro_star
      Subscriber
      Have this been solved? I am having the same issue. When we use steady particle tracking our DPM_BC udf is running properly to output particle info. Once we select unsteady particle tracking, it seems that DPM_BC was not running, but there are particles touching the wall BC. Thank you
Viewing 2 reply threads
  • You must be logged in to reply to this topic.