# Heat flux with position dependent on time

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

 November 19, 2019, 15:56 Heat flux with position dependent on time #1 New Member   Luis Donaldo Cuevas Iturbe Join Date: Nov 2019 Posts: 2 Rep Power: 0 Hi everyone, I'm trying to use a UDF to define my problem, which like the title says, is a heat flux changing position each second. I tried looking for examples in here but I was not able to find any, if you know want please share it to me. So, this is the code I used, but apparently it's not working pretty well because the heat source doesn't move with time. ----------------------------------------------- #include "udf.h" #define r 5/10000 DEFINE_PROFILE(wall_heat_flux,t,i) { real x[ND_ND]; real ti= CURRENT_TIMESTEP; real source = 84745; face_t f; begin_f_loop(f,t) { F_CENTROID(x,f,t); x[1]=x[1]+x[1]; x[2]=x[2]*ti; F_PROFILE(f,t,i) = M_PI*pow(r+x[0],2)*source*x[2]; } end_f_loop(f,t) } ------------------------------------------------------------------------- r is the raidus in meters of the area I want my heat source to heat. ti should be the time step source is the heat source (w/m^2) So, I have a rectangle prism, and I want this circle of r radius to heat one face of the prism in the z direction. Since F_centroid will locate me in the center of the face, with x[1]=x[1]+x[1] I'm triyng to locate me in the the surface of the prism and not in the middle. x[2] should be z so I want the initial position of x[2], in the center, to move each time step. F_Profile I'm trying to build the circle of r radius and multiply it by the source power. Can anyone please tell me where am I having a mistake? or any suggestions I would be very grateful.

 November 20, 2019, 23:51 #2 Senior Member   Alexander Join Date: Apr 2013 Posts: 2,063 Rep Power: 31 this is strange part from my point of view x[1]=x[1]+x[1]; x[2]=x[2]*ti; change to y=x[1]+x[1]; z=x[2]*ti; or something like that. I recommend to use this structure of code: real ti; ti= CURRENT_TIMESTEP; LuisDo likes this. __________________ best regards ****************************** press LIKE if this message was helpful

 November 21, 2019, 22:02 #3 New Member   Luis Donaldo Cuevas Iturbe Join Date: Nov 2019 Posts: 2 Rep Power: 0 Hi Alexander, First of all thank you for answering, secondly I wrote : x[1]=x[1]+x[1]; x[2]=x[2]*ti; because if x[n], represents the actual position, then I want x[2] to be changing. I don't know if I making myself clear. If I write z=x[2]*ti; How does fluent will know that z is this x[2]? I z values would be the ones I want of the position, but my main objective is the actual z position of the heat flux being in these changing places. I'm new in the field, so maybe I'm mistaking, please tell me if I'm wrong. Regards

 November 21, 2019, 23:48 #4 Senior Member   Alexander Join Date: Apr 2013 Posts: 2,063 Rep Power: 31 x[n] are coordinates of this cell(face) and you can't change it. (if you want to move cell(face) you should use dynamic mesh) if you want your flux(heat source) "move" than you may vary the magnitude of flux in this cell(face). For example: 1sec flux = 1 2 sec flux = 2 3 sec flux = 3 4 sec flux = 10 5sec flux = 3 6sec flux = 2 7 sec flux = 1 for the neighbor cell(face) flux could be: 1sec flux = 0 2 sec flux = 1 3 sec flux = 2 4 sec flux = 3 5sec flux = 10 6sec flux = 3 7 sec flux = 2 I hope my idea is clear __________________ best regards ****************************** press LIKE if this message was helpful