|
[Sponsors] |
April 10, 2019, 10:52 |
DPM Position macro undeclared variable
|
#1 |
Member
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7 |
Hi All, I am trying to deactivate particles within a certain region using the following UDF:
/******* UDF to deactivate particles in specified region *********/ #include "udf.h" #include "dpm.h" DEFINE_DPM_SCALAR_UPDATE(deactivation_position,cel l,thread,initialize,p) { real x[ND_ND]; real y; real z; real position; x=P_POS(p)[i]; y=x[1]; z=x[2]; position=(y*y+z*z) if (position>0.00000169) { MARK_PARTICLE(p, P_FL_REMOVED); } } However when interpreting the UDF I get the error: "line 12: P_POS: undeclared variable" I'm not sure how this simple UDF has gone wrong.... Any help is much appreciated |
|
April 10, 2019, 11:59 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I don't know if this solves your problem, but I corrected some mistakes below.
Code:
/******* UDF to deactivate particles in specified region *********/ #include "udf.h" #include "dpm.h" DEFINE_DPM_SCALAR_UPDATE(deactivation_position,cell,thread,initialize,p) { real x[ND_ND]; real y; real z; real position; x=P_POS(p); y=x[0]; z=x[1]; position=(y*y+z*z); if (position>0.00000169) { MARK_PARTICLE(p, P_FL_REMOVED); } } |
|
April 10, 2019, 12:02 |
|
#3 | |
Member
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7 |
Quote:
|
||
April 10, 2019, 22:41 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
compile UDF
best regards |
|
April 11, 2019, 10:30 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Code:
/******* UDF to deactivate particles in specified region *********/ #include "udf.h" #include "dpm.h" DEFINE_DPM_SCALAR_UPDATE(deactivation_position,cell,thread,initialize,p) { real y; real z; real position; y=TP_POS(p)[1]; z=TP_POS(p)[2]; position=(y*y+z*z); if (position>0.00000169) { MARK_PARTICLE(p, P_FL_REMOVED); } } |
|
April 11, 2019, 11:04 |
|
#6 | |
Member
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7 |
Quote:
That is fantastic! Now I am going to try and include a velocity component to this, and look at best way to analyse the results. If I am exporting particle tracking data as a .xml from fluent, is there a way to view these ones that I am removing? Or do I have to look at this with a UDF? |
||
Tags |
dpm, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cell Variable Macro Names (C_x_x...) for UDFs | meangreen | Fluent UDF and Scheme Programming | 3 | January 15, 2021 04:44 |
Compilation Error | vizvaz | Fluent UDF and Scheme Programming | 2 | January 6, 2017 05:19 |
DPM UDF particle position | Tom | FLUENT | 8 | July 25, 2015 13:30 |
error in COMSOL:'ERROR:6164 Duplicate Variable' | bhushas | COMSOL | 1 | May 30, 2008 05:35 |
Urgent!paricle position in DPM! | Josh | FLUENT | 0 | February 13, 2006 14:37 |