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

DPM Position macro undeclared variable

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 10, 2019, 10:52
Default DPM Position macro undeclared variable
  #1
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
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
bloodflow is offline   Reply With Quote

Old   April 10, 2019, 11:59
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
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);
        }

 }
pakk is offline   Reply With Quote

Old   April 10, 2019, 12:02
Default
  #3
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
Quote:
Originally Posted by pakk View Post
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);
        }

 }
Still Has the same problem.
bloodflow is offline   Reply With Quote

Old   April 10, 2019, 22:41
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
compile UDF

best regards
AlexanderZ is offline   Reply With Quote

Old   April 11, 2019, 10:30
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
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);
}

}
pakk is offline   Reply With Quote

Old   April 11, 2019, 11:04
Default
  #6
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
Quote:
Originally Posted by pakk View Post
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);
}

}

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

Reply

Tags
dpm, udf


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
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


All times are GMT -4. The time now is 16:26.