CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Does any know how to use "file" as the input of the particles in DPM? (https://www.cfd-online.com/Forums/fluent-udf/152051-does-any-know-how-use-file-input-particles-dpm.html)

mimi0201 April 22, 2015 20:33

Does any know how to use "file" as the input of the particles in DPM?
 
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!:):)

`e` April 22, 2015 20:59

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 April 22, 2015 21:31

Quote:

Originally Posted by `e` (Post 543287)
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?

`e` April 22, 2015 22:07

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.

mimi0201 April 22, 2015 23:23

Quote:

Originally Posted by `e` (Post 543297)
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 April 23, 2015 00:10

Quote:

Originally Posted by `e` (Post 543297)
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)

`e` April 23, 2015 03:51

Quote:

Originally Posted by mimi0201 (Post 543306)
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 (Post 543307)
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.

mimi0201 April 23, 2015 20:34

Quote:

Originally Posted by `e` (Post 543331)
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 April 23, 2015 21:25

Quote:

Originally Posted by `e` (Post 543331)
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).

`e` April 27, 2015 02:31

Quote:

Originally Posted by mimi0201 (Post 543483)
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 (Post 543488)
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?

mimi0201 April 27, 2015 02:38

Quote:

Originally Posted by `e` (Post 543853)
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.

`e` April 27, 2015 04:15

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?

mimi0201 April 27, 2015 20:24

Quote:

Originally Posted by `e` (Post 543874)
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!

`e` April 28, 2015 01:30

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?

Sankaranand June 11, 2017 22:27

Quote:

Originally Posted by `e` (Post 544018)
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 ?

KaLium June 12, 2017 06:27

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.
https://www.cfd-online.com/Forums/fl...l-concept.html

Sankaranand June 12, 2017 15:47

Quote:

Originally Posted by KaLium (Post 652782)
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.
https://www.cfd-online.com/Forums/fl...l-concept.html

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.

KaLium June 13, 2017 03:03

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.

sewgolam July 8, 2017 10:55

particle injection file
 
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

Sankaranand July 12, 2017 03:03

Quote:

Originally Posted by KaLium (Post 652940)
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.


All times are GMT -4. The time now is 16:02.