CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF- assigning viscocity with respect to position (http://www.cfd-online.com/Forums/fluent/49602-udf-assigning-viscocity-respect-position.html)

Nikhil Dani October 23, 2008 14:02

UDF- assigning viscocity with respect to position
 
Dear all,

I am a final year student at IIT Madras. I am trying to model a single phase flow through an annular region. The specifications of the tube are- OD- 12mm, ID-6.6mm (xz plane), y=0 to 12mm. I wish to assign the viscocity of my fluid as mu=100 for certain nodes, and mu=0.1 otherwise.

This is the udf code I wrote.

************************************************** ********************

#include "udf.h"

DEFINE_PROPERTY(visc,c,d)

{

real mu;

Thread *t;

real x[ND_ND];

C_CENTROID(x,c,t);

if(sqrt((pow(x[0]-0.0052,2.)+pow(x[1]-0.050,2.)+pow(x[2]-0,2.)))<0.002)

mu= 100.0;

else

mu=0.1;

return mu;

}

************************************************** ********************

This code gives me an error.

Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error.

2. Save case/data under new name.

3. Exit program and restart to continue.

4. Report error to your distributor.

Error Object: ()

************************************************** ********************

Even if I use the same code as above, and give the command :

if(sqrt((pow(x[0]-0.0052,2.)+pow(x[1]-0.050,2.)+pow(x[2]-0,2.)))<0.002)

mu= 0.1;

else

mu=0.1;

I again get the same error. Which means that the error is not in assigning viscocity with position, but in the if clause I have used.

I would be most grateful for the help I could recieve.

Regards.


CDE October 23, 2008 21:15

Re: UDF- assigning viscocity with respect to posit
 
try this:

#include "udf.h"

DEFINE_PROPERTY(visc,c,t)

{

real mu;

real x[ND_ND];

C_CENTROID(x,c,t);

if(sqrt((pow(x[0]-0.0052,2.)+pow(x[1]-0.050,2.)+pow(x[2]-0,2.)))<0.002)

mu= 100.0;

else

mu=0.1;

return mu;

}

Nikhil Dani October 24, 2008 10:07

Re: UDF- assigning viscocity with respect to posit
 
Thanks a ton!! It worked :)


All times are GMT -4. The time now is 03:52.