## Fluids

#### HOW TO WRITE UDF FOR VISCOSITY FUNCTION VARIES WITH DISTANCE FROM CENTER

• DEBA
Subscriber

SIR I HAVE A CONSIDERED  50 MM RADIUS TUBE. LENGTH IS 5 CM . IN THIS TUBE VISCOCITY IS DIFFERENT WITH RADIUS . FOR RADIUS 0 CM TO 30 CM IT IS  GOVERNED BY ONE LAW THAT FUNCTION I HAVE WRITTEN IS mu_a=pow((pow(tau_inf/gamma,0..

AND FOR RADIUS 30 TO 50 CM IT IS CONSTANT VALUE , 4.8

HOW TO WRITE UDF AS A FUNCTION OF RADIUS FROM CENTER

I HAVE ATTACED PICTURE

• Karthik R

Hello,

Please have a look at the macro DEFINE_PROPERTY in the Fluent Customization manual. There are a lot of examples in the manual. The best way to modify a UDF is to use an existing one and modify it to your needs. I'd definitely start with the Fluent Customization manual.

I hope this helps.

Best Regards,

Karthik

• DEBA
Subscriber

how i define radius 50 in udf?

below programme format is ok?

{

mu_a=pow((pow(tau_inf/gamma,0..

else

mu_a=4.8

}

return mu_a

• DrAmine
Ansys Employee

You require a UDF Training.

In UDF you cannot access cylindrical coordinates you need to build that on your own. The radius in your case is the Y-coordinate. If you need rather the wall distance than you need to know that this is not available in laminar cases and that you require a way to get the variable in UDF (via Poisson equation or by just enabling turbulence and setting the zone to laminar)

• Rob
Ansys Employee

Have a look in the boundary profile UDF example in the documentation, you'll find an example of dimension checking. From there you need to work out the logic, ie how does the viscosity change with the radius.  Once you understand all of that, covert your plan into code and write the UDF.

Note, the community is here to help you achieve your modelling goals. It is not here to do it for you: what would the point be in that?

• DEBA
Subscriber

SIR MY VISCOSITY LAW VARIES FROM AXIS OR CENTER .PLEASE GIVE ME A HINT HOW TO DO IT

• DEBA
Subscriber

SIR MY VISCOSITY CHANGES WITH Y DIRECTION FRON AXIS . PLESE HELP ME HOW TO DO THIS UDF

• DrAmine
Ansys Employee

As your axis lies on y=0 you can just use  coordinate as your dependent variable. Just go through the customization manual and pick up some examples where you might start. You will need an if else condition in you DEFINE PROPERTY UDF.

```if (y < height)
Visc = blabla;
else
Visc = tralala;
```