CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Dpm and udf (

cinmar March 30, 2009 08:18

Dpm and udf
Hi Guys,

sorry to bother you again. Somebody can give me some indication on writing an UDF in which if a particle overcame a certain y-coordinate it has to be considered escaped? Any help is welcome.



HenrikS March 31, 2009 10:40

I suggest using DEFINE_EXECUTE_AT_END. It will be run once at the end of each time step (or once at the end of each iteration if in steady state mode). Let it loop over all particles in the domain and remove particles whose Y-position is larger than a specified threshold. You can save any particle properties you wish for postprocessing by writing them to a text file, for example.


cinmar March 31, 2009 10:46

Thanks a lot!!
I will try that.


Allan Walsh April 2, 2009 13:07

What is the issue? Determing the variable for y-position? Changing the particle fate to escaped?

cinmar April 2, 2009 13:17

Hi Allan,
Thanks a lot for answering.

I am not interested in the position of the particles but I would like to change their fate in ESCAPED. I have tried with sample and DEFINE_DPM_OUTPUT. When the particles reach a certain interface they should escape. My UDF doesn't work, and I do not know if it is because I am running in parallel.
My udf is simple this (actually I really do not know how to program it).

#include "udf.h"

DEFINE_DPM_OUTPUT(discrete_phase_sample,header,fp, p,t,plane)
#define alfa TRUE

#if alfa /*This if loop removes the particles*/




Allan Walsh April 3, 2009 17:23

How do you mean your UDF doesn't work? It compiles but doesn't do what you would like it to? Can you compile the UDF example DEFINE_DPM_OUTPUT? There are certain memory options to check for particles in parallel mode which you have probably looked at.

Another option in FLUENT UDFs to set a particle to escape is after a certain condition is reached then:
return PATH_END
and increment the variable p->gvtp.n_escaped.

benmahmud May 4, 2009 08:34

Checking UDF
1 Attachment(s)
Hi guys,

I have a problem with UDF isn't working it gives an error, can someone check it and will high appreciated



All times are GMT -4. The time now is 13:32.