CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF Temperature boundaries Condition (https://www.cfd-online.com/Forums/fluent-udf/104854-udf-temperature-boundaries-condition.html)

sylvix48 July 17, 2012 07:50

UDF Temperature boundary Conditions
 
1 Attachment(s)
I'm trying to set a variable temperature as boundary condition on the exterior surface of a cylinder. I work in 3D and I've done the attached udf. It is well compiled under Fluent but there is no fluctuation of temperature along the tube. In my case the Temperature should change on the Z axis but in the simulation it seems that it changes on the x axis. Could you tell my if my UDF is OK and why it doesn't work ?

Thanks

Here's the code :

#include"udf.h"

/* profile for temperature */

DEFINE_PROFILE(z_temperature,t,i)

{
real z[ND_ND];
real y;
face_t f;

begin_f_loop(f,t)
{
F_CENTROID(z,f,t);
y=z[0];


F_PROFILE(f,t,i) =4.6706*10*10*10*10*10*10*y*y*y*y*y+2.3199*10*10*1 0*10*10*10*y*y*y*y-85471*y*y*y-72106*y*y-437.51*y+1722.5;
}
end_f_loop(f,t)


}

flotus1 July 17, 2012 11:06

z[0] reads the x-coordinate. No wonder your profile changes with x.

use z[2] instead.

sylvix48 July 18, 2012 03:01

Thanks a lot, it works !

I'm beginner in the UDF coding, I don't know all the stuff about it :)

mila_oliv July 20, 2012 12:26

I'm also new at udf and I want to stabilish simple boundary conditions.

I'm trying to implement stream function to compare my result with fluent's result.

On the cavity walls, Velocity is zero. Do I have to mention this or when I simulate I set this on fluent?

Look what I've done:

Quote:

#include "udf.h"
#include "mem.h"


DEFINE_SOURCE(funcaocorrente,c,t,ds,eqn)
{

real NV_VEC(psi);
real NV_VEC(vxdy);
real source;
int n,m,deltay;
cell_t c;
Thread *t;

/* the following are the boudary conditions that I don't know if I need to write. 1 is the starting point and e the ending point of the mesh*/
psi[i][1]=0;
psi[i][e]=0;
psi[1][j]=0;
psi[e][j]=0;

n=C_NNODES(c,t);
e=n^0.5;
m=e-1;
deltay=1/m; /*mesh size: mXm and cavity size: 1 meter*/
vxdy=NV_S(C_U(c,t),*=,deltay);
source=NV_V(psi,+=,vxdy); /* psi[i][j+1]=psi[i][j]+(Vx*delta y) or stream function definition*/
dS[eqn]=C_U(c,t);
return source;

}


All times are GMT -4. The time now is 21:29.