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, 05:45
Default How to apply own heat transfer coefficients by UDF?
  #1
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
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, 14:20
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
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, 00:53
Default
  #3
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
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, 24 views)
h0rst is offline   Reply With Quote

Old   March 17, 2017, 07:18
Default
  #4
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
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, 07:35
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
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, 13:40
Default
  #6
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
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, 12:32
Default
  #7
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
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, 02:42
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
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, 02:51
Default
  #9
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
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, 03:02
Default
  #10
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
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, 03:08
Default
  #11
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
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, 03:14
Default
  #12
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
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, 05:56
Default
  #13
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
h0rst is on a distinguished road
Okay, but why is there such a difference if I extract the mean-average wall temperature heat transfer coefficients from Fluent and then put it back in by using

cid[1]=h
cid[2]=h?


Shouldn't the result be nearly the same?


Best regards
h0rst
h0rst is offline   Reply With Quote

Old   March 28, 2017, 06:02
Default
  #14
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
If by 'nearly the same' you mean a difference smaller than 1%, I don't see any reason to think that that would be true.
pakk is offline   Reply With Quote

Old   March 28, 2017, 06:32
Default
  #15
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
h0rst is on a distinguished road
I've checked, it's not the same at all, temperature is very much higher if I apply cid[1] and cid[2] = h.

If i choose cid[1] and cid[2] = 2*h, then the temperature is almost the same (approximately 0,5 % difference).


Best regards
h0rst
h0rst is offline   Reply With Quote

Old   March 28, 2017, 06:39
Default
  #16
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
So there is no reason to suspect that these two different situations would give a similar result, the indeed your results show that they don't. Accept that, and move on.

I gave you my advice already.
pakk is offline   Reply With Quote

Old   March 28, 2017, 07:16
Default
  #17
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
h0rst is on a distinguished road
I find it a bit strange that these are two different situations.

I extract a value and put it as an input variable in without changing so i would expect the same result
h0rst is offline   Reply With Quote

Old   March 28, 2017, 08:56
Default
  #18
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
h0rst is on a distinguished road
Anyway, pakk, thank you very much for your time and effort
h0rst is offline   Reply With Quote

Old   March 28, 2017, 12:07
Default
  #19
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by h0rst View Post
I find it a bit strange that these are two different situations.

I extract a value and put it as an input variable in without changing so i would expect the same result
I have the feeling that we are talking about something different...
The two situations that I call different:

1. Calculate heat transfer using average temperatures.
2. Calculate heat transfer using local temperatures.

You agree that the local temperature is different than the average temperature, right?

You extract the heat transfer from situation 1, and use it in situation 2. I don't know why you would expect the same result.
pakk is offline   Reply With Quote

Old   March 28, 2017, 15:59
Default
  #20
Member
 
Join Date: Nov 2016
Posts: 73
Rep Power: 9
h0rst is on a distinguished road
I extract the wall function heat transfer that is created by fluent.

When I plot it, the value varies between 11000 and 15000. The average value is 13000. If I use this value for cid[1] and cid[2] I expect that the result is similar because 11000 and 15000 is not a very big range.
Instead, I need to use the value 26000 to get a very close temperature distribution.

Later on, I want to apply own values (about 15500) but as already this previous test show, setting cid[1] and cid[2] to 15500 creates far too high temperatures whereas cid[1] and cid[2] = 2*15500=31000 fits quite well.
h0rst 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 12:35
UDF for compute heat transfer coefficient at end mcan FLUENT 1 October 31, 2016 05:27
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT subhankar_bhandari FLUENT 0 August 19, 2010 03:01
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT subhankar_bhandari Main CFD Forum 0 August 19, 2010 03:01


All times are GMT -4. The time now is 11:07.