CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Problem trapping Particles with UDF (https://www.cfd-online.com/Forums/fluent/49820-problem-trapping-particles-udf.html)

J. Krick November 18, 2008 04:03

Problem trapping Particles with UDF
 
Hallo,

I wrote this UDF:

#include "udf.h"

--------------------------------------------------------------------

/************************************************** ****************/

/* UDF which counts particles that passed through a sampler and */

/* removes them afterwards. */

/************************************************** ****************/

#define REMOVE_PARTICLES TRUE

DEFINE_DPM_OUTPUT(discrete_phase_counter,header,fp ,p,t,plane)

{

if(header)

par_fprintf_head(fp,"Particle ID \n"); /*Writes the string to the head of the file*/

par_fprintf(fp,"%d \n", p->part_id, P_POS(p)[0]);

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

p->stream_index=-1;

#endif

} --------------------------------------------------------------------

If a Particle is sampled it will give the Particle ID and delete this Particle. This works just fine. The Problem is with Fluent.

In Fluent I defined a plane by "Surface -> Plane....". I used the option "Bounded" and set it in such a way, that it will cover the lower half of my qubic domain.

After that, I injected a single Particle in the upper half of my domain. I made such, that the Particle does not hit the plane, but will exit the domain by the outlet. When I displayed the particle's track, I could see that I moves from the inlet directly to the outlet without hitting the plane.

However, when I click on "Report -> Discrete Phase -> Sample..." and select the injection, my plane and the outlet and then click on "Compute", Fluent tells me that the particle was trapped by the plane.

For me I seems as if Fluent does not use the bounded plane which I define, but uses a plane that cuts the whole domain.

Does anyone know a way, how to make Fluent just trap the particles which actually impact on the bounded plane.

Thank you for your attention.

bye,

Julian


KJ Larsen November 18, 2008 12:39

Re: Problem trapping Particles with UDF
 
Hi Julian

One thing I can suggest is that the trajectories of the particle shown in Display -> Particles Tracks and the position data obtained from your code above through Report -> Discrete Phase -> Sample are probably from different particles. (although it looks as though you need a %f in for P_POS(p)[0] to be written to the file). It writes tracking X particles on the console when you Compute the sample implying . If you have turbulent effects possibly the second particle followed a different path and hit the lower plane.

You could add P_POS(p)[1] to show the Y position the particle takes through the plane (I'm assuming Y is up and down with regard to the halves of the domain) and then be sure that the particle is being trapped in the wrong place.

I'm afraid I had a similar problem with sampling (without using a UDF) so your hypothesis seems correct.

It is possible to set walls to trap particles, however then having to set the non-existent wall not to interrupt the continuous phase probably complicates the problem.

Can I ask what you're doing with your output data? I've ended up using excel for now.

As a last resort you could try splitting your mesh down this trapping plane. So simulate the front part of the grid. Then using the data about those particles which were trapped in the top you could set up a UDF injection to simulate the latter part separately.

I hope you get better advice though. Kris

Julian K. November 19, 2008 02:28

Re: Problem trapping Particles with UDF
 
Thank you Kris once again for your help.

I just released a single particle. I'm am very sure, that it did not hit the plane. I also printed the coordinates of the impact point. They did not lie within the plane.

Unfortunately, it is not possible for me to set up new walls, since I am working in the post-processing. I think, in order to get new walls, I would have to go back to Grid Generation and thus redo the simulations. This takes too much time.

Anyway, I think I found a solution. It is rather comlicated though. The basic idea is to let the UDF check whether or not, the particles hits the plane within its boundaries. This is possible since we have the coordinates of the impact point, as well as the coordinates of the plane. Also I am using rectangular planes, which makes live more easy.

If you need some further explanation, please let me know.

After all, I will use Excel for analysis...

Bye,

Julian


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