CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

DEFIND_SOURCE with looping through DPM particles

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Amir

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2011, 03:43
Default DEFIND_SOURCE with looping through DPM particles
  #1
New Member
 
Zhao
Join Date: Dec 2009
Location: China
Posts: 4
Rep Power: 17
mfren is on a distinguished road
help!

I run a simulation with Discrete Phase model. The Defind_Source macro is used for the continuity, and I want to relate it with DPM particles, so how to write the UDF with Looping over the particles in the cell?
mfren is offline   Reply With Quote

Old   October 21, 2011, 04:55
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Hi,
Loop over all particles and check whether it is in your desired cell and thread or not with P_CELL and P_THREAD commands:

Quote:
loop over cells
{
loop over particles
{
.......
}
}
__________________
Amir
Amir is offline   Reply With Quote

Old   October 24, 2011, 23:00
Default
  #3
New Member
 
Zhao
Join Date: Dec 2009
Location: China
Posts: 4
Rep Power: 17
mfren is on a distinguished road
Quote:
Originally Posted by Amir View Post
Hi,
Loop over all particles and check whether it is in your desired cell and thread or not with P_CELL and P_THREAD commands:
dear Amir, many thanks for your reply.
A main difficult to loop over all particles in Define_Source macro is that I can't get the tracked particle thread.
My test UDF is as following:

# include "udf.h"
DEFINE_SOURCE(chg_source,c,t,dS,eqn)
{
int I=0;
real xc[ND_ND];
real source;

Tracked_Particle *p;
cell_t cell;

loop(p,I->p)
{
cell = P_CELL(p);
if (c==cell)
{
C_CENTROID(xc,c,t);
Message("P_POS(p)[0]: %g\n", P_POS(p)[0]);
Message("P_POS(p)[1]: %g\n", P_POS(p)[1]);
Message("xc[0]: %g\n", xc[0]);
Message("xc[1]: %g\n", xc[1]);
}
dS[eqn] = 0;
source = 0;
return source;
}

compiling Error is in line: loop(p,I->p)
mfren is offline   Reply With Quote

Old   October 25, 2011, 05:06
Default
  #4
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Hi,

First of all, I don't think "I" is defined properly, is it integer?! But I think if there would be a problem in this procedure, it's better to change order of loops; i.e., use a DPM macro which automatically have a loop over particles; maybe "SCALAR_UPDATE" is proper; then store effect of each particle in its temporary cell memories and then use that memory in your source macro. I can elaborate it more if it's not clear.

Bests,
vavnoon likes this.
__________________
Amir

Last edited by Amir; October 25, 2011 at 05:53.
Amir is offline   Reply With Quote

Old   November 8, 2011, 03:24
Default
  #5
New Member
 
Zhao
Join Date: Dec 2009
Location: China
Posts: 4
Rep Power: 17
mfren is on a distinguished road
Quote:
Originally Posted by Amir View Post
Hi,

...... i.e., use a DPM macro which automatically have a loop over particles; maybe "SCALAR_UPDATE" is proper; then store effect of each particle in its temporary cell memories and then use that memory in your source macro. I can elaborate it more if it's not clear.

Bests,
it's a good idea. I'll try it. thanks for your advice.
mfren is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DPM: UDF - loop over all particles chris Fluent UDF and Scheme Programming 31 June 17, 2020 06:52
Injection of specific number of particles in DPM DH FLUENT 12 March 16, 2016 22:04
Constant & independent velocity for DPM particles Wikie Fluent UDF and Scheme Programming 1 September 23, 2010 06:35
DPM - do the particles affect the liquid? Nikhil Dani FLUENT 0 January 1, 2009 12:58
DPM - Why do the particles not vanish? Johannes FLUENT 12 July 6, 2007 12:19


All times are GMT -4. The time now is 14:38.