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

adjust particle velocity using DEFINE_ADJUST????

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 11, 2010, 16:46
Default adjust particle velocity using DEFINE_ADJUST????
  #1
Member
 
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 76
Rep Power: 7
Wikie is on a distinguished road
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
Wikie is offline   Reply With Quote

Old   November 15, 2010, 17:12
Default
  #2
Member
 
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 76
Rep Power: 7
Wikie is on a distinguished road
hi,

no ideas how to solve this problem?? I really need your help in this case.

Thanks
wikie
Wikie is offline   Reply With Quote

Old   November 16, 2010, 10:38
Default
  #3
Senior Member
 
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 8
coglione is on a distinguished road
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
coglione is offline   Reply With Quote

Old   November 16, 2010, 13:58
Default
  #4
Member
 
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 76
Rep Power: 7
Wikie is on a distinguished road
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
Wikie is offline   Reply With Quote

Old   November 16, 2010, 17:22
Default
  #5
Member
 
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 76
Rep Power: 7
Wikie is on a distinguished road
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?
Wikie is offline   Reply With Quote

Old   November 17, 2010, 06:30
Default
  #6
Senior Member
 
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 8
coglione is on a distinguished road
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
coglione is offline   Reply With Quote

Old   November 17, 2010, 16:53
Default
  #7
Member
 
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 76
Rep Power: 7
Wikie is on a distinguished road
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
Wikie is offline   Reply With Quote

Old   November 18, 2010, 15:12
Default
  #8
Member
 
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 76
Rep Power: 7
Wikie is on a distinguished road
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;

}
}

}
Attached Images
File Type: jpg 1st calculation.jpg (59.9 KB, 23 views)
File Type: jpg 2nd calculation.jpg (52.2 KB, 18 views)
Wikie is offline   Reply With Quote

Old   November 19, 2010, 16:20
Default
  #9
Member
 
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 76
Rep Power: 7
Wikie is on a distinguished road
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
Wikie is offline   Reply With Quote

Old   November 21, 2010, 18:11
Default about to despair
  #10
Member
 
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 76
Rep Power: 7
Wikie is on a distinguished road
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
Wikie is offline   Reply With Quote

Old   November 23, 2010, 04:01
Default
  #11
Senior Member
 
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 8
coglione is on a distinguished road
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
coglione is offline   Reply With Quote

Old   November 30, 2010, 16:26
Default
  #12
Member
 
Roman Gobitz-Pfeifer
Join Date: Dec 2009
Location: Stuttgart
Posts: 76
Rep Power: 7
Wikie is on a distinguished road
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.
Wikie is offline   Reply With Quote

Old   December 26, 2013, 05:19
Default
  #13
New Member
 
Rodman
Join Date: Dec 2013
Posts: 7
Rep Power: 3
ldm273507 is on a distinguished road
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.
ldm273507 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
Normal particle velocity in particle deposition! Prashanth Fluent Multiphase 1 May 29, 2013 22:30
Inlet Velocity in CFX aeroman CFX 12 August 6, 2009 18: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 19:46
particle trajectory calculation ursenbacher Main CFD Forum 2 January 28, 1999 17:15


All times are GMT -4. The time now is 20:04.