CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Altering properties of fluid within the domain (

Nikhil Dani December 10, 2008 07:11

Altering properties of fluid within the domain
Hi all

I am a final year student at IIT Madras.

Suppose I have a domain in which I have fluid flow. Now, I define a spherical surface within the domain, using the surface>>quadratic drop down menu.

Now, I wish to alter, and fix the properties of the fluid within this surface. For instance, if the fluid density is 1000 kg/m3 in the domain, I want it to be 5000 kg/m3 within the surface. Is this possible?

Thanking you all in advance.

mange December 11, 2008 11:03

Re: Altering properties of fluid within the domain
i do not know the specifics of your problem or what you want to model. I am therefore not sure that this would be the way to do it but it is possible to make a UDF function and then specify density as function of coordinates. I am not sure what that will say for the physics of the problem though.

Nikhil Dani December 11, 2008 13:29

Re: Altering properties of fluid within the domain
Thanks a lot Mange.

I have indeed written a UDF in the following fashion to attain the result.


#include "udf.h"



real rho;

real x[ND_ND];


if(sqrt((pow(x[0]-(0.001707),2.)+pow(x[1]-(0.192),2.)+pow(x[2]-(0.004513),2.)))<0.0005) rho=5000; else


return rho; }


The issue with this UDF is that it works at some points, and at some other points it does not. For instance, I wanted this condition at 16 zones (in this case, 16 spheres of radius 0.0005m), but it was activated only at two places. Does mesh size have something to do with it? Or there could be several reasons why this does not work.

mange December 12, 2008 05:26

Re: Altering properties of fluid within the domain
If the scale of your problem admits placement of your spheres (i.e. the coordinates you prescribe as centers for the spheres are inside the domain) you should get all your spheres activated.

Of course your cell size will influence. for instance if you place a sphere at the face of a cell and your cell size is bigger then the radius, no cells would be activated.

All times are GMT -4. The time now is 23:51.