|
[Sponsors] |
May 8, 2009, 19:18 |
Writing UDF for DPM
|
#1 |
New Member
Join Date: May 2009
Posts: 3
Rep Power: 17 |
Hello,
I'm trying to write UDF that will inject particles with the initial velocities equal to those in cell of injection. Its my first UDF so I realy don't have any expirence, please help me! This is what I wrote so far, it compiles but won't work. Code:
#include "udf.h" DEFINE_DPM_INJECTION_INIT(velocity_magnitude, I){ Particle *p; cell_t cell; Thread *cthread; loop(p,I->p){ cell = P_CELL(p); cthread = P_CELL_THREAD(p); P_VEL(p)[0] = C_U(cell, cthread); P_VEL(p)[1] = C_V(cell, cthread); P_VEL(p)[2] = C_W(cell, cthread); } } Code:
The udf-inject-init property was changed for 2 injections Error: SET-CDR!: invalid argument [1]: wrong type [not a pair] Error Object: #f |
|
May 11, 2009, 16:16 |
|
#3 |
New Member
Join Date: May 2009
Posts: 3
Rep Power: 17 |
P_VEL0 is velocity of particle at the entry of current cell?
how do I make sure that "current cell" is the injection cell? I want only to *inject* them at certain velocity (and DEFINE_DPM_SCALAR_UPDATE does not have Injection *I as an argument) |
|
May 12, 2009, 08:43 |
|
#4 |
Senior Member
|
hi,
to define injection you can use Injection *I P_VEL0(p) is a special macro and it does not modified when you use DEFINE_DPM_SCALAR_UPDATE so it returns the value due to the first cell that contains the particle. |
|
May 12, 2009, 08:48 |
|
#5 |
Senior Member
|
note that the DEFINE_DPM_SCALAR_UPDATE has the particle argument
so you can use it without definition of injection. also you do not to need to use a loop on particle or injections using this define macro. |
|
September 20, 2010, 21:30 |
run this macro parallel
|
#6 |
Member
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 17 |
Dear friends, I wrote a UDF using DEFINE_DPM_INJECTION_INIT and this work perfectly while I am using single CPU. As long as I am chaning it to parallel, then the particles go out of the geometry and everything is wrong. should I take any consideretaion while I want to run it in Parallel?
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
writing UDF for modelig mass transfer for VOF | ardalan soleymani | FLUENT | 0 | July 11, 2007 02:09 |
Seek help in writing UDF | Jack Martinez | FLUENT | 9 | June 14, 2007 11:24 |
New to writing UDF | Sandilya | FLUENT | 0 | May 31, 2007 13:03 |
Writing UDF for Robbins Bounday Condition | KKLAU | FLUENT | 1 | April 7, 2004 00:58 |
Macros for writing UDF for porosity | umesh | FLUENT | 1 | June 13, 2003 05:20 |