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); } } } |
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 |
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 |
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 |
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 |
Re: DPM particle INITIALIZATION- A NOVICE NEEDS HE
Thanks Henrik, I wasn't aware of those macros for particle loops.
Cheers A A S |
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 |
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. |
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 |
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 |
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 |
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 |
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 |
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 |
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. |