CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

How to apply own heat transfer coefficients by UDF?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 12, 2017, 06:45
Default How to apply own heat transfer coefficients by UDF?
  #1
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
Hello everyone,

I have made some measurements concerning the heat transfer coefficient and i would like to apply these values into the model instead of using the ones calculated by Fluent.
Unfortunately, there is no example code on applying HTC by UDF in the manual. But I found some codes here in the forum I am trying to apply.
For practise, I would first like to start with a function that configures an HTC of 10000 at the whole interface between solid and fluid. I use this UDF for that:


DEFINE_PROFILE(pressure_profile,t,i) {

face_t f; double htc;

begin_f_loop(f,t)

{

htc=100000(F_T(f,t), 2.0);

F_PROFILE(f,t,i) = htc;

} end_f_loop(f,t) }


Unfortunately this UDF does not work. Can someone explain me where the problem is? Besides that, can someone tell me how I actuall hook the UDF?


Best regards
h0rst
h0rst is offline   Reply With Quote

Old   March 12, 2017, 15:20
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Code:
htc=100000(F_T(f,t), 2.0);
What are you trying to do with this line? It is wrong, but I don't see the intention so it is hard to improve...
pakk is offline   Reply With Quote

Old   March 15, 2017, 01:53
Default
  #3
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
Thank you for your reply.

I looked deeper into the functions and found out, that define_profile is not right for me.
Now I have programmed a UDF where I can actually change the heat transfer coefficient with the following source code:



real h ; // heat transfer coefficient (W/m^2 C)

DEFINE_ADJUST(htc_adjust, domain)
{
// Define the heat transfer coefficient.

h = 32500;
}

DEFINE_HEAT_FLUX(heat_flux, f, t, c0, t0, cid, cir)
{

cid[0] = 0;
cid[1] = h;
cid[2] = h;
cid[3] = 0;
}



I build a very simple model and tried to work with these values. it is a rectangular tube flowed through by water. An inhomogenous power density is applied on the tube. Attached is the picture of the temperature distribution.
I use this simple model for testing new things with fluent


So, first I had a look on the results by looking on

- Wall fluxes --> Wall func. heat transfer coefficient

The intermediate value is about 22.000.


So, then I implemented the UDF above and expected to get similar results if I would have applied an h of 22.000 as well. Actually, the temperature was higher so I tried to find the right h until the values fit to the ones calculated when not using UDF.

I need to increase h to 32.500 to have similar temperatures in the model.


Does someone know why it behaves like that?



Best regards
h0rst
Attached Images
File Type: png simple-fluent-model.png (23.2 KB, 30 views)
h0rst is offline   Reply With Quote

Old   March 17, 2017, 08:18
Default
  #4
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
I applyed the process to my model and found out that when I increase the HTC by factor 2, I get quite good values .

But I have no idea where this factor comes from.

Fluent calculates the heat flux using the cell information next to the wall. I would like Fluent to calculate by using the reference temperature (27,9 °C) but it gives divergence failures if I apply the following source code:

cid[0] = h*(F_T(f,t)-301.05);
cid[1] = 0;
cid[2] = 0;
cid[3] = 0;


Does someone has an idea or proposal about this issue?
h0rst is offline   Reply With Quote

Old   March 17, 2017, 08:35
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I don't know about the factor 2, but your UDF can be much simpler:
Code:
DEFINE_HEAT_FLUX(heat_flux, f, t, c0, t0, cid, cir)
{
real h = 32500;

cid[0] = 0;
cid[1] = h;
cid[2] = h;
cid[3] = 0;
}
Unless you also use h in different UDFs that you did not show, it makes no sense to make it global and use DEFINE_ADJUST to set it...
pakk is offline   Reply With Quote

Old   March 18, 2017, 14:40
Default
  #6
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
Hello pakk,

thank your for the hint. I changed it and this simplifies my UDF :-)

The factor 2 seems to be by random. As far as I understand, fluent calculates the HTC between cell temperature and wall temperature. But since my flow consists of many cells per wall element, it only considers the cell next to the wall which is of course the hottest.

The mean water temperature is 303.05 k (29.9 °C) between inlet and outlet and I would like to implement that instead of the individual cell temperatures.


I changed the UDF at one point by setting

cid[1]=C_T(c0,t0)*h/303.05;

This actually gives me good resutls.
But actually I would expect that the cid should be

cid[1]=303.05*h/C_T(c0,t0);
(because the formula is: qid = cid[0] + cid[1]*C_T(c0,t0) - cid[2]*F_T(f,t) - cid[3]*pow(F_T(f,t),4))

but this leads to extreme bad results (temperatures 30 times higher of the solid surface).



Is my approach to calculate the HTC at the mean water temperature reasonable and the implementation?

Why does the formula cid[1]=303.05*h/C_T(c0,t0); does not work out at all?


Best regards
h0rst
h0rst is offline   Reply With Quote

Old   March 27, 2017, 13:32
Default
  #7
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
I've faced up again with this project and checked the surface temperature with the wall heat transfer coefficient used by Fluent. I applyed this value as input value for

cid[1] and cid[2]

and multiplicated each value with factor 2:

cid[1]=2*h //h=mean average value of wall heat transfer coefficient
cid[2]=2*h

The mean-average temperature difference of the edited surface with this new h compared to the model where Fluent computes h is about 0,3 %. This seems to be unlikely then that h is by random to be multiplicated by 2. But still I have no idea where this factor comes from.


Best regards
h0rst
h0rst is offline   Reply With Quote

Old   March 28, 2017, 03:42
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I think I see the problem...

Fluent calculates the heat transfer from the temperature of the wall and the temperature of the fluid close to the wall.

You want to calculate the heat transfer from the temperature of the wall and the temperature far away from the wall.


These are two different things, so it is not surprising that they give a different answer. Moreover: you are using the wrong one. Physically, the heat transfer is determined by local properties, not by properties far away.

If you want to impose a constant heat flux, apply a constant heat flux. If you want to let Fluent calculate the heat flux according to local temperatures, do that. But choose, don't try to do both at the same time, that does not make sense.
pakk is offline   Reply With Quote

Old   March 28, 2017, 03:51
Default
  #9
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
Hello pakk,

thank you for your answer. I also thought about that issue.

I want to apply a constant h but the heat flux shall be calculated by Fluent.

You wrote that Fluent uses the cell temperature at the wall whereas I use the reference temperature.

How can I change the UDF that Fluent uses the reference temperature instead of the cell temperatures at the wall when I apply the constant h?


Best regards
h0rst
h0rst is offline   Reply With Quote

Old   March 28, 2017, 04:02
Default
  #10
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
"the heat flux shall be calculated by Fluent."

How? Which equation do you want Fluent to use?
pakk is offline   Reply With Quote

Old   March 28, 2017, 04:08
Default
  #11
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
With this formular:

qid = cid[0] + cid[1]*C_T(c0,t0) - cid[2]*F_T(f,t) - cid[3]*pow(F_T(f,t),4)

I specify

cid[1]= h*T_Ref/C_T(c0,t0)

and

cid[2]= h

But this also does not work.


What also wonders me is that I extract the average wall function heat transfer coefficient (named it fluent_h) when I have calculated with Fluent. Then I put this value back into Fluent by

cid[1]= fluent_h
cid[2]= fluent_h

and the result is that the temperature is much higher.

if I choose

cid[1]= 2*fluent_h
cid[2]= 2*fluent_h

the temperature distribution is like as I haven't changed the cid values at all.
h0rst is offline   Reply With Quote

Old   March 28, 2017, 04:14
Default
  #12
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I see the programming code that you intent to use, but I was trying to ask something else: which equation (from physics) do you want Fluent to use?

[edit:] I ask this because I have the impression that you want to apply a constant heat flux, but you don't realize this yet.
pakk is offline   Reply With Quote

Old   March 28, 2017, 04:15
Default
  #13
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
I want Fluent to use the equation:


Q°= h*(T_Surface-T-Fluid)
h0rst is offline   Reply With Quote

Old   March 28, 2017, 04:17
Default
  #14
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
And which values do you want Fluent to use for T_Surface, and what for T_Fluid?
pakk is offline   Reply With Quote

Old   March 28, 2017, 04:19
Default
  #15
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
For T_Surface, it shall use the value that actually the wall has, so I would think F_T.

For T_Fluid, it shall use the mean Fluid temperature which is 27.9 °C.
h0rst is offline   Reply With Quote

Old   March 28, 2017, 04:21
Default
  #16
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Are you calculating the temperature of the solid wall? Or are you giving that to Fluent?
pakk is offline   Reply With Quote

Old   March 28, 2017, 04:23
Default
  #17
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
No I am giving that to Fluent. I also calculated an average value which is 47.3 °C but I am not applying that because it can vary quite much whereas the Fluid temperature does not change that much.
h0rst is offline   Reply With Quote

Old   March 28, 2017, 04:32
Default
  #18
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Q°= h*(T_Surface-T-Fluid)

You know h, you know T_Surface and you know T_fluid. So why don't you just calculate Q° yourself, and give that to Fluent?
pakk is offline   Reply With Quote

Old   March 28, 2017, 04:33
Default
  #19
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 10
h0rst is on a distinguished road
I want to try that. But how can i do this with UDF?
h0rst is offline   Reply With Quote

Old   March 28, 2017, 04:42
Default
  #20
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
You don't need a UDF for that.
pakk is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF for heat transfer coeff. in porous media parvaz747 FLUENT 0 November 16, 2016 13:35
UDF for compute heat transfer coefficient at end mcan FLUENT 1 October 31, 2016 06:27
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 07:28
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT subhankar_bhandari FLUENT 0 August 19, 2010 04:01
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT subhankar_bhandari Main CFD Forum 0 August 19, 2010 04:01


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