CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Geometrical dependent physical property (http://www.cfd-online.com/Forums/fluent/38339-geometrical-dependent-physical-property.html)

Jiri Novak October 22, 2005 13:04

Geometrical dependent physical property
 
Hi folks, i concern with modeling the 3D laminar flow of viscous media. Recently, I try to simulate the local source of bubbles in the liquid. I don't need to take into effect the momentum transfer but only have to specify the density decrease in the liquid media in bubbling region (function of geometry, bubble volume fraction and temperature in general). I would most likely not to split the model in Gambit into 2 regions but spcify the density - material property as a function of position, temperature and bubble volume fraction. My developed UDF doesn't work so far. Can anyone help?

#include udf.h

// LINEAR TEMPERATURE DENSITY DEPENDENCY ro = A + B*T

#define A 1300 // coef A

#define B -0.2 // coef B*T

// DEFINITION OF THE REGION COORDINATES IN WHICH BUBBLES TAKE PLACE

#define X1 0.24

#define X2 0.37

#define Y1 0.0

#define Y2 0.25

#define Z1 -0.5

#define Z2 0.5

// BUBBLE VOLUME FRACTION

#define BVF 0.25

DEFINE_PROPERTY (density,c,t,i)

{

cell_t c,

real xc[ND_ND];

real ro;

real T = C_T(c,t);

begin_c_loop(c,t)

{

C_CENTROID(xc,c,t)

if ((xc[0] > X1) && (xc[0]lessthan X2))

{

if ((xc[1]> Y1) && (xc[1]lessthan Y2))

{

if ((xc[2]> Z1) && (xc[2]lessthan Z2))

{

ro = (A + B*T)*(1 - BVF);

}}}//ro IN BUBBLE REGION

else

{

ro = (A + B*T);

}ro ELSEWHERE

} end_c_loop(c,t)

return ro;

}

for the web security reason i must use "lessthen" tag inspite of apropriate symbol here...

regards Jirka

RoM October 24, 2005 01:24

Re: Geometrical dependent physical property
 
Erase the loop. Fluent will call this udf for each cell so the loop is not neccessary.

RoM

Jiri Novak October 24, 2005 08:38

Re: Geometrical dependent physical property
 
I need to setup different density in diferent regions of model. I don't want to split the model in Gambit, becouse it's time demanding. I have an idea of geometricaly dependent density defined by UDF. However, this code doesn't work yet. Can anyone tell me why? Is it even possible to determine physical property by means of geometry in Fluent?

#include "udf.h"

DEFINE_PROPERTY(density,c,t,position) {

cell_t c;

real xc[ND_ND];

real ro;

real T = C_T(c,t);

C_CENTROID (xc,c,t);

if (xc[0]>=0.631 && xc[0]<= 1.262) {

ro = (1206.2 - 0.1245*T)*0.5; }

else {

ro = (1206.2 - 0.1245*T); }

return ro;

}


RoM October 24, 2005 09:39

Re: Geometrical dependent physical property
 
1. Dont redefine c inside your function since its passed by the solver.

2. The macro definition for DEFINE_PROPERTY is DEFINE_PROPERTY(name,c,t). The position statement is too much.

The correct udf should look like this


#include "udf.h"

DEFINE_PROPERTY(density,c,t)
{
real xc[ND_ND];
real ro;
real T = C_T(c,t);

C_CENTROID (xc,c,t);

if (xc[0]>=0.631 && xc[0]<= 1.262)
ro = (1206.2 - 0.1245*T)*0.5;
else
ro = (1206.2 - 0.1245*T);

return ro;
}



Also you should be aware, that this definition will cause some steep density gradients at the edges of you geometry which could lead to numerical instabilities.


RoM

Jiri Novak October 24, 2005 12:08

Re: Geometrical dependent physical property
 
Thanks You a lot, it's working now.

Well, it only requires knowledge from C langueage basic course which i unlucky haven't been attending.

Bye



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