|
[Sponsors] |
adjust particle velocity using DEFINE_ADJUST???? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 11, 2010, 16:46 |
adjust particle velocity using DEFINE_ADJUST????
|
#1 |
Member
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 83
Rep Power: 17 |
Hi,
I'm using the DPM to simulate some particles inside an airstream. But the velocity is not correct in my case, so I wanna change it using DEFINE_ADJUST. But I'm getting alway the same error: "error C2106: '=' : left operand must be l-value" Here you can find a short example of my UDF: #include "udf.h" DEFINE_ADJUST(vel_adjust,d) { Particle_Variable_ID.PARTICLE_Y_VELOCITY = 0.5 Particle_Variable_ID.PARTICLE_X_VELOCITY = 0 } What I'm doing wrong?? Thanks for your help wikie |
|
November 15, 2010, 17:12 |
|
#2 |
Member
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 83
Rep Power: 17 |
hi,
no ideas how to solve this problem?? I really need your help in this case. Thanks wikie |
|
November 16, 2010, 10:38 |
|
#3 |
Senior Member
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 17 |
First of all you have to tell your udf a little bit more about the particles you want to work with.
1. From which injection is it released. You can get a pointer-list of all injections using Injection *Ilist = Get_dpm_injections(); 2. Looping over all Injections *I can be done by loop(I, Ilist) { } and looping over all parcels from this injection gives you access to its properties, e.g. P_VEL(p)[i] loop(p,I->p) { } BTW, wouldn't it be better to modify your DPM setup, eg. drag law or someting else to get velocities that satisfy your physical understanding than overruling a wrong simulation explicitely by hand? cheers |
|
November 16, 2010, 13:58 |
|
#4 |
Member
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 83
Rep Power: 17 |
Hi coglione,
thanks for your advice. I'll try it right now. I'm using a group injection. The particles are droplet and the simulation is in 2D. The velocity of the droplets is independent of the surrounding. The droplet are running through a structured packing and its velocity only depends on the mass flow rate. So later on the velocity will be something like this: v_particle = f(m_dot). But first I have to solve the problem, how to change the velocity. cheers wikie |
|
November 16, 2010, 17:22 |
|
#5 |
Member
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 83
Rep Power: 17 |
Hi coglione,
could you or any body else please help me again. I have to solve this problem, but my programming is to weak to do it without your help. I think the code should look like this, but FLUENT didn't agree with me. Would you please have a look at my code. #include "udf.h" #include "dpm.h" DEFINE_ADJUST(vel_adjust,d) { int *Ilist; int I; *Ilist = Get_dpm_injections() loop(I, Ilist) { loop(p,I->p) { P_VEL(p)[0] = 0 P_VEL(p)[1] = 0.5 } } } Thanks wikie PS.: I'll have to write more UDFs like this for my thesis. Where can I find some manuals especially in writing UDFs for Fluent? |
|
November 17, 2010, 06:30 |
|
#6 |
Senior Member
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 17 |
1)Ilist and I are not integers but of a Fluent specific type "Injection" (-> Injection *Ilist;....) and p has to be defined as Particle *p.
2) C-language and semicolons are good friends 3) You should have a FLUENT udf-manuel at hand if the Documentation-package has been installed on your computer. Have a look at chapter 2.5. cheers |
|
November 17, 2010, 16:53 |
|
#7 |
Member
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 83
Rep Power: 17 |
Hi coglione,
now I can compile and load the code without any errors, but there is no effect on the particle velocity. This is the code right now. #include "udf.h" #include "dpm.h" DEFINE_ADJUST(vel_adjust,d) { Injection *Ilist; Injection *I; Particle *p; Ilist = Get_dpm_injections(); loop(I,Ilist) { loop(p,I->p) { P_VEL(p)[0] = 0; P_VEL(p)[1] = 3; } } } could you please help me again. cheers wikie |
|
November 18, 2010, 15:12 |
|
#8 |
Member
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 83
Rep Power: 17 |
Hi,
I played around with this code to find out why there is no change in the velocity, although I compiled the UDF without any problems. After the calculation was done I run the calculation a 2nd time and the velocity changed. But the UDF just changed the initial velocity. So I'm having two questions. 1) Why do I have to do the calculation twice to change the velocity? (I just pushed "run calculation" after the 1st calculation was done) 2) How can i change the velocity in the whole setup and not just the initial one? You can find two screenshoots showing the results attached. cheers wikie PS. I used this code. #include "udf.h" #include "dpm.h" DEFINE_ADJUST(vel_adjust,d) { Injection *Ilist; Injection *I; Particle *p; int i; Ilist = Get_dpm_injections(); loop(I,Ilist) { loop(p,I->p) { P_VEL(p)[1] = -1; } } } |
|
November 19, 2010, 16:20 |
|
#9 |
Member
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 83
Rep Power: 17 |
Hi,
no idea why I'm changing just the initial velocity of the particles and not the velocity in the whole domain, anybody ?? I wanna have a constant velocity in the whole domain cheers wikie |
|
November 21, 2010, 18:11 |
about to despair
|
#10 |
Member
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 83
Rep Power: 17 |
hi @all,
I'm about to despair. I'm not able to set a constant independent velocity for all particles within my domain :-( Is there anybody who can help me?? Thanks wikie |
|
November 23, 2010, 04:01 |
|
#11 |
Senior Member
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 17 |
What DPM tracking scheme are you using? Steady, unsteady, coupled ..?
Remember that DEFINE_ADJUST is called once before each iteration solving the flow field and not each time particles are updated (position, velocity ..). There are some DPM-specific macros (search for something like DPM_SCALAR_UPDATE or so) which may be more appropriate for your application as they are called any time particle trajectories are recalculated. cheers |
|
November 30, 2010, 16:26 |
|
#12 |
Member
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 83
Rep Power: 17 |
hi coglione,
thanks for your help, now it is working. I'll just have to set the acceleration to 0 and it will be fine. Lets see how I can handle this. The code is very simple. #include "udf.h" #include "dpm.h" DEFINE_DPM_SCALAR_UPDATE(velocity,c,t,initialize,p ) { P_VEL(p)[0] = 0; P_VEL(p)[1] = -0.2; } cheers wikie Last edited by Wikie; November 30, 2010 at 17:00. |
|
December 26, 2013, 05:19 |
|
#13 |
New Member
Rodman
Join Date: Dec 2013
Posts: 7
Rep Power: 12 |
Hi,friend,I think you work give me a great help . I want to make simulation of cooling tower and try to write a UDF to contorl the velocity of water (use DPM model) in a specific zone, but there are some incorrects in it. When I compile the UDF, the console apperas "uninitialized local variable ‘tp' used" and "uninitialized local variable ‘p' used". Wether the DEFINE_ADJUST Macro can be used in modifying the velocity of DPM? The UDF is below:
#include "udf.h" #include "dpm.h" DEFINE_ADJUST(my_adjust,d) { //UDF Manual P201 Tracked_Particle *tp; cell_t c=P_CELL(tp); Thread *t=P_CELL_THREAD(tp); Particle *p; if(P_POS(p)[2]<14.8&&P_POS(p)[2]>=13.4) begin_particle_cell_loop(p,c,t) { P_VEL(p)[2] = -0.2; } end_particle_cell_loop(p,c,t) } In the next, I'll try to use your method. If I have other questions,erager for your helps!Best wishes. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Normal particle velocity in particle deposition! | Prashanth | Fluent Multiphase | 1 | May 29, 2013 23:30 |
Inlet Velocity in CFX | aeroman | CFX | 12 | August 6, 2009 19:42 |
About Particle velocity of DPM in Fluent? | long zhengwei | FLUENT | 0 | March 13, 2009 05:02 |
particle velocity in DPM | David | FLUENT | 3 | April 28, 2003 20:46 |
particle trajectory calculation | ursenbacher | Main CFD Forum | 2 | January 28, 1999 17:15 |