Fluent DPM UDF: How to refine DPM_OUTPUT?

Hi All.

My goal is to remove a particle from the domain once it has reached a certain position and a certain velocity, and store the position of the particle when it is removed. I have written a UDF that prints the positions/velocities of all the particles in my domain, but I need to refine this to only remove particles which meet certain criteria. I was previously trying this with DPM_SCALAR_UPDATE but couldn't find a way to save the positions of the particles it was removing. Does anyone have any suggestions? My UDF (which I compile) is below.

 

Comments

  • BeginerModelBeginerModel Member
    edited April 2019

    UDF:

    *** DPM UDF to write particle positions to file (Apply to interior Blood) ******/
    #include "udf.h"
    #include "dpm.h"
    #include "math.h"
    #define REMOVE_PARTICLES TRUE
    DEFINE_DPM_OUTPUT(particle-info,header,fp, p,t,plane)
    {
    if(header)
    {
    par_fprintf_head(fp,"X-Position Y-Position Z-Position X-Velocity Y-Velocity Z-Velocity Time \n ");
    }
    if(NULLP(p))
    return;
    par_fprintf(fp,"%d %" int64_fmt " %e %e %e %e %e %e %e \n",
    P_INJ_ID(P_INJECTION(p)),p->part_id,P_POS(p)[0],P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],P_TIME(p));
    #if REMOVE_PARTICLES
    MARK_PARTICLE(p, P_FL_REMOVED);
    #endif
    }

  • DrAmineDrAmine GermanyForum Coordinator
    edited April 2019

    Both approaches would work for removing particles. You can even use for the interior plane a proous jump condition with very very high permeability trap the particles and sample them there without using any UDF.

  • anshsanshs Member
    edited December 2019

    Hello, I'm also writing code for DPM particles. May I know, how were you able to understand and write the above code? Any reference material?

    Thank you.

  • DrAmineDrAmine GermanyForum Coordinator
    edited December 2019
    Check the FLUENT customization manual
Sign In or Register to comment.