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 assigning particles position (re-injecting to the inlet)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 11, 2019, 08:11
Default UDF for assigning particles position (re-injecting to the inlet)
  #1
New Member
 
Jemyung Cha
Join Date: Jul 2009
Posts: 12
Rep Power: 17
cicatrix is on a distinguished road
Hello.

I'm trying to re-injecting particles exiting outlet back into inlet.

There is a good reference provided by user 'e'.

Periodic BC in ANSYS DDPM, UDF


Exactly same code of user 'e' was tested.

Code:
#include "udf.h"

DEFINE_DPM_BC(continue_tracking,p,t,f,f_normal,dim)
{
	return PATH_ACTIVE;
}

DEFINE_DPM_SCALAR_UPDATE(recycle_particles,c,t,initialize,p)
{
	FILE *fp;

	if (P_POS(p)[0]<0.08333)
	{
		P_USER_REAL(p,1) = 0.;
	}
	
	if (P_POS(p)[0]>0.91667 && P_USER_REAL(p,1) == 0.)
	{
		// save particle position to a text file
		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));
		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
		P_POS(p)[0] = 0.;
		P_POS(p)[1] = P_POS(p)[1] + 0.0833;
	}
}

First, I managed to succeed re-injecting particles in a cubic domain (1.0 * 1.0 * 1.0 m3).

The inlet is on the left side and the outlet is on the right.

Particle is injected at the line-surface and flows to the outlet.

Near the outlet (x > 0.91667), it was shown that the particles moves to the inlet!!


Their positions are exactly what I want.

case1(first_cycle).jpg
case1(third_cycle).jpg



But, sometimes, I noticed that it doesn't work unexpectedly.

It seems like that the particles positions are highly affected by the mesh size, particles velocity, time step and other numerical parameters.

Some particles are deviating the position they should be.

case2(before_outlet).jpg
case2(after_outlet).jpg


I think all particles must pass through the fluid cells with spatial and temporal steps. So the time step was reduced for the fine mesh case.

Two case files are in the follwing link.

https://drive.google.com/drive/folde...cp?usp=sharing

(case1.zip is coarse mesh and case2.zip is fine mesh.
they are generated in ANSYS student version 2019 R2.)


How to control the particle position more adequately?

Please provide any information about this topic.
Thanks.
Attached Images
File Type: jpg case1(first_cycle).jpg (29.0 KB, 10 views)
File Type: jpg case1(third_cycle).jpg (29.1 KB, 7 views)
File Type: jpg case2(before_outlet).jpg (29.3 KB, 7 views)
File Type: jpg case2(after_outlet).jpg (40.4 KB, 8 views)
cicatrix is offline   Reply With Quote

Reply

Tags
define_dpm_scalar_update, dpm


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
help with udf for wind profil at inlet BEK_Ad FLUENT 1 April 8, 2018 11:08
UDF paraboloid velocity inlet rosco FLUENT 10 June 2, 2017 09:01
UDF problem- time dependent temperature at inlet kaeran FLUENT 1 June 16, 2015 22:48
Inlet won't apply UDF and has temperature at 0K! tccruise Fluent UDF and Scheme Programming 2 September 14, 2012 07:08
UDF paraboloid velocity inlet Ronak Shah FLUENT 0 June 4, 2003 10:44


All times are GMT -4. The time now is 17:47.