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

UDF for defining Heat Flux Profile at a wall

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 1 Post By Alex90
  • 1 Post By ghost82
  • 2 Post By flotus1
  • 4 Post By flotus1
  • 1 Post By brunoc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 17, 2014, 12:15
Default UDF for defining Heat Flux Profile at a wall
  #1
New Member
 
Join Date: Oct 2014
Posts: 7
Rep Power: 12
Alex90 is on a distinguished road
Hi Guys, I am relativeley new to Ansys Fluent UDF Scripting and so far I did not get very far with my code ...

So what is my problem. I want to define an axial profile of the wall heat flux. I have a 4000mm long cylinder within Ansys the axis is orientated into z direction. The crux is that I have a constant wall heat flux within specific distances. For example from z>=0 to z<=300mm the heat flux q=0 and from z>300 to z<=600 the heat flux q=4738.666 .... and so on ....

Here is what I scripted so far :

#include "udf.h"
Define_Profile(heat_flux,thread,i)
{
face_t f;
begin_f_loop(f,thread)
{
if(x[2] <= 300)
F_PROFILE(f,thread,i) = 0;
else if(x[2] <= 600 && x[2] > 300)
F_PROFILE(f,thread,i) = 3500.955;
else if(x[2] <= 1050 && x[2] > 600)
F_PROFILE(f,thread,i) = 4738.666;
else if(x[2] <= 2100 && x[2] > 1050)
F_PROFILE(f,thread,i) = 4971.053;
else if(x[2] <= 2850 && x[2] > 2100)
F_PROFILE(f,thread,i) = 5092.298;
else if(x[2] <= 3300 && x[2] > 2850)
F_PROFILE(f,thread,i) = 4738.666;
else if(x[2] <= 3600 && x[2] > 3300)
F_PROFILE(f,thread,i) = 3500.955;
else if(x[2] <= 3900 && x[2] > 3600)
F_PROFILE(f,thread,i) = 2121.791;
else
F_PROFILE(f,thread,i) = 0;
}
end_f_loop(f,thread);
}


Unfortanetley this does not work. I wrote this with the code blocks editor and saved it as heat_flux.c , afterwards I compiled this within Fluent.
I got the following failure :
line 1 parse error ....

Can someone please help me with finding the failure. Thank you ...
SHREEKANT likes this.
Alex90 is offline   Reply With Quote

Old   October 17, 2014, 13:17
Default
  #2
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
Hi
you didn't hold the position vector.
Add
Code:
real x[ND_ND];
before face_t f

Define_Profile(heat_flux,thread,i) should be uppercase DEFINE_PROFILE(....)

Daniele
famon likes this.
__________________
Google is your friend and the same for the search button!
ghost82 is offline   Reply With Quote

Old   October 20, 2014, 05:32
Default
  #3
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
After you added this, I think you still need to write the current face position to the variable x by adding
Code:
F_CENTROID (x,f,thread);
at the beginning of the face loop.
ghost82 and famon like this.
flotus1 is offline   Reply With Quote

Old   October 20, 2014, 09:43
Default
  #4
New Member
 
Join Date: Oct 2014
Posts: 7
Rep Power: 12
Alex90 is on a distinguished road
Hi guys, i added what ghost82 wrote and tried it again. This time Fluent compiled it without failure. I did a steady calculation which finished after 1 iteration ... Post-Processing the results their is no single Heat Flux all over my geometry. I have the feeling that i did not specify geometry as flotus1 suggested ... so here is my second code :


#include "udf.h"
DEFINE_PROFILE(heat_flux,thread,i)
{
real x[ND_ND];
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID (x,f,thread);
if(x[2] <= 300)
F_PROFILE(f,thread,i) = 0;
else if(x[2] <= 600 && x[2] > 300)
F_PROFILE(f,thread,i) = 3500.955;
else if(x[2] <= 1050 && x[2] > 600)
F_PROFILE(f,thread,i) = 4738.666;
else if(x[2] <= 2100 && x[2] > 1050)
F_PROFILE(f,thread,i) = 4971.053;
else if(x[2] <= 2850 && x[2] > 2100)
F_PROFILE(f,thread,i) = 5092.298;
else if(x[2] <= 3300 && x[2] > 2850)
F_PROFILE(f,thread,i) = 4738.666;
else if(x[2] <= 3600 && x[2] > 3300)
F_PROFILE(f,thread,i) = 3500.955;
else if(x[2] <= 3900 && x[2] > 3600)
F_PROFILE(f,thread,i) = 2121.791;
else
F_PROFILE(f,thread,i) = 0;
}
end_f_loop(f,thread);
}


Thank you for your fast answers and your support
Alex90 is offline   Reply With Quote

Old   October 20, 2014, 09:45
Default
  #5
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
1 iteration??
Adjust number of iterations in the run tab and adjust residual values in the monitor tab to let the solution converge.
ghost82 is offline   Reply With Quote

Old   October 20, 2014, 09:50
Default
  #6
New Member
 
Join Date: Oct 2014
Posts: 7
Rep Power: 12
Alex90 is on a distinguished road
I addjusted the iterations number before the calculation to 100 ... I will try the residuals now ...
Alex90 is offline   Reply With Quote

Old   October 20, 2014, 10:18
Default
  #7
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
Did you add what I suggested? Otherwise the heat flux will be zero everywhere and it comes as no surprise that the solution of the energy equation converges after 1 iteration.
flotus1 is offline   Reply With Quote

Old   October 20, 2014, 10:29
Default
  #8
New Member
 
Join Date: Oct 2014
Posts: 7
Rep Power: 12
Alex90 is on a distinguished road
Hi Flotus you mean F_CENTROID ? ....


#include "udf.h"
DEFINE_PROFILE(heat_flux,thread,i)
{
real x[ND_ND];
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID (x,f,thread);
if(x[2] <= 300)
F_PROFILE(f,thread,i) = 0;
Alex90 is offline   Reply With Quote

Old   October 20, 2014, 11:44
Default
  #9
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
Yes.
Additionally, keep in mind that Fluent expects values to be in SI-units. So "if(x[2] <= 300)" checks if the z-value is smaller than 300m.
Just to be sure I would rather enter these values with a decimal point, so 300.0 instead of 300 and F_PROFILE(f,thread,i) = 0.0; instead of F_PROFILE(f,thread,i) = 0;
ghost82, famon, SHREEKANT and 1 others like this.
flotus1 is offline   Reply With Quote

Old   October 15, 2015, 05:16
Default Same query with angular way
  #10
New Member
 
SHREEKANT
Join Date: Sep 2015
Posts: 5
Rep Power: 11
SHREEKANT is on a distinguished road
I went through all your healthy discussions...
I want to give different heat flux values in a pipe in a angular way like,upper part of pipe receiving more heat than lower part.

That is, upper portion of 270 deg. receiving 550W/m2 and lower 90 deg. receiving 20000W/m2 of heat.

can anyone help me out of this issue?
SHREEKANT is offline   Reply With Quote

Old   October 20, 2015, 11:36
Default
  #11
Senior Member
 
Bruno
Join Date: Mar 2009
Location: Brazil
Posts: 277
Rep Power: 21
brunoc is on a distinguished road
Quote:
Originally Posted by SHREEKANT View Post
I went through all your healthy discussions...
I want to give different heat flux values in a pipe in a angular way like,upper part of pipe receiving more heat than lower part.

That is, upper portion of 270 deg. receiving 550W/m2 and lower 90 deg. receiving 20000W/m2 of heat.

can anyone help me out of this issue?
No need to use UDFs here. Just split your pipe into upper and lower regions, then set different boundary conditions at those.
salehorafi likes this.
brunoc is offline   Reply With Quote

Old   October 31, 2015, 07:35
Default
  #12
New Member
 
SHREEKANT
Join Date: Sep 2015
Posts: 5
Rep Power: 11
SHREEKANT is on a distinguished road
Quote:
Originally Posted by brunoc View Post
No need to use UDFs here. Just split your pipe into upper and lower regions, then set different boundary conditions at those.
Hi Brunoc,
Thank you for the reply. In that case, I am afraid about the ways by which inlet and outlet boundary condition can be given, as it is split as two halves. I have a mass flow inlet at the entrance section.
SHREEKANT is offline   Reply With Quote

Old   September 10, 2016, 23:43
Default
  #13
New Member
 
hussein
Join Date: Aug 2016
Posts: 5
Rep Power: 10
hussein92 is on a distinguished road
hi !!
my module is cooling PV cell
so the heat flux will be q*(1-efficiency of pv )
but the efficiency is function of temperature of pv T cell
efficincy= efficincy-ref *(1-0.004(T of cell -T ref))
how i can defined that in fluen
hussein92 is offline   Reply With Quote

Old   August 4, 2018, 06:34
Default heat flux for full and rot_periodic pipe
  #14
Senior Member
 
Shamoon Jamshed
Join Date: Apr 2009
Location: Karachi
Posts: 381
Rep Power: 18
Shamoon Jamshed is on a distinguished road
Send a message via Skype™ to Shamoon Jamshed
I want to test two models. One model is full circular pipe with solid wall modeled and has a heat flux of 3500 on its top wall.
Second model is 1/10 th of the circumference extruded in third dimension to get the pipe length. This also contains the solid mesh. The outer wall is again supplied with 3500 heat flux. The sides are periodic (rot. periodic)
Now I want to compute Tw at the interface and Tout at outlet and difference between the two. such that delta T = (Tw- (298.15+To)*0.5). 298.15 K is the inlet temperature.
Q: Why the delta T is different for two cases? Should I take some other flux value when modeling 1/10th of the geometry.
Shamoon Jamshed 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
Define_profile UDF for Transient Heat flux boundary condition Amoljoshi Fluent UDF and Scheme Programming 2 June 20, 2018 22:55
Conjugate Heat Transfer: Wall Heat Flux at Coupled Walls? MaxHeat FLUENT 4 September 14, 2017 11:44
Heat Flux Profile at Fluid-Porous Interface Hitch8 CFX 4 December 15, 2012 10:57
UDF to calculate average heat flux dynamics Fluent UDF and Scheme Programming 0 July 21, 2012 19:54
heat flow UDF on coupled surface (wall-shadow wall) Friedmann Fluent UDF and Scheme Programming 0 August 5, 2010 11:25


All times are GMT -4. The time now is 01:18.