CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   BOUNDARY_HEAT_FLUX(f,t); (https://www.cfd-online.com/Forums/fluent/228201-boundary_heat_flux-f-t.html)

arunraj June 23, 2020 01:16

BOUNDARY_HEAT_FLUX(f,t);
 
Hello everyone,

I am trying to estimate the velocity of fluid at the liquid-vapor interface in heat pipe. I used BOUNDARY_HEAT_FLUX(f,t); macro to get the flux and from there I calculated vel. However, ANSYS Fluent automatically turns off continuity and momentum. I am using parallel mode to operate fluent. I know this macro is not official but i want to give it a go.


#include "udf.h"

DEFINE_PROFILE(condenserliq, t, i)
{
#if RP_HOST
face_t f;
real NV_VEC(farea);
real hfg = 2360000.0;
real den = 998.2;
real heat = 0;
real area = 0;
real vel;

begin_f_loop(f, t)
{
F_AREA(farea, f, t);
area += NV_MAG(farea);
heat += BOUNDARY_HEAT_FLUX(f,t);
Message("heat = %g\n", heat);
vel = heat/(area * hfg * den);
Message("vel = %g\n", vel);
F_PROFILE(f,t,i) = vel;
}
end_f_loop(f, t)
#endif
}

vinerm June 23, 2020 03:17

Udf
 
There are a few mistakes in the code.

1. Use !RP_HOST and not RP_HOST. Only nodes have this information. So, if you are running a parallel Fluent, the UDF will not do anything, rather, it should give error

2. Since you are determining heat, area, flux, etc. in the loop and then velocity is also being calculated within the loop, I doubt you want to use cumulative values for area and heat. So, do not use +=, just =

And what do you mean by that Fluent turns of continuity and momentum. Fluent does not disable equations on its own. It might be crashing because host is trying to access field data. Furthermore, BOUNDARY_HEAT_FLUX is not an unofficial macro; just an undocumented one, but official nonetheless.

arunraj June 23, 2020 04:09

Hi vinerm,

Thank you for the clarification. Sorry for using some terms in the post.

Basically i want to calculate mean heat flux on the face and want to use that constant velocity during each iteration.

Can you please explain how the input = and += effect the velocity computation?

vinerm June 23, 2020 04:15

= and +=
 
If you want to use average, then use +=, but do the final division, i.e., velocity calculation outside the loop. But then you will have to come back inside to apply it. So, the usual practice is to do the calculation in DEFINE_ADJUST and use DEFINE_PROFILE to just apply the value.

arunraj June 23, 2020 04:20

Thanks a lot. This is what I need.

arunraj June 23, 2020 04:32

I have one important question.

If am using BOUNDARY_HEAT_FLUX(f,t); using DEFINE_PROFILE, then
BOUNDARY_HEAT_FLUX(f,t); will be calculated on the faces lying only on the inlet, where I am hooking the UDF right.

I need to calculate velocity from the attached formula to be applied on inlet.

Do I need to cell_loop or face_loop for heat flux?

I know that I can not use BOUNDARY_HEAT_FLUX(f,t); for cell_loop.

vinerm June 23, 2020 07:51

Velocity
 
Are you trying to extract heat flux information from the inlet and applying velocity based that? That's not correct procedure. It might work mathematically, but think of it physically. The heat flux at the inlet depends on the velocity that you will specify. And you are extract velocity on the basis of heat flux. So, the process would go like this

1. An initial velocity will be assigned during initialization. That will determine mass flow rate.
2. An initial temperature will be assigned, leading to 0 heat flux.
3. Finally, the velocity will become 0.

If the initial temperature field is non-homogeneous, then there could be some heat flux at the inlet. However, for any heat flux value, velocity will turn out to be either higher or lower, eventually leading to either 0 or \infty.

What's the reason behind using heat flux to determine mass flow or velocity?

arunraj June 23, 2020 08:30

Thank you for explaining. Your are right. It is giving infinity. I wasted my time in using this approach. It was in a PhD thesis. However, it was purely based on mathematics for heat pipe simulation liquid-wick interface. I guess I need to find alternate approach now.

arunraj June 23, 2020 09:18

Is there a way to apply mass flow rate calculated from this as source term and apply it on the wall ? This should have not any problem right.

I can define this inlet as wall.

vinerm June 23, 2020 09:29

Physics
 
I'd recommend you to study more of literature and understand the phenomenon better before trying to model it. All this is possible, but would lead to inconclusive results if not modeled properly.

If you consider a wall, then the heat flux is due to conduction alone. That does not bring in any mass flow. So, it would be physically incorrect.

arunraj June 23, 2020 10:05

I have seen researchers considering it as wall. Thesis carried out by unni vadakkan has employed it the liquid-vapor interface (or) wick-vapor interface as no slip wall. But he has applied mass flow rate computed using kinetic theory as source term.
Because wick is a porous zone, I believe we can consider the surface as wall.
However, some researchers have considered it as inlet and applied mass flow rate computed using kinetic theory.
Kindly see the attachments.

vinerm June 23, 2020 10:10

Source
 
You can apply it as a source, but do note that you should then conserve the mass. So, if positive mass source and associated sources are applied on the wick side then negative sources should be applied on the vapor side.

arunraj June 23, 2020 10:19

Is the logic behind the formulation right for the above boundary condition? BOUNDARY_HEAT_FLUX(f,tve); will calculate flux on that particular face right. The flux on the other side should also be considered. Isn't it?

DEFINE_ON_DEMAND(faghri)

tve = Lookup_Thread(Get_Domain(1),76);
tle = Lookup_Thread(Get_Domain(1),78);
begin_f_loop(f, tve)
{
F_AREA(A, f, tve);
area_e_vap = NV_MAG(A);
heat_e_vap = BOUNDARY_HEAT_FLUX(f,tve);
Message("heat_e_vap = %g\n", heat_e_vap);
}
end_f_loop(f, tve)
begin_f_loop(f, tle)
{
F_AREA(A, f, tle);
area_e_liq = NV_MAG(A);
heat_e_liq = BOUNDARY_HEAT_FLUX(f,tle);
Message("heat_e_liq = %g\n", heat_e_liq);
}
end_f_loop(f, tle)
mass = ((heat_e_vap/area_e_vap)-(heat_e_liq/area_e_liq))/hfg;
Message("vel_e_vap = %g\n", vel_e_vap);
F_UDMI(f,tve,0)= mass;

vinerm June 23, 2020 10:35

Physics
 
The physics may be correct, but the code is wrong. If 76 and 78 are two sides of the same boundary, then you don't need to calculate the boundary fluxes separately; both should be same due to conservation.

Code is wrong because you are not accumulating or averaging the data. The velocity will be calculated only for the last face. So, you need to either use averaging or do the velocity calculation as well as its assignment to the UDM within the loop.

arunraj June 23, 2020 10:48

Thank you so much. Is the averaging necessary only for mass (or) for area_e_vap heat_e_vap (or) for all three. Previously I have tried with averaging, however I was getting segmentation fault? error. Kindly let me know.

begin_f_loop(f, tve)
{
F_AREA(A, f, tve);
area_e_vap += NV_MAG(A);
heat_e_vap += BOUNDARY_HEAT_FLUX(f,tve);
Message("heat_e_vap = %g\n", heat_e_vap);
mass += ((heat_e_vap/area_e_vap)-(heat_e_liq/area_e_liq))/hfg;
Message("mass = %g\n", mass);
F_UDMI(f,tve,0)=mass;
}

vinerm June 23, 2020 10:50

Averaging
 
You don't need averaging because better approach would be to save the field. So, just move velocity calculation and assignment to UDM within the loop.

arunraj June 23, 2020 10:52

Thanks a lot. You are great. Because of you, I have developed a strong interest in programming, at least in UDF.

arunraj June 23, 2020 10:58

I have applied using this logic. However, is there a way to specify that this mass source to be applied normal to the wall.


if(c = F_C0(f,tve))
{
source = F_UDMI(f,tve,0);
dS[eqn]=0;
}

vinerm June 23, 2020 11:04

Source
 
Sources are not applied on boundaries, but in the cells.


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