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/)
-   -   Heat flux UDF boundary condition on a wall (https://www.cfd-online.com/Forums/fluent-udf/228162-heat-flux-udf-boundary-condition-wall.html)

KsaMe June 22, 2020 02:45

Heat flux UDF boundary condition on a wall
 
3 Attachment(s)
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

vinerm June 22, 2020 04:06

Heat Flux
 
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.

KsaMe June 22, 2020 12:43

1 Attachment(s)
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

vinerm June 22, 2020 13:04

Physics
 
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.

KsaMe June 22, 2020 16:13

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

vinerm June 23, 2020 03:24

Copper Plates
 
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.

KsaMe June 23, 2020 12:52

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

vinerm June 25, 2020 03:27

Boundary Condition
 
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.

KsaMe June 25, 2020 18:28

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


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