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/)
-   -   Thermal conductivity UDF (https://www.cfd-online.com/Forums/fluent-udf/97803-thermal-conductivity-udf.html)

jack.s February 25, 2012 15:28

Thermal conductivity UDF
 
Hi friends...
i want to define thermal conductivity of fluid that varies with temperature and position. in other words i want to use this formula:
k= 3*T^2+6*y
that T is temperature and y is position in y-direction.
I wrote the following UDF and run the case but when i compared this result with constant thermal conductivity it has no effect in my results.

#include "udf.h"

DEFINE_PROPERTY(knew,c,t)
{
real ktc;
real y;
real temp = C_T(c,t);
ktc = (3. * pow (temp,2.)) + (6. *y);
return ktc;
}

can any body help me???

Sixkillers February 26, 2012 03:41

Well in your code variable "y" isn't initialized, so I guess that is the problem. Here is an quick fix:

PHP Code:

DEFINE_PROPERTY(knew,c,t)
{
  
real ktc;
  
real pos[ND_ND];
  
real y;
  
  
C_CENTROID(pos,c,t);
  
pos[1];
  
real temp C_T(c,t);
  
ktc = (3. pow (temp,2.)) + (6. y);
  return 
ktc;



jack.s February 26, 2012 13:58

Quote:

Originally Posted by Sixkillers (Post 346322)
Well in your code variable "y" isn't initialized, so I guess that is the problem. Here is an quick fix:

PHP Code:

DEFINE_PROPERTY(knew,c,t)
{
  
real ktc;
  
real pos[ND_ND];
  
real y;
 
  
C_CENTROID(pos,c,t);
  
pos[1];
  
real temp C_T(c,t);
  
ktc = (3. pow (temp,2.)) + (6. y);
  return 
ktc;



Thanks a lot Sixkillers for your answer...
i use this UDF and my results changed!!! But my result is not satisfactory.
i have some other question:
i want to use this UDF in 2d modeling of pipe, and use this UDF to change thermal conductivity of fluid in each section of pipe from inlet to outlet with temperature and position of each point in every section.
can i use this UDF in axisemmetric model with y or i should replace y with r???
if yes, can i replace y with r in the previous UDF???

And if i want to use this formula :
k=3*T+ \partial(U)/\partial r
how can i change previous UDF ???

Sixkillers February 28, 2012 16:08

I think that you can use this code without any modification for an axisymmetric problem, if a symmetry axis is parallel with x axis. If it is parallel with y axis than you will have to change
PHP Code:

pos[1]; 

to
PHP Code:

pos[0]; 

To obtain a derivation of velocity according to spatial variable, you can use methods: C_U_G, C_V_G (take a look to this chapter).

Once again it depends, which spatial variable represents radius. Finally I would like to say, that I haven't test it and UDF manual isn't much speaking about axisymmetric problems in general. However, this is the way how I expect it should work :)

jack.s February 29, 2012 11:57

Quote:

Originally Posted by Sixkillers (Post 346760)
I think that you can use this code without any modification for an axisymmetric problem, if a symmetry axis is parallel with x axis. If it is parallel with y axis than you will have to change
PHP Code:

pos[1]; 

to
PHP Code:

pos[0]; 

To obtain a derivation of velocity according to spatial variable, you can use methods: C_U_G, C_V_G (take a look to this chapter).

Once again it depends, which spatial variable represents radius. Finally I would like to say, that I haven't test it and UDF manual isn't much speaking about axisymmetric problems in general. However, this is the way how I expect it should work :)

Thank you very much...


All times are GMT -4. The time now is 17:59.