CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Using DPM_Output and DPM_Scalar together?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 16, 2019, 10:19
Default Using DPM_Output and DPM_Scalar together?
  #1
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
Hi All,

I have a DPM UDF using DEFINE_DPM_OUTPUT which prints the positions and velocities of particles. If I hook this to the interior of my fluid domain (Sample trajectories), it reports this for all the particles, at every time step.

Now I have this UDF working, I would like to refine it, so that it only outputs the positions and velocities of particles that have a certain position and velocity within the domain. I had done this previously with DEFINE_SCALAR_UPDATE, but was unable to get it to print the location/velocities of the particles, it only removed them in a certain area.

Simply put, I need to refine my working UDF to only act on particles with certain positions/velocities.

My working UDF to print their locations within my domain is:

/*** 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(discrete_phase_sample,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
}

My idea is to use something like this

DEFINE_DPM_SCALAR_UPDATE(adhesion,cell,thread,init ialize,p)
{
real rad_pos;
rad_pos=sqrt(P_POS(p)[1]*P_POS(p)[1]+P_POS(p)[2]*P_POS(p)[2]);
if (rad_pos>0.001)
{
execute the above UDF
}
}

If I add an if statement to my working UDF I just get SIGSEV errors whcih I dont understand so I'm trying to do it other ways.
bloodflow is offline   Reply With Quote

Reply

Tags
dpm, udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 08:11.