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

UDF- assigning viscocity with respect to position

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 23, 2008, 14:02
Default UDF- assigning viscocity with respect to position
  #1
Nikhil Dani
Guest
 
Posts: n/a
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.

  Reply With Quote

Old   October 23, 2008, 21:15
Default Re: UDF- assigning viscocity with respect to posit
  #2
CDE
Guest
 
Posts: n/a
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;

}
  Reply With Quote

Old   October 24, 2008, 10:07
Default Re: UDF- assigning viscocity with respect to posit
  #3
Nikhil Dani
Guest
 
Posts: n/a
Thanks a ton!! It worked
  Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Artificial viscocity jj Main CFD Forum 25 October 21, 2006 14:40
do it necessary to give viscocity expression? joseph CFX 1 May 6, 2006 09:56
tracking data with respect to time tucker FLUENT 2 December 20, 2005 09:39
Variable input with respect to time Prafull Gandhi CFX 2 September 4, 2005 08:36
How to set a boundary condition as a function respect to time chnrdu OpenFOAM Running, Solving & CFD 2 June 17, 2005 04:18


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