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

Heat flux UDF boundary condition on a wall

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 22, 2020, 03:45
Default Heat flux UDF boundary condition on a wall
  #1
New Member
 
Join Date: Jun 2020
Posts: 15
Rep Power: 6
KsaMe is on a distinguished road
Hi everyone,

I'm trying to give a heat flux boundary condition to a wall, using the temperature of that wall. The geometry of the problem is attached in picture 1. Basically it is a cilindrical chamber with one entry and exit that allows a flow of gas and I want to give to the walls with red line a heatflux equal to the thermal conductivity of the wall (0.00025 W/mm2K) multiplied by the temperature difference of the wall and the exterior (ambient temperature 300 Kelvin). To rescue the value of the temperature of the wall I use the function F_t(f,t) because as far I know it gives the face temperature value of the cell adjacent to the wall. Then I wrote this UDF but it doesn't work.

#include "udf.h"

DEFINE_PROFILE(HeatFlux,t,i)
{
face_t f;
real T_W = F_T(f,t);

begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = 0.00025*(300-(T_W));
}
end_f_loop(f,t)
}

I couln't fix the error that appeared in the console (attached in pictures 2 and 3), so if anyone could help me I would really appreciate it .

Best Regard,

KsaMe
Attached Images
File Type: png Picture1.png (21.8 KB, 80 views)
File Type: png Picture2.png (29.0 KB, 66 views)
File Type: png Picture3.png (16.4 KB, 50 views)
KsaMe is offline   Reply With Quote

Old   June 22, 2020, 05:06
Default Heat Flux
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
The error is most likely not due to the code. Though the physics is wrong, but that is not apparent in the code, so, Fluent won't care.

Try to initialize the case first, then hook the UDF.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 22, 2020, 13:43
Default
  #3
New Member
 
Join Date: Jun 2020
Posts: 15
Rep Power: 6
KsaMe is on a distinguished road
Thanks for replying Vinerm!

I tried what you suggested but this time I got other error related to stabilizing the temperature (picture attached). And also I want to ask you what do you mean by "the physics is wrong" ??

I'm trying to solve this problem, and any solution I find will be posted.

Best regards,

KsaMe
Attached Images
File Type: png Error.png (27.3 KB, 38 views)
KsaMe is offline   Reply With Quote

Old   June 22, 2020, 14:04
Default Physics
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
The law you are applying as heat flux is essentially Newton's law of cooling, but the coefficient should be heat transfer coefficient and not thermal conductivity. If you want to use thermal conductivity, use temperature gradient and not its difference.

As far as the code is concerned, it does not case because it is quite possible that numerical values for the HTC and thermal conductivity are same. If the temperature of the wall is is very close to 300 K, then the heat flux will keep on oscillating, hence, the simulation may not stabilize.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 22, 2020, 17:13
Default
  #5
New Member
 
Join Date: Jun 2020
Posts: 15
Rep Power: 6
KsaMe is on a distinguished road
Sorry, I didn't explain it well. I forgot to mention that the copper plates are at 1200K, so the fluid near this plates is hotter than in other places inside the chamber and the temperature of the wall is the temperature of the fluid "touching" the wall. Then, to calculate the heat flux I used Fourier Law where the ratio between the thermal conductivity of the wall and its width is represented in the constant 0.00025(W/mm2K) putted into the equation. On the other hand to find the temperature difference I need to know only the temperature of the wall, because the exterior temperature is known (300K). In order to write the temperature of the wall I think the function F_T(f,t) would give it, but it doesn't and this is the problem.

I changed the code because I read in another forum that it's important to define F_T(f,t) inside the loop, so the new code is:

#include "udf.h"

DEFINE_PROFILE(heatflux_profile,t,i)
{
face_t f;
real x;
begin_f_loop(f,t)
{
x = F_t(f,t);
F_PROFILE(f,t,i) = 250*(300-x);
}
end_f_loop(f,t)
}

The constant 0.00025(W/mm2K) is now 250(W/m2K) because when you introduced the heatflux boundary condition this has to be in meters, not in mm.

Regards,

KsaMe
KsaMe is offline   Reply With Quote

Old   June 23, 2020, 04:24
Default Copper Plates
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
As far as copper plates are concerned, those don't appear to have an exterior. Those are fully engulfed by the fluid.

And the UDF you are applying is at the outer walls. So, copper plate is not even related to it. Furthermore, temperature of the fluid touching the wall is not same as that of the wall; that condition is reached only when whole of the fluid is at the same temperature as that of the wall. And you need to consider thickness of the plate, not the width (or may be you meant thickness when you mentioned width).

If you want to solve conduction across the thickness of the external wall, you don't need a UDF. Just provide the thickness to the wall under Wall Boundary Condition, select a material for the wall, and done.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 23, 2020, 13:52
Default
  #7
New Member
 
Join Date: Jun 2020
Posts: 15
Rep Power: 6
KsaMe is on a distinguished road
Dear Vinerm,

Thanks for your reply, I really appreciate your time and help.

I tried to just add the wall thickness and material of the wall in the boundary condition panel, but it also request the heat flux value due to conduction in the walls, which is exactly what I'm trying to know through the UDF to set the heatflux boundary condition and simulate the transient behavior of the fluid.

You're right, the copper plates are engulfed by the fluid. My point was that because this plates are hot and also there is a flow of fluid at 300K entering into the chamber a temperature profile will be present at the outer walls. Then the temperature difference vary for each cell's face of the wall, and so do the heat flux which is calculated from Fourier law:

(K)*(Wall_Temperature-Exterior_Temperature)/(Wall_Thickness)),

where I know the wall thickness (in the last reply I named it width, sorry about that), exterior temperature (300K) and the thermal conductivity of the material (K). The only variable that needs to be known is the temperature of the wall, but it depends of the cell's face of the wall. So I need to rescue this value in order to set the boundary condition.

If you have any idea to set up the boundary condition, please let me know, I would like to read about that.

Regards,

KsaMe
KsaMe is offline   Reply With Quote

Old   June 25, 2020, 04:27
Default Boundary Condition
  #8
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Whether you enable thin wall model, i.e., provide thickness or not and whether you use a UDF or not, you need to provide a boundary condition at the wall. And this boundary condition represents the conditions outside the domain. It could be a temperature, heat flux, convection, radiation, etc. But it has to be there. Default would be adiabatic. And the results depend on that condition. But no one can tell you what the condition should be. You have to check what exists outside the domain and then apply the condition.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 25, 2020, 19:28
Default
  #9
New Member
 
Join Date: Jun 2020
Posts: 15
Rep Power: 6
KsaMe is on a distinguished road
Thank you very much, I really appreciate your time. Your reply solved my problem! I didn't know that the boundary condition represents the condition OUTSIDE the domain. So I just did what you suggested, provide the thickness of the wall, the exterior temperature and the thermal conductivity of the material and done, it works!

Best regards,

KsaMe
KsaMe is offline   Reply With Quote

Reply

Tags
boundary condition, heatflux, udf


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
Natural convection in a closed domain STILL NEEDING help! Yr0gErG FLUENT 4 December 2, 2019 01:04
UDF for a time varying heat flux boundary condition B.Hamada Fluent UDF and Scheme Programming 9 August 8, 2018 13:51
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 06:15
Temperature and heat flux wall boundary condition L. Hamid Main CFD Forum 3 February 22, 2014 22:10
Concentric tube heat exchanger (Air-Water) Young CFX 5 October 7, 2008 00:17


All times are GMT -4. The time now is 16:44.