|
[Sponsors] |
DEFIND_SOURCE with looping through DPM particles |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 21, 2011, 03:43 |
DEFIND_SOURCE with looping through DPM particles
|
#1 |
New Member
Zhao
Join Date: Dec 2009
Location: China
Posts: 4
Rep Power: 17 |
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? |
|
October 21, 2011, 04:55 |
|
#2 | |
Senior Member
|
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:
__________________
Amir |
||
October 24, 2011, 23:00 |
|
#3 | |
New Member
Zhao
Join Date: Dec 2009
Location: China
Posts: 4
Rep Power: 17 |
Quote:
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) |
||
October 25, 2011, 05:06 |
|
#4 |
Senior Member
|
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,
__________________
Amir Last edited by Amir; October 25, 2011 at 05:53. |
|
November 8, 2011, 03:24 |
|
#5 | |
New Member
Zhao
Join Date: Dec 2009
Location: China
Posts: 4
Rep Power: 17 |
Quote:
|
||
|
|
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 |