CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Udf for heat source (https://www.cfd-online.com/Forums/fluent/29796-udf-heat-source.html)

Thomas May 23, 2002 10:40

Udf for heat source
 
A porous medium is included in a domain. I want to define a heat source to the porous medium which will be a function of the temperature difference between the porous temperature and the domain temperature. Thanks for any help, Thomas

Keil May 23, 2002 21:08

Re: Udf for heat source
 
It's possible. The DEFINE_SOURCE macro is available for your problem.

Keil

Greg Perkins May 23, 2002 22:52

Re: Udf for heat source
 
If you're using the standard porous media model in Fluent 5 or 6 you won't be able to model interphase heat transfer or have a model that assumes non-equilibrium between the two phases. Fluent assumes, a single energy equation for solid and fluid as described in the manual.

To model a porous media without thermal equilibirum you need to use udfs/udss...

I have presented some code for this in 2000 and 2001. Its also in the udf repository....search the archives for the posts/code.

Greg

Laika May 30, 2002 04:12

Re: Udf for heat source
 
Interesting,

where to find this udf repository?

thanks in advance,

Laika, still orbiting

Greg Perkins May 30, 2002 04:36

Re: Udf for heat source
 
Repository at

ftp://ftp.cfd-online.com/fluent

and my code at

ftp://ftp.cfd-online.com/fluent/udf_scalar_dos.c

Greg

M.H.Sajid June 1, 2014 02:27

Dear Greg Perkin,
This is to let you know that I am working with heat transfer in porous media and have found your replies on this site very helpful. I wanted to download "udf_scalar_dos.c" but unable to download. I am using my user name and password of this site to download but it showing unable to login. Please let me know how to download it, or if possible,please email the file to me.

Thanking you

Sajid

zhebenshu1912 June 9, 2015 10:55

(define_source) heat generation changs with location
 
hello everyone!
I write a udf for heat generation with different location(xyz);),but only a part of fluid has heat generation:confused:.

project:a solid (0.08X0.08X0.1 to xyz) with 2 cylinder(r=0.01),cylinder is fluid with heat generation.:)

the code:#include "udf.h"
DEFINE_SOURCE(heat_flux, cell, t, dS, eqn)
{
real a, b, c;
real x[2] = { 0.02, -0.02 }, y[2] = { 0,0 }; //x、y source location
real p[8] = { 0.025, 500000000, 0.025, 500000000, 0.075, 500000000, 0.075, 500000000 };//0.025、0.075 is Z location,source value follows.
real pos[ND_ND];
real source=0;
int i, j = 0;

C_CENTROID(pos, cell, t);
a = pos[0]; //abc acquire xyz
b = pos[1];
c = pos[2];


if ((c >= p[0] - 0.025) && (c <= p[0] + 0.025)) //judge Z location
{
i=0;
while(i<2){
if ((a <= x[i] + 0.01 && a >= x[i] - 0.01) && (b <= y[i] + 0.01 && b >= y[i] - 0.01)) //judge xy,if meeting the range,give source right value
{source = p[0 + i+1];

dS[eqn] = 0;
i=2;}
i=i+1;
}

}

else
if ((c >= p[4] - 0.025) && (c <= p[4] + 0.025))
{
i=0;
while(i<2){
if ((a <= x[i] + 0.01 && a >= x[i] - 0.01) && (b <= y[i] + 0.01 && b >= y[i] - 0.01))
{source = p[4+2*i+1];

dS[eqn] = 0;
i=2;}
i=i+1;
}
}
else
{ source=0;
dS[eqn]=0;
}

return source;
}

the result shows the right cylinder has heat generation:) ,but the other one has zero.:(

thanks for your kindness.contact me:956400837@qq.com

zhebenshu1912 June 9, 2015 11:00

(define_source) heat generation changs with location
 
hello everyone!
I write a udf for heat generation with different location(xyz);),but only a part of fluid has heat generation:confused:.

project:a solid (0.08X0.08X0.1 to xyz) with 2 cylinder(r=0.01),cylinder is fluid with heat generation.:)

the code:#include "udf.h"
DEFINE_SOURCE(heat_flux, cell, t, dS, eqn)
{
real a, b, c;
real x[2] = { 0.02, -0.02 }, y[2] = { 0,0 }; //x、y source location
real p[8] = { 0.025, 500000000, 0.025, 500000000, 0.075, 500000000, 0.075, 500000000 };//0.025、0.075 is Z location,source value follows.
real pos[ND_ND];
real source=0;
int i, j = 0;

C_CENTROID(pos, cell, t);
a = pos[0]; //abc acquire xyz
b = pos[1];
c = pos[2];


if ((c >= p[0] - 0.025) && (c <= p[0] + 0.025)) //judge Z location
{
i=0;
while(i<2){
if ((a <= x[i] + 0.01 && a >= x[i] - 0.01) && (b <= y[i] + 0.01 && b >= y[i] - 0.01)) //judge xy,if meeting the range,give source right value
{source = p[0 + i+1];

dS[eqn] = 0;
i=2;}
i=i+1;
}

}

else
if ((c >= p[4] - 0.025) && (c <= p[4] + 0.025))
{
i=0;
while(i<2){
if ((a <= x[i] + 0.01 && a >= x[i] - 0.01) && (b <= y[i] + 0.01 && b >= y[i] - 0.01))
{source = p[4+2*i+1];

dS[eqn] = 0;
i=2;}
i=i+1;
}
}
else
{ source=0;
dS[eqn]=0;
}

return source;
}

the result shows the right cylinder has heat generation:) ,but the other one has zero.:(

thanks for your kindness.


All times are GMT -4. The time now is 20:37.