# Assign piece-wise linear temperature to wall. No errors but no function.

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

 January 30, 2016, 11:28 Assign piece-wise linear temperature to wall. No errors but no function. #1 New Member   Join Date: Nov 2015 Posts: 16 Rep Power: 2 Code: ```#include "udf.h" DEFINE_PROFILE(gradient_temp20,thread,nv) { face_t f; real x[ND_ND]; real dist; /* loop over each of the faces of this zone */ begin_f_loop (f,thread) { F_CENTROID(x,f,thread); dist = NV_MAG(x); if (dist <= 1.) { F_PROFILE(f,thread,nv) = 300.; } else { F_PROFILE(f,thread,nv) = 600.; } } end_f_loop (f,thread) }``` This works, but now it only works on walls in X-Direction that are at Position 0 on Y axis. I'm going insane. Please take a look at this, there must be some small error which is not obvious to me. Last edited by silent2608; January 30, 2016 at 15:46.

 January 30, 2016, 15:45 #2 New Member   Join Date: Nov 2015 Posts: 16 Rep Power: 2 Ok solved. But I feel like it's a pretty bad solution. Like this I need to perfectly define the y-Position of the wall. Anyone have a solution so I don't need to set starting point for Y Axis? (real orig[ND_ND] = {0.0, 0.0} ? Code: ```#include "udf.h" DEFINE_PROFILE(temp_wallinside,thread,nv) { real orig[ND_ND] = {0.0, 0.0}; real x[ND_ND]; face_t f; real r; real temp; begin_f_loop (f,thread) { F_CENTROID(x, f, thread); NV_VV(x,=,x,-,orig); r = NV_MAG(x); if ( r < 1.) { temp = 300.; } else if ( r < 2.) { temp = 400.*(x[0]-1.)+300; } else { temp = 700.; } F_PROFILE(f, thread, nv) = temp; } end_f_loop(f, thread) } DEFINE_PROFILE(temp_walloutside,thread,nv) { real orig[ND_ND] = {0.0, 1.0}; real x[ND_ND]; face_t f; real r; real temp; begin_f_loop (f,thread) { F_CENTROID(x, f, thread); NV_VV(x,=,x,-,orig); r = NV_MAG(x); if ( r < 1.) { temp = 300.; } else if ( r < 2.) { temp = 400.*(x[0]-1.)+300; } else { temp = 700.; } F_PROFILE(f, thread, nv) = temp; } end_f_loop(f, thread) }```

 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 lpz_michele OpenFOAM Running, Solving & CFD 53 October 19, 2015 02:50 roi247 FLUENT 4 October 15, 2015 13:41 Laplace CFX 1 February 23, 2014 17:56 xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33 hsingtzu OpenFOAM Native Meshers: blockMesh 2 March 14, 2012 10:56

All times are GMT -4. The time now is 04:31.