CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Can I get x,y,z coordinates of a particle in lagrangian simulation (https://www.cfd-online.com/Forums/fluent-udf/96719-can-i-get-x-y-z-coordinates-particle-lagrangian-simulation.html)

mali28 January 30, 2012 13:16

Can I get x,y,z coordinates of a particle in lagrangian simulation
 
Hi,

Can I get x, y, z coordinates of particles moving in a fluid. The particles are tracked using lagrangian approach.

Thank you.

Amir January 30, 2012 14:11

Hi,

try this:
report-> discrete phase-> sample
select default-interior in boundaries panel and desired injections from injection pane then open the created file with a text editor which has "dpm" extension.

Bests,

mali28 January 30, 2012 14:51

Quote:

Originally Posted by Amir (Post 341981)
Hi,

try this:
report-> discrete phase-> sample
select default-interior in boundaries panel and desired injections from injection pane then open the created file with a text editor which has "dpm" extension.

Bests,

Thanks, but I need it inside UDF because I want to apply modified drag coefficient due to close packing of the particles. For that I will need to know at any instant what the coordinates of a particles are and its nearby particles. If the distance between two adjacent particles is less than twice of diameter then modified drag coeff. will hold, other wise the one used by Fluent will be applied.

Any thoughts?

Amir January 31, 2012 03:28

Quote:

Originally Posted by mali28 (Post 341988)
Thanks, but I need it inside UDF because I want to apply modified drag coefficient due to close packing of the particles. For that I will need to know at any instant what the coordinates of a particles are and its nearby particles. If the distance between two adjacent particles is less than twice of diameter then modified drag coeff. will hold, other wise the one used by Fluent will be applied.

Any thoughts?

Ok, your goal needs few settings; first of all, you can use P_POS(p) in a UDF in order to access the particle coordinates, but I think that because of using less memory each particle ise solved from the start to the end of its trajectory and then switches to another particle (check it); so if you want to have particle interactions you have to use a journal file in this manner:
  • compute the all of particle trajectories for one (and equal) time step. (you may want to write additional UDf to adjust the time step)
  • correct drag coefficients and other modifications
  • compute for the next time step

Bests,

laurentb January 31, 2012 03:47

Hi,

This is an udf example which save in a file particle data (id, position, velocity and velocity derivatives). It may be useful :

# include "udf.h"

FILE *fp;

DEFINE_ON_DEMAND(open_file)
{
fp=fopen("data.txt","a");
}

DEFINE_DPM_SCALAR_UPDATE(trajectory,cell,thread,in itialize,p)
{
// COMPILED MODE ONLY
fprintf(fp,"%d %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g \n",p->part_id,p->state.pos[0],p->state.pos[1],p->state.pos[2],p->state.V[0],p->state.V[1],p->state.V[2],p->state.time,C_DUDX(cell, thread), C_DUDY(cell, thread), C_DUDZ(cell, thread), C_DVDX(cell, thread), C_DVDY(cell, thread), C_DVDZ(cell, thread), C_DWDX(cell, thread), C_DWDY(cell, thread), C_DWDZ(cell, thread));
}

DEFINE_ON_DEMAND(close_file)
{
fclose(fp);
}

Mr. CFD April 5, 2012 18:00

Modifying Cd by particle spacing
 
@mali28

Quote:

Originally Posted by mali28 (Post 341988)
Thanks, but I need it inside UDF because I want to apply modified drag coefficient due to close packing of the particles. For that I will need to know at any instant what the coordinates of a particles are and its nearby particles. If the distance between two adjacent particles is less than twice of diameter then modified drag coeff. will hold, other wise the one used by Fluent will be applied.

Any thoughts?


Hi mali28, I am currently trying to do the same thing. What exactly are/were you simulating? Since it looks like you solved your problem, would you be kind enough to tell me just how you did it?

Thanks!


All times are GMT -4. The time now is 02:20.