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

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

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By `e`

Reply
 
LinkBack Thread Tools Display Modes
Old   April 22, 2015, 20: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: 4
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, 20:59
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 800
Rep Power: 11
`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, 21:31
Default
  #3
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 4
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, 22:07
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 800
Rep Power: 11
`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 22, 2015, 23:23
Default
  #5
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 4
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, 00:10
Default
  #6
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 4
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.
Ive 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, 03:51
Default
  #7
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 800
Rep Power: 11
`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
Ive 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, 20:34
Default
  #8
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 4
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, 21:25
Default
  #9
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 4
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.
Ive 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, 02:31
Default
  #10
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 800
Rep Power: 11
`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
Ive 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, 02:38
Default
  #11
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 4
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, 04:15
Default
  #12
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 800
Rep Power: 11
`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, 20:24
Default
  #13
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 4
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, 01:30
Default
  #14
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 800
Rep Power: 11
`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, 22:27
Default
  #15
New Member
 
Join Date: Oct 2016
Posts: 5
Rep Power: 2
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, 06:27
Default
  #16
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 115
Rep Power: 2
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, 15:47
Default
  #17
New Member
 
Join Date: Oct 2016
Posts: 5
Rep Power: 2
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, 03:03
Default
  #18
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 115
Rep Power: 2
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

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Paraview 3.98 - errors when saving geometry file pajot OpenFOAM Paraview & paraFoam 1 September 28, 2013 10:45
UDF for deleting particles in DPM imanmirzaii Fluent UDF and Scheme Programming 5 January 29, 2013 08:02
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 23:13.