|
[Sponsors] |
UDF for defining Heat Flux Profile at a wall |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 17, 2014, 12:15 |
UDF for defining Heat Flux Profile at a wall
|
#1 |
New Member
Join Date: Oct 2014
Posts: 7
Rep Power: 12 |
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 ... |
|
October 17, 2014, 13:17 |
|
#2 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
Hi
you didn't hold the position vector. Add Code:
real x[ND_ND]; Define_Profile(heat_flux,thread,i) should be uppercase DEFINE_PROFILE(....) Daniele
__________________
Google is your friend and the same for the search button! |
|
October 20, 2014, 05:32 |
|
#3 |
Super Moderator
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49 |
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); |
|
October 20, 2014, 09:43 |
|
#4 |
New Member
Join Date: Oct 2014
Posts: 7
Rep Power: 12 |
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 |
|
October 20, 2014, 09:45 |
|
#5 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
1 iteration??
Adjust number of iterations in the run tab and adjust residual values in the monitor tab to let the solution converge. |
|
October 20, 2014, 09:50 |
|
#6 |
New Member
Join Date: Oct 2014
Posts: 7
Rep Power: 12 |
I addjusted the iterations number before the calculation to 100 ... I will try the residuals now ...
|
|
October 20, 2014, 10:18 |
|
#7 |
Super Moderator
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49 |
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.
|
|
October 20, 2014, 10:29 |
|
#8 |
New Member
Join Date: Oct 2014
Posts: 7
Rep Power: 12 |
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; |
|
October 20, 2014, 11:44 |
|
#9 |
Super Moderator
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49 |
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; |
|
October 15, 2015, 05:16 |
Same query with angular way
|
#10 |
New Member
SHREEKANT
Join Date: Sep 2015
Posts: 5
Rep Power: 11 |
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? |
|
October 20, 2015, 11:36 |
|
#11 | |
Senior Member
Bruno
Join Date: Mar 2009
Location: Brazil
Posts: 277
Rep Power: 21 |
Quote:
|
||
October 31, 2015, 07:35 |
|
#12 | |
New Member
SHREEKANT
Join Date: Sep 2015
Posts: 5
Rep Power: 11 |
Quote:
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. |
||
September 10, 2016, 23:43 |
|
#13 |
New Member
hussein
Join Date: Aug 2016
Posts: 5
Rep Power: 10 |
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 |
|
August 4, 2018, 06:34 |
heat flux for full and rot_periodic pipe
|
#14 |
Senior Member
|
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. |
|
|
|
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 |