CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   P_POS Undeclared Variable Error (

osuguy October 24, 2013 15:51

P_POS Undeclared Variable Error
Hey Everyone,

I have this simple code below I am using to try to get a feel for body force modeling. I am having trouble compiling the code, as it comes up with an undeclared variable error when looking at the P_POS macros in the if statements.

#include "udf.h"

real bforce=0;

if (P_POS(p)[0]>-.01 && P_POS(p)[0]<.01 && P_POS(p)[1]>.03 && i==0)
{ bforce=2;
if (P_POS(p)[0]>-.01 && P_POS(p)[0]<.01 && P_POS(p)[1]>.03 && i==1)
{ bforce=1;

return bforce;

Any help as to why this is happening or ways to fix it would be greatly appreciated.


SSOHEIL March 8, 2014 06:38


Try to include dpm.h and declare P_POS as:
#include <dpm.h>
double P_POS[3]; //3 for a 3D or 2 for a 2D case


All times are GMT -4. The time now is 09:36.