CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Move particle in UDF (

Henrik July 28, 2008 11:00

Move particle in UDF
Hello everybody,

I have a small (?) problem:

I want to move DPM particles from certain regions of my domain to another part on some occasions. I try to write a UDF that manipulates P_POS(p). This seems to work well when I output particle position to the console or display particle tracks.

However, if I loop over my particles at the end of each timestep, their position is returned as something else (i.e. continuing from where they were before I moved them). There seems to be some confusion about where the particles really are. This also leads to difficulties with boundary conditions etc.

What I need to know is thus this: How do I change the particle position for real? Is there some storage macro that I can use? I can see there are things like P_STORAGE and SV_P defined in dpm.h but I really don't know how to use them right now.

Thanks for any input, Henrik

fluent_urs July 28, 2008 15:35

Re: Move particle in UDF
Henrik, use P_USER_REAL() hopefully, it will work.

Henrik July 29, 2008 03:28

Re: Move particle in UDF
Thank you very much for your fast reply!

However, I am not fully sure of how I could use P_USER_REAL? As far as I can see, that macro is used for the scalars associated with each computational parcel? So, how does that relate to the current particle position?

Thank you very much in advance, Henrik

fluent_urs July 29, 2008 04:15

Re: Move particle in UDF
In my opinion, you can store the intermediate values, position, in your case and then use the values stored in the P_USER_REAl to tetrieve later for updating. Its just like using an array. I am not usre if this can work, but you can make a short UDF with this and try.

Henrik July 29, 2008 04:28

Re: Move particle in UDF
Thank you again!

The problem seems to be that it does not matter when or where I change P_POS(p)... At the end of each time step, when particle positions are updated, they are advanced from their old positions anyhow. Meanwhile, the P_POS(p) macro continues to return the new positions. Very confusing.


fluent_urs July 29, 2008 10:55

Re: Move particle in UDF
can u do anything in the loop ? the particle positions are updated by the P_POS macro. but if you are looping in the same old cell, it will start all over again definitely, from the old place. thats true.. can you not do anything in the looping structure ? my initial idea of P_USER_REAL is not right, as this is a different problem. if i get any idea, i will surely get back.

All times are GMT -4. The time now is 18:57.