CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   C_CENTROID is not returning the cell center coordinates (https://www.cfd-online.com/Forums/fluent-udf/138926-c_centroid-not-returning-cell-center-coordinates.html)

jyothsna k July 14, 2014 08:52

C_CENTROID is not returning the cell center coordinates
 
My code is as below:
DEFINE_SOURCE(x_src,c,t,dS,eqn)
{
real source;
real x,y,z,r,h;
real xc[ND_ND];

C_CENTROID(xc,c,t);
x = xc[0];y=xc[1];z=xc[2];
r=sqrt(x*x+y*y); h=y/r;
t1=mu0*J;
if (z>=zl && z<=zu && r>=ri && r<=ro)
{source = -t1*h ;}
else
{source=0;}

C_UDMI(c,t,8) =x;
return source;
}

mu0, J, ri,ro have been defined as constants.
When i check the memory numbered 8 there are no values of x there. I have tried to incorporate a similar code in ADJUST. even there i'm facing the same problem. I have used this code before for another model with no problems. I'm unable to find the cause.
Thanks in advance

pakk July 14, 2014 16:49

Sorry if this is a silly question, but did you remember to attach the udf? Are you sure that it is actually run by Fluent?

jyothsna k July 14, 2014 22:53

Thank you for your response. I have attached all my UDFs and i have been using only fluent.


All times are GMT -4. The time now is 12:49.