CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF for recycling particles by changing its positions

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By keishlaortiz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 9, 2019, 13:30
Exclamation UDF for recycling particles by changing its positions
  #1
New Member
 
Keishla
Join Date: Jul 2018
Posts: 1
Rep Power: 0
keishlaortiz is on a distinguished road
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;

	}
}
I also attached a zip file containing the workbench file, geometry file and udf code. If anyone can help me with this it would be appreciated.
Attached Files
File Type: zip files2.zip (134.6 KB, 4 views)
bikooo3878 likes this.
keishlaortiz is offline   Reply With Quote

Old   August 17, 2020, 17:55
Default
  #2
Member
 
Mostafa
Join Date: Sep 2016
Posts: 30
Rep Power: 9
bikooo3878 is on a distinguished road
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?
bikooo3878 is offline   Reply With Quote

Reply

Tags
dpm, particles, udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 05:52
Calculation of "escaped" particles in dpm via UDF abolfazl FLUENT 0 November 18, 2018 13:28
UDF for tracking particles in DPM abolfazl FLUENT 1 October 27, 2018 12:32
[PyFoam] Problems with the new PyFoam release zfaraday OpenFOAM Community Contributions 13 December 9, 2014 18:58
udf init random particles positions olivia FLUENT 2 August 3, 2004 03:35


All times are GMT -4. The time now is 06:56.