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

Writing UDF for DPM

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 8, 2009, 19:18
Default Writing UDF for DPM
  #1
New Member
 
Join Date: May 2009
Posts: 3
Rep Power: 16
Cantstandit is on a distinguished road
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);
}


}
Actually it works if I hook it up to 1 injection, but when I try to do it with 2 injections at the same time it returns error

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
Cantstandit is offline   Reply With Quote

Old   May 11, 2009, 02:48
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
hi,
I propose you to use DEFINE_DPM_SCALAR_UPDATE macro and use
P_VEL0 in your code.


good luck,
Amir is offline   Reply With Quote

Old   May 11, 2009, 16:16
Default
  #3
New Member
 
Join Date: May 2009
Posts: 3
Rep Power: 16
Cantstandit is on a distinguished road
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)
Cantstandit is offline   Reply With Quote

Old   May 12, 2009, 08:43
Default
  #4
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
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.
Amir is offline   Reply With Quote

Old   May 12, 2009, 08:48
Default
  #5
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
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.
Amir is offline   Reply With Quote

Old   September 20, 2010, 21:30
Default run this macro parallel
  #6
Member
 
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 16
sfotovati is on a distinguished road
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?
sfotovati is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


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


All times are GMT -4. The time now is 06:28.