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

BOUNDARY_HEAT_FLUX(f,t);

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 23, 2020, 01:16
Default BOUNDARY_HEAT_FLUX(f,t);
  #1
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
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
}
arunraj is offline   Reply With Quote

Old   June 23, 2020, 03:17
Default Udf
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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.
__________________
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, 04:09
Default
  #3
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
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?
arunraj is offline   Reply With Quote

Old   June 23, 2020, 04:15
Default = and +=
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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.
__________________
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, 04:20
Default
  #5
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
Thanks a lot. This is what I need.
arunraj is offline   Reply With Quote

Old   June 23, 2020, 04:32
Default
  #6
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
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.

Last edited by arunraj; June 23, 2020 at 11:24.
arunraj is offline   Reply With Quote

Old   June 23, 2020, 07:51
Default Velocity
  #7
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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?
__________________
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, 08:30
Default
  #8
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
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 is offline   Reply With Quote

Old   June 23, 2020, 09:18
Default
  #9
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
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.
arunraj is offline   Reply With Quote

Old   June 23, 2020, 09:29
Default Physics
  #10
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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.
__________________
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, 10:05
Default
  #11
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
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.
arunraj is offline   Reply With Quote

Old   June 23, 2020, 10:10
Default Source
  #12
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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.
__________________
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, 10:19
Default
  #13
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
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;
arunraj is offline   Reply With Quote

Old   June 23, 2020, 10:35
Default Physics
  #14
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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.
__________________
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, 10:48
Default
  #15
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
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;
}
arunraj is offline   Reply With Quote

Old   June 23, 2020, 10:50
Default Averaging
  #16
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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.
__________________
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, 10:52
Default
  #17
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
Thanks a lot. You are great. Because of you, I have developed a strong interest in programming, at least in UDF.
arunraj is offline   Reply With Quote

Old   June 23, 2020, 10:58
Default
  #18
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 194
Rep Power: 14
arunraj is on a distinguished road
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;
}
arunraj is offline   Reply With Quote

Old   June 23, 2020, 11:04
Default Source
  #19
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Sources are not applied on boundaries, but in the cells.
__________________
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

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



All times are GMT -4. The time now is 23:09.