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

Does any know how to use "file" as the input of the particles in DPM?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 22, 2015, 21:33
Default Does any know how to use "file" as the input of the particles in DPM?
  #1
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 11
mimi0201 is on a distinguished road
Does any know how to use "file" as the input of the particles in DPM? how do i set each component and what type of the file is that? really appreciate!
mimi0201 is offline   Reply With Quote

Old   April 22, 2015, 21:59
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The injection file extension can be *.inj and written with a text editor, the format is:

Code:
((x y z u v w diameter temperature mass-flow-rate) streamID)
For example for a particle injection at the origin starting from rest with a 1 kg/s mass flow rate and 1 m particle diameter at a temperature of 300 K:

Code:
(( 0. 0. 0. 0. 0. 0. 1. 300. 1.) stream-0)
You could prepare these files in a program such as MATLAB or with an execute on demand UDF within Fluent.
mimi0201 likes this.
`e` is offline   Reply With Quote

Old   April 22, 2015, 22:31
Default
  #3
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 11
mimi0201 is on a distinguished road
Quote:
Originally Posted by `e` View Post
The injection file extension can be *.inj and written with a text editor, the format is:

Code:
((x y z u v w diameter temperature mass-flow-rate) streamID)
For example for a particle injection at the origin starting from rest with a 1 kg/s mass flow rate and 1 m particle diameter at a temperature of 300 K:

Code:
(( 0. 0. 0. 0. 0. 0. 1. 300. 1.) stream-0)
You could prepare these files in a program such as MATLAB or with an execute on demand UDF within Fluent.
x y z represent the coordinate and u v w represent the velocity correct? But how do i know the coordinate if I want to inject in a particular point. Does that mean if i want the FLUENT to generate exactly say 20 particles, then I just copy n paste 20 times and using different coordinate is that right?
mimi0201 is offline   Reply With Quote

Old   April 22, 2015, 23:07
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
You can inject a particle at a particular point by setting the corresponding position components x, y and z. For example if you have an inlet at x = -1 m and you would like to inject a line of particles then you would have a series of injection lines varying in the y- and z-directions:

Code:
(( -1. -0.5 -0.5 0. 0. 0. 1. 300. 1.) stream-0)
(( -1. 0. 0. 0. 0. 0. 1. 300. 1.) stream-1)
(( -1. 0.5 0.5 0. 0. 0. 1. 300. 1.) stream-2)
Yes, u, v and w represent the initial velocity [m/s] of the particles.
`e` is offline   Reply With Quote

Old   April 23, 2015, 00:23
Default
  #5
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 11
mimi0201 is on a distinguished road
Quote:
Originally Posted by `e` View Post
You can inject a particle at a particular point by setting the corresponding position components x, y and z. For example if you have an inlet at x = -1 m and you would like to inject a line of particles then you would have a series of injection lines varying in the y- and z-directions:

Code:
(( -1. -0.5 -0.5 0. 0. 0. 1. 300. 1.) stream-0)
(( -1. 0. 0. 0. 0. 0. 1. 300. 1.) stream-1)
(( -1. 0.5 0.5 0. 0. 0. 1. 300. 1.) stream-2)
Yes, u, v and w represent the initial velocity [m/s] of the particles.
Ok i got it, so for your example, three particles 0, 1 and 2 are injected. But another question is if I dont know the corresponding position components x, y and z for the desired point, how could i export this position of the point?
mimi0201 is offline   Reply With Quote

Old   April 23, 2015, 01:10
Default
  #6
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 11
mimi0201 is on a distinguished road
Quote:
Originally Posted by `e` View Post
You can inject a particle at a particular point by setting the corresponding position components x, y and z. For example if you have an inlet at x = -1 m and you would like to inject a line of particles then you would have a series of injection lines varying in the y- and z-directions:

Code:
(( -1. -0.5 -0.5 0. 0. 0. 1. 300. 1.) stream-0)
(( -1. 0. 0. 0. 0. 0. 1. 300. 1.) stream-1)
(( -1. 0.5 0.5 0. 0. 0. 1. 300. 1.) stream-2)
Yes, u, v and w represent the initial velocity [m/s] of the particles.
I‘ve tried that but it shows the massage that 1 particles not found in injection injection-0.

Code:
((14.802 -2.0 2.5 22.75 0.0 0.0 0.000001 300.0 1.0)injection-0:0)
mimi0201 is offline   Reply With Quote

Old   April 23, 2015, 04:51
Default
  #7
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
Originally Posted by mimi0201 View Post
Ok i got it, so for your example, three particles 0, 1 and 2 are injected. But another question is if I dont know the corresponding position components x, y and z for the desired point, how could i export this position of the point?
If you don't know your initial particle coordinates or other parameters before creating the injection file then you could alter them with a DEFINE_DPM_INJECTION_INIT macro.

Quote:
Originally Posted by mimi0201 View Post
I‘ve tried that but it shows the massage that 1 particles not found in injection injection-0.

Code:
((14.802 -2.0 2.5 22.75 0.0 0.0 0.000001 300.0 1.0)injection-0:0)
What does your error message say? Have you injected this stream inside your domain? Be careful of units.
`e` is offline   Reply With Quote

Old   April 23, 2015, 21:34
Default
  #8
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 11
mimi0201 is on a distinguished road
Quote:
Originally Posted by `e` View Post
If you don't know your initial particle coordinates or other parameters before creating the injection file then you could alter them with a DEFINE_DPM_INJECTION_INIT macro.



What does your error message say? Have you injected this stream inside your domain? Be careful of units.
Oh! Units! What is the unit for x y z, is it "m"? My model was created in "mm". I'll change that and see what happened.
mimi0201 is offline   Reply With Quote

Old   April 23, 2015, 22:25
Default
  #9
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 11
mimi0201 is on a distinguished road
Quote:
Originally Posted by `e` View Post
If you don't know your initial particle coordinates or other parameters before creating the injection file then you could alter them with a DEFINE_DPM_INJECTION_INIT macro.



What does your error message say? Have you injected this stream inside your domain? Be careful of units.
I‘ve tried that and everthing has been corrected, one particle was tracked but there is no file generated (my own udf code).
mimi0201 is offline   Reply With Quote

Old   April 27, 2015, 03:31
Default
  #10
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
Originally Posted by mimi0201 View Post
Oh! Units! What is the unit for x y z, is it "m"? My model was created in "mm". I'll change that and see what happened.
Yes, the units are standard SI which is [m] for length.

Quote:
Originally Posted by mimi0201 View Post
I‘ve tried that and everthing has been corrected, one particle was tracked but there is no file generated (my own udf code).
Were you expecting more than one particle? Are you using steady (tracking from results or during the simulation) or unsteady? What file were you expecting to be generated?
`e` is offline   Reply With Quote

Old   April 27, 2015, 03:38
Default
  #11
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 11
mimi0201 is on a distinguished road
Quote:
Originally Posted by `e` View Post
Yes, the units are standard SI which is [m] for length.



Were you expecting more than one particle? Are you using steady (tracking from results or during the simulation) or unsteady? What file were you expecting to be generated?
yes, i'm expecting several particles, say 50. I'm using steady state to simulate my case and tracking from the results. the file which i'm expecting is the position and velocity details recording the particle when hitting on the wall.
mimi0201 is offline   Reply With Quote

Old   April 27, 2015, 05:15
Default
  #12
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Are you skipping any particle streams (or tracking a single stream)? Perhaps attach a screenshot of the settings you're using?

What UDF are you using and have you enabled this user-defined boundary condition under the DPM boundary conditions?
`e` is offline   Reply With Quote

Old   April 27, 2015, 21:24
Default
  #13
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 11
mimi0201 is on a distinguished road
Quote:
Originally Posted by `e` View Post
Are you skipping any particle streams (or tracking a single stream)? Perhaps attach a screenshot of the settings you're using?

What UDF are you using and have you enabled this user-defined boundary condition under the DPM boundary conditions?
Basically the code is as follows:

Code:
/**reflect*boundary*condition*for*inert*particles**/
#include "udf.h"
#include <stdio.h>
#include "dpm.h"
#include "random.h"
#include "surf.h"


DEFINE_DPM_BC(bc_reflect,p,t,f,f_normal,dim)
{
	real alpha;    /* angle*of*particle*path*with*face*normal */
	real vn = 0.0;
	real nor_coeff = 0.8;
	real tan_coeff = 0.8;
	real normal[3];     /* Array that contains the unit vector which is normal to the face */
	real d;
	real ke = 0.0;
	real NV_VEC(x);   /* defines a vector */
	int i, idim = dim;
	int particle_trap = 0;
	FILE *fp = fopen("particle_data.dat","a");   /*  open a file named data.txt in read-only mode and assign it to fp */

	if(p->type==DPM_TYPE_INERT)
	{
		alpha = M_PI/2. - acos(MAX(-1.,MIN(1.,NV_DOT(normal,P_VEL(p)) / MAX(NV_MAG(P_VEL(p)),DPM_SMALL))));

		if ((NNULLP(t))&&(THREAD_TYPE(t)==THREAD_F_WALL))
			F_CENTROID(x,f,t);        
		 	
		for(i=0; i<idim; i++)
		{		
			normal[i] = f_normal[i];

	    	// normal velocity
			vn += P_VEL(p)[i]*normal[i];

			/*set the particle diameter in microns*/
			d = P_DIAM(p);

			// normal velocity
			P_VEL(p)[i] -= vn*normal[i];

			// tangential coefficient of restitution
			P_VEL(p)[i] *= tan_coeff;

			// reflected normal velocity
			P_VEL(p)[i]-=nor_coeff*vn*normal[i];

			// new velocity in P_VEL0 of particle
			P_VEL0(p)[i]=P_VEL(p)[i];
		}

		/*calculate the kinetic energy*/
		ke = 0.24544 * vn * vn * d * d * d;
		ke *= 1e+6;

		/* apply the trap condition */
		if (ke <= 0.000000001)
		{
			particle_trap = 1;
			//record the informations
			fprintf(fp,"%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%d\t%d\n", P_POS(p)[0], P_POS(p)[1], P_POS(p)[2], alpha,vn, P_VEL(p)[0], P_VEL(p)[1], P_VEL(p)[2], ke, p->part_id, particle_trap);
			fclose(fp);
			return PATH_ABORT; /*trap the particle*/
		}
		else
		{
			particle_trap = 0;
			//record the informations
		    fprintf(fp,"%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%11.8lf\t%d\t%d\n", P_POS(p)[0], P_POS(p)[1], P_POS(p)[2], alpha,vn, P_VEL(p)[0], P_VEL(p)[1], P_VEL(p)[2], ke, p->part_id, particle_trap);
		    fclose(fp);
			return PATH_ACTIVE;
		}	 
	}
	 return PATH_ABORT;
}
The idea of the code is to track the particle information when hitting the wall including the position, velocity, kinetic energy etc.

The problem is when i use normal particle injection method (surface injection), everything works fine, particle hitting on the wall several times (record as "0") and finally trapped (record as "1"). (single particle tracking) However, when I use "file" injection, as follows:

Code:
((x y z u v w diameter temperature mass-flow) name)
((0.0 0.0 0.0 0.0 0.0 -5.95 0.00002 293.0 1.0) injection-0:0)
there is only one data generated showing the particle is escaped. which in this code, particles must be trapped cause i didn't set a such high kinetic energy criterion. I'm not sure which part i go wrong.

Please tell me if you need any more information. Really appreciate!
mimi0201 is offline   Reply With Quote

Old   April 28, 2015, 02:30
Default
  #14
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Don't include the syntax line within your code:

Code:
((x y z u v w diameter temperature mass-flow) name)
You currently only have one injection stream specified (unless you have excluded the other lines of your file from your last post). Only one stream will be tracked using the steady solver.

Where are the particles which become trapped originate and how do these positions compare with your injection file stream of x = y = z = 0 m?
`e` is offline   Reply With Quote

Old   June 11, 2017, 23:27
Default
  #15
New Member
 
Join Date: Oct 2016
Posts: 6
Rep Power: 10
Sankaranand is on a distinguished road
Quote:
Originally Posted by `e` View Post
Don't include the syntax line within your code:

Code:
((x y z u v w diameter temperature mass-flow) name)
You currently only have one injection stream specified (unless you have excluded the other lines of your file from your last post). Only one stream will be tracked using the steady solver.

Where are the particles which become trapped originate and how do these positions compare with your injection file stream of x = y = z = 0 m?
How do we choose the type of atomizer in this case? Can we change the properties such as breakup constants, step size after importing the file?

I don't quite understand when you say injection lines. Do you mean multiple injection points? By using the above code are we just defining an injection point or is there more to it ?
Sankaranand is offline   Reply With Quote

Old   June 12, 2017, 07:27
Default
  #16
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
Hi Sankaranand

File = custom atomizer.

one line on the file = one parcel.
50 lines on the file = 50 parcels.
10000 lines on the file = 10000 parcels.
DPM parcel concept
KaLium is offline   Reply With Quote

Old   June 12, 2017, 16:47
Default
  #17
New Member
 
Join Date: Oct 2016
Posts: 6
Rep Power: 10
Sankaranand is on a distinguished road
Quote:
Originally Posted by KaLium View Post
Hi Sankaranand

File = custom atomizer.

one line on the file = one parcel.
50 lines on the file = 50 parcels.
10000 lines on the file = 10000 parcels.
DPM parcel concept
Hi KaLium,

Thanks for the response. I am working on a pressure swirl atomizer. I would like to specify the initial diameter of a droplet based on a formula developed by my Professor. I would like to compare the results with the experiment ones. But, Fluent does not allow me to specify initial diameter for pressure swirl atomizer.

If we're using file for injection, one injection line equals injection-0 in fluent? I am confused. I would appreciate your help in this regard.
Sankaranand is offline   Reply With Quote

Old   June 13, 2017, 04:03
Default
  #18
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
Yes. The first line is injection-0. On each line you have a parcel that has it's own injection location, velocity components, diameter, mass etc.

You need several lines for swirl atomizer, because you have several parcels with different injection directions. Also if you want parcels with different diameters, you need even more lines. etc.
KaLium is offline   Reply With Quote

Old   July 8, 2017, 11:55
Default particle injection file
  #19
New Member
 
Join Date: Jan 2017
Posts: 25
Rep Power: 9
sewgolam is on a distinguished road
hallo guys,

I ant to make a particle injection file in Microsoft visual studio.But I can not compile this in fluent and read it.

I ainm is to change the absorption coefficient if the particles that I'm injecting using DPM.

I totally confuse my
can someone tell me how to do it,

please explain step by step.


thank you very much
sewgolam is offline   Reply With Quote

Old   July 12, 2017, 04:03
Default
  #20
New Member
 
Join Date: Oct 2016
Posts: 6
Rep Power: 10
Sankaranand is on a distinguished road
Quote:
Originally Posted by KaLium View Post
Yes. The first line is injection-0. On each line you have a parcel that has it's own injection location, velocity components, diameter, mass etc.

You need several lines for swirl atomizer because you have several parcels with different injection directions. Also if you want parcels with different diameters, you need even more lines. etc.
Thank you very much for your response. I was working on a different project and I didn't get to work on this for a while. The UDF needs a diameter in the syntax. But what should I do if I would like to compare SMDs of various models?

Doesn't inputting diameters defeat the purpose? Please let me know if I am missing anything. I cannot get anywhere with this. Thank You.
Sankaranand is offline   Reply With Quote

Reply


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
UDF for deleting particles in DPM imanmirzaii Fluent UDF and Scheme Programming 12 November 25, 2020 20:27
Conditional Release of DPM Particles in Fluent - UDF nvschandra Fluent UDF and Scheme Programming 0 December 16, 2013 21:32
Conditional Release of DPM particles - UDF nvschandra Fluent UDF and Scheme Programming 0 December 10, 2013 12:02
[OpenFOAM] Paraview 3.98 - errors when saving geometry file pajot ParaView 1 September 28, 2013 11:45
DPM - do the particles affect the liquid? Nikhil Dani FLUENT 0 January 1, 2009 12:58


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