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

P_POS(p) undeclared variable

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By spring
  • 1 Post By mohammad1008

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 22, 2010, 09:58
Default P_POS(p) undeclared variable
  #1
Member
 
Sarah
Join Date: Apr 2010
Location: Munich
Posts: 30
Rep Power: 16
spring is on a distinguished road
Hi,

I have a problem with the variable P_POS(p). When interpreting my UDF (I don't understnad any of the errors when compiling my UDF) I always get this error:
P_POS: undeclared variable.

I don't have this problem with P_VEL(p), and there are no problems when I remove the line with P_POS. I have an ansys fluent version 12.1 running under linux and windows and I get the same error when interpreting my UDF in both operating systems. I looked into the dpm.h (windows) file and there P_POS was defined like this : #define P_POS(p)((p)->state.pos) but as I said, it still shows me an error. I don't know what else to do and I really hope that someone can help me.
Here is my code:
Thanks,
spring
mohammad1008 likes this.

Last edited by spring; August 2, 2010 at 08:07.
spring is offline   Reply With Quote

Old   July 22, 2010, 15:51
Default
  #2
Senior Member
 
Chris
Join Date: Jul 2009
Location: Ohio, USA
Posts: 169
Rep Power: 16
Chris D is on a distinguished road
What errors do you get when you try to compile it?
Chris D is offline   Reply With Quote

Old   July 22, 2010, 17:04
Default
  #3
Member
 
Allan Walsh
Join Date: Mar 2009
Posts: 56
Rep Power: 17
Allan Walsh is on a distinguished road
I have used P_POS(p) without any problems in V12.1 of Windows Fluent.
As per one of the examples in the UDF tutorial, I have included the following in the variable declaration part of the code when interfacing particle and cell data:

cell_t c = RP_CELL(&p->cCell); /* Get Cell and Thread from */
Thread *t_cl = RP_THREAD(&p->cCell); /* Particle Structure */

Perhaps this might be needed in your implementation?
Allan Walsh is offline   Reply With Quote

Old   July 23, 2010, 05:07
Default
  #4
Member
 
Sarah
Join Date: Apr 2010
Location: Munich
Posts: 30
Rep Power: 16
spring is on a distinguished road
First of all thank you very much for trying to help me, I really appreciate that!
To be honest I only tryed to compile my UDF in linux, because I am working all the time in linux and I have 8 times more GB of RAM in linux than in windows. The compiler in linux is the standard GNU C/C++ compiler.


@ Allen
Ok I will try it your way.

best regards,
spring

Last edited by spring; August 2, 2010 at 08:10.
spring is offline   Reply With Quote

Old   July 23, 2010, 13:40
Default
  #5
Member
 
Sarah
Join Date: Apr 2010
Location: Munich
Posts: 30
Rep Power: 16
spring is on a distinguished road
Hey,

after I copied udf.h into my working folder and compiled my UDF (only in linux) and there weren't any error messages .


And I also was able to hook my UDF in the right place. Does this mean that the compilation was succesful? I ask, because I get a FATAL ERROR :

Error: fluent.12.1.2 received a fatal signal (SEGMENTATION VIOLATION).
Error Object: #f

when I want to start the discrete particle model simulation. In the (long, that's why I wont post it) message it's said that the error is due to my UDF. Any ideas.

regards,
spring

Last edited by spring; August 2, 2010 at 08:09.
spring is offline   Reply With Quote

Old   March 11, 2012, 01:01
Default P_POS(p) undeclared variable
  #6
New Member
 
mohammad taheri
Join Date: Mar 2012
Posts: 2
Rep Power: 0
mohammad1008 is on a distinguished road
Hi
I have the same problem. Did you find the solution?
I want to add a body forces fx=ax and fy=by to DPM model. The code I have written is:

/* UDF for computing the magnetic force on a charged particle */

# include "udf.h"


DEFINE_DPM_BODY_FORCE(particle_body_force,p,i)
{

double a=0.01;
double b=-0.001;

double x;
double y;

real source;
x=P_POS(p)[0];
y=P_POS(p)[1];


if(i==0) source =a*x;
else if(i==1) source =b*y;

/* an acceleration should be returned */
return (source/P_MASS(p));

}
and the error is:P_POS: undeclared variable


I would be grateful if you help me.

Quote:
Originally Posted by spring View Post
Hi,

I have a problem with the variable P_POS(p). When interpreting my UDF (I don't understnad any of the errors when compiling my UDF) I always get this error:
P_POS: undeclared variable.

I don't have this problem with P_VEL(p), and there are no problems when I remove the line with P_POS. I have an ansys fluent version 12.1 running under linux and windows and I get the same error when interpreting my UDF in both operating systems. I looked into the dpm.h (windows) file and there P_POS was defined like this : #define P_POS(p)((p)->state.pos) but as I said, it still shows me an error. I don't know what else to do and I really hope that someone can help me.
Here is my code:
Thanks,
spring
mldmrz likes this.
mohammad1008 is offline   Reply With Quote

Old   March 8, 2014, 05:47
Default
  #7
New Member
 
Select One
Join Date: Mar 2014
Posts: 2
Rep Power: 0
SSOHEIL is on a distinguished road
It may help if you declare P_POS as:

double P_POS[3];

3 for a 3D or 2 for a 2D case.

Regards
SSOHEIL is offline   Reply With Quote

Reply


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
undeclared variable ramintakhti Fluent UDF and Scheme Programming 5 March 16, 2011 18:37
error in COMSOL:'ERROR:6164 Duplicate Variable' bhushas COMSOL 1 May 30, 2008 04:35
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 04:27
UDF compilation problem -- "undeclared variable" Henrik Ström FLUENT 1 September 21, 2005 05:25
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 20:09


All times are GMT -4. The time now is 08:04.