|
[Sponsors] |
July 22, 2010, 10:58 |
P_POS(p) undeclared variable
|
#1 |
Member
Sarah
Join Date: Apr 2010
Location: Munich
Posts: 30
Rep Power: 16 |
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 Last edited by spring; August 2, 2010 at 09:07. |
|
July 22, 2010, 16:51 |
|
#2 |
Senior Member
Chris
Join Date: Jul 2009
Location: Ohio, USA
Posts: 169
Rep Power: 17 |
What errors do you get when you try to compile it?
|
|
July 22, 2010, 18:04 |
|
#3 |
Member
Allan Walsh
Join Date: Mar 2009
Posts: 56
Rep Power: 17 |
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? |
|
July 23, 2010, 06:07 |
|
#4 |
Member
Sarah
Join Date: Apr 2010
Location: Munich
Posts: 30
Rep Power: 16 |
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 09:10. |
|
July 23, 2010, 14:40 |
|
#5 |
Member
Sarah
Join Date: Apr 2010
Location: Munich
Posts: 30
Rep Power: 16 |
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 09:09. |
|
March 11, 2012, 02:01 |
P_POS(p) undeclared variable
|
#6 | |
New Member
mohammad taheri
Join Date: Mar 2012
Posts: 2
Rep Power: 0 |
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:
|
||
March 8, 2014, 06:47 |
|
#7 |
New Member
Select One
Join Date: Mar 2014
Posts: 2
Rep Power: 0 |
It may help if you declare P_POS as:
double P_POS[3]; 3 for a 3D or 2 for a 2D case. Regards |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
undeclared variable | ramintakhti | Fluent UDF and Scheme Programming | 5 | March 16, 2011 19:37 |
error in COMSOL:'ERROR:6164 Duplicate Variable' | bhushas | COMSOL | 1 | May 30, 2008 05:35 |
Env variable not set | gruber2 | OpenFOAM Installation | 5 | December 30, 2005 05:27 |
UDF compilation problem -- "undeclared variable" | Henrik Ström | FLUENT | 1 | September 21, 2005 06:25 |
Replace periodic by inlet-outlet pair | lego | CFX | 3 | November 5, 2002 21:09 |