|
[Sponsors] |
February 10, 2016, 23:02 |
any macros to get this?
|
#1 |
Senior Member
Join Date: Mar 2014
Posts: 375
Rep Power: 13 |
Good day
I want a udf for the discrete phase to be activated only when the particle passes through a cell with a specific property. For example, the DEFINE_DPM_BC is activated only when the particle hits a wall. But, here I am trying to activate the UDF while the particle is travelling away from the walls and only when it passes through a cell with a certain property. To be specific the cells representing a different eulerian phase which is moving constantly as well. So the UDF is called only when the particle enters such a cell. Is this even possible to achieve? Am i looking at a DEFINE_ON_DEMAND macro? Usually the DPM macros are called at everytime step but this wont be very efficient in my case where the cell occupied by the eulerian phase is only a small fraction of the total number of cells. |
|
February 11, 2016, 06:14 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The DEFINE_ON_DEMAND macro is only executed when you manually enable it (unless you're using scripts). The DEFINE_DPM_SCALAR_UPDATE macro is called each time a particle position is updated. With conditional statements, you can restrict when code is executed and this method is generally quick (I can't think of a more elegant solution). For an arbitrary example, a particle travelling away from a wall (on the XZ plane) within a cell of a high velocity:
Code:
DEFINE_DPM_SCALAR_UPDATE(certain_particles,c,t,initialise,p) { if (P_VEL(p)[1] > 0. && C_U(c, t) > 1.) { // a code block } } Code:
DEFINE_DPM_BODY_FORCE(certain_particles_force,p,i) { cell_t c; Thread *t; c = P_CELL(p); t = P_CELL_THREAD(p); if (P_VEL(p)[1] > 0. && C_U(c, t) > 1.) { // a code block } } Last edited by `e`; February 12, 2016 at 00:10. |
|
February 11, 2016, 20:23 |
|
#3 |
Senior Member
Join Date: Mar 2014
Posts: 375
Rep Power: 13 |
Aren't these already passed in the macro?
Code:
DEFINE_DPM_SCALAR_UPDATE(certain_particles,''c'',''t'',initialise,p) Code:
cell_t c; Thread *t; c = P_CELL(p); t = P_CELL_THREAD(p); |
|
February 12, 2016, 00:09 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Woops, that's correct: you won't need to find the cell number and thread for the DEFINE_DPM_SCALAR_UPDATE macro (already provided) but it's required for DEFINE_DPM_BODY_FORCE (only provides the particle and direction index).
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Some guidance is needed about UDF macros | highhopes | Fluent UDF and Scheme Programming | 2 | July 3, 2012 10:41 |
Tecplot360 - Macros calling Macros? | eRzBeNgEl | CFX | 1 | April 15, 2011 07:32 |
help with macros F_ID and C_ID | Jack Martinez | FLUENT | 0 | August 19, 2007 09:27 |
What are UDF macros C_T_S , C_T_AP,...???? | Asghari | FLUENT | 0 | January 28, 2007 11:54 |
Orientation of Face Variable Macros | hirokata | FLUENT | 0 | February 17, 2006 01:12 |