CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   DPM particle INITIALIZATION- A NOVICE NEEDS HELP (https://www.cfd-online.com/Forums/fluent/44899-dpm-particle-initialization-novice-needs-help.html)

Sandilya June 1, 2007 13:45

DPM particle INITIALIZATION- A NOVICE NEEDS HELP
 
Hi all, I am new to writing UDFs. I am trying to track particles using DPM. At the inlet I am trying to put a random velocity distribution to the particles!!! How can I do that... What is the macro so that all the particles are referenced one after the other. I am giving the algorithm below... can anyone suggest the macros I need. I am new, so please let me know if there are any errors.....

Algorithm: #include "udf.h" #include "surf.h" /* RP_CELL and RP_THREAD are defined in surf.h */ #include "dpm.h"

DEFINE_DPM_INJECTION_INIT(init_vel,I) {

int j;

Particle *p;

cell_t cell;

Thread *cthread;

(LOOP OVER ALL PARTICLES) /*I need this MACRO*/

{

for(j=0;j<2;j++)

{

P_VEL(p)[j] = (some random number here generated using standard functions in C);

}

}

}


A A S June 1, 2007 14:40

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
I don't know if this will work, but I would try defining a surface injection. Correct me if I am wrong, but a surface injection injects particles thru the centroid of each cell face corresponding to the inlet thread. If this is the case, then you can loop over each cell (instead of particle loop) and set the particle velocity at each cell in the thread. Sorry I couldn't be more help.

regards AAS

Henrik June 4, 2007 07:38

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Hello!

Actually, I would recommend not to loop over any cells or faces unless really necessary, as this is usually quite heavy. For the initialization of particles with the DPM model, use the DEFINE_DPM_INJECTION_INIT macro and then:

* if in steady-state mode, loop over I->p

EXAMPLE:

loop(p, I->p) { ... }

* if in unsteady or spray mode, use I->p_init

EXAMPLE:

loop(p, I->p_init) { ... }

I have done this several times and it works great. Good luck!

/Henrik

Sandilya June 4, 2007 09:13

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Thank you very much for the response. I tried the loop(p,I->p_init) macro { mine is a unsteady case } But when I interpret it the following error comes

Error: C:\---\prtcl_init_condn.c: line 14: structure reference not implemented

This error is at the line of calling the loop(p,I->p_init) macro.

I dont know where teh error is.. Can you see the algorithm I gave and tell if there is some error?

Thank you

Bye Sandilya


Henrik June 4, 2007 09:22

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Hi again

I cannot see what the error is... loop(p,I->p_init) should loop over all particles p that belong to the injection I for which the DEFINE-macro is called in an unsteady simulation (or a simulation using spray-related models), and I is passed to the macro by the solver. udf.h and dpm.h are all you need to include. It works fine for me in Fluent 6.2 but I have not yet tried it in Fluent 6.3... I don't know if there are any changes that will affect these things. Maybe you should want to try I->p only instead?

/Henrik

A A S June 5, 2007 10:02

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Thanks Henrik, I wasn't aware of those macros for particle loops.

Cheers A A S

Sandilya June 5, 2007 10:07

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Hi Henrik Thank you for your help. loop(p,I->p) also doesn't work. I am not understanding where the error.

I am trying to figure out the error.

If you find anything please let me know

Thank you

Sandilya

R. June 5, 2007 10:11

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
It would be easier to write your own routine (not a udf) that outputs the initial particle conditions to a file.

The file format is documented in the help files.

In the injector dialog box, under injector type, pick 'file'

R.


Markus Alzon June 11, 2007 10:50

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Hey Henrik,

sorry for being that late, but I use the same approach as you do (looping over the particles). And this (sucessfully) with Fluent 6.3.

Greetings

MA


Markus Alzon June 11, 2007 10:53

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
What exactly do you mean, by "the error"?

I am using the loop, without any problems. Are there any particles set in during the calculation? If so, then your udf should be working. Maybe you can send us some parts of your udf?

Take care,

MA

Sandilya June 11, 2007 11:06

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Thank you Markus The UDF that I am referring to is in the first post of this thread. I interpreted it into Fluent 6.2.16 but it is not interpreting and giving the error saying Structure not referenced..

It is strange to me that it works for you and not for me.

Can you tell if there is an error in the code that I wrote for the UDF in terms of syntax or other things?

Thank you

Sandilya

Markus Alzon June 12, 2007 05:07

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Hello Sandilya,

You wrote in one Post:

"Error: C:\---\prtcl_init_condn.c: line 14: structure reference not implemented"

I'd like to know, what that is.

On the other hand, I never used interpreted UDFs, I always compile mine in. Maybe you should try this too?

Good luck,

MA


Sandilya June 12, 2007 09:07

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Hello Marcus,

The Error : ---- is the error statement that I am getting on interpreting the UDF in Fluent. I dont know what it means. Actually I put up another post seeking answer to this question as well, but didnt get any response to it.

Also I tried compiling the UDF and still there was some error.

Thank you very much for your help!!! Please let me know if you find anything!!

Regards Sandilya Garimella

A A S June 13, 2007 11:13

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
It might help to read the compilation log when debugging UDFs. That is why it is much better to compile than interpret.

Good luck

Markus Alzon June 14, 2007 04:28

Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
 
Maybe it would help us all, if you could post (or send by email) your code, so that we can try it ourselves.

I don't think it is a really complicated issue.

Take care,

MA


All times are GMT -4. The time now is 00:01.