# Difficulty with UDF code for HEAT FLUX

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 6, 2015, 15:16 Difficulty with UDF code for HEAT FLUX #1 New Member   Saksham Join Date: Dec 2015 Posts: 1 Rep Power: 0 Sponsored Links Hi all. I am really in need of help regarding the following problem. Your concern is appreciated. I am trying to solve a 2D solid rectangular plate conduction problem (length in x and height in y with bottom left corner of plate as the origin). The plate is insulated on the left, right and bottom edge but is subjected to a spatially (in x) varying HEAT FLUX on the top edge. For the top edge, I have made the following UDF code but it is not giving the symmetric solution. The function that you see below for the heat flux is a spatially symmetric function with respect to the centre of the plate. I have paid attention in defining the function correctly with respect to the coordinate system in use. I believe there should be some problem with my UDF C language code below (as I have not clearly understood the use of the x[ND_ND] array). I would be grateful if someone can please put in a small amount of their time and help me out with this problem. //***********// #include "udf.h" DEFINE_PROFILE(heat_flux,thread,i) { real x[ND_ND]; face_t f; real k; begin_f_loop(f,thread) { k=F_CENTROID (x,f,thread); F_PROFILE(f,thread,i) = (-3.073e+20)*k^8 + (6.145e+19)*k^7+ (-4.966e+18)*k^6 + (2.072e+17)*k^5 -(4.718e+15)*k^4 + (5.647e+13)*k^3 + (-3.084e+11)*k^2 + (6.515e+08)*k + (-2.148e+05); // this is the function for the heat flux // } end_f_loop(f,thread); } Last edited by etudiant_IITB; December 6, 2015 at 16:05. Reason: Problem resolved

 December 7, 2015, 09:07 #2 Senior Member   Bruno Join Date: Mar 2009 Location: Brazil Posts: 279 Rep Power: 14 F_CENTROID(x,f,thread) will write the coordinates of the centroid on your x array: x[0], x[1], x[2] = (x, y and z coordinates) Use those to access each coordinate of the centroid in your equation. etudiant_IITB likes this.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post acasas CFD Freelancers 1 January 23, 2015 08:26 B.Hamada Fluent UDF and Scheme Programming 11 July 18, 2014 21:39 ozy Fluent UDF and Scheme Programming 0 June 10, 2014 11:07 kishan kumar jaiswal FLUENT 4 April 21, 2014 18:01 Anna Tian CFX 1 June 16, 2013 06:28