|
[Sponsors] |
UDF for recycling particles by changing its positions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 9, 2019, 14:30 |
UDF for recycling particles by changing its positions
|
#1 |
New Member
Keishla
Join Date: Jul 2018
Posts: 1
Rep Power: 0 |
Hello!
I'm trying to recycle particles escaped from outlet to inlet. I followed and modified the UDF posted in this thread: Periodic BC in ANSYS DDPM, UDF. In my case, if the particle x-position is greater than 0.20 m and y-position is greater than or equal to -0.42 m, then the particle is close to the outlet and I want to change the position such that is re-injected into the inlet. However, it seems like this approach is not working since the particles get stuck at the outlet. Here is my UDF: Code:
#include "udf.h" DEFINE_DPM_BC(continue_tracking,p,t,f,f_normal,dim) { //here we want to keep track of the particle that reaches the outlet so we can "recycle" it return PATH_ACTIVE; } DEFINE_DPM_SCALAR_UPDATE(recycle_particles,c,t,initialize,p) { FILE *fp; if (P_POS(p)[1] > 0) { P_USER_REAL(p,1) = 0.; } if (P_POS(p)[1] >= -0.42 && P_POS(p)[1] < 0 && P_POS(p)[0] > 0.20 && P_USER_REAL(p,1) == 0.) { // save particle id and time to a file Message("The outlet boundary UDF is being called...\n"); fp=fopen("recycleparticles.txt", "a"); // x, y, z particle positions [m], particle ID [#] and time [s] //fprintf(fp,"%e %e %e %d %e\n",P_POS(p)[0],P_POS(p)[1],P_POS(p)[2],p->part_id,P_TIME(p)); fprintf(fp,"%d %e\n",p->part_id,P_TIME(p)); fclose(fp); // save the number of times this particle has been recycled P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1.; P_USER_REAL(p,1) = 1.; // send particle to the inlet boundary // just need to change y-position P_POS(p)[1] = 2.6534e-017; } } |
|
August 17, 2020, 18:55 |
|
#2 |
Member
Mostafa
Join Date: Sep 2016
Posts: 30
Rep Power: 10 |
I'm working on something very similar. It seems to me that your code should be working well. Have you figured what was the issue?
|
|
Tags |
dpm, particles, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
DPM: UDF - loop over all particles | chris | Fluent UDF and Scheme Programming | 31 | June 17, 2020 06:52 |
Calculation of "escaped" particles in dpm via UDF | abolfazl | FLUENT | 0 | November 18, 2018 14:28 |
UDF for tracking particles in DPM | abolfazl | FLUENT | 1 | October 27, 2018 13:32 |
[PyFoam] Problems with the new PyFoam release | zfaraday | OpenFOAM Community Contributions | 13 | December 9, 2014 19:58 |
udf init random particles positions | olivia | FLUENT | 2 | August 3, 2004 04:35 |