|
[Sponsors] |
Assign piece-wise linear temperature to wall. No errors but no function. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
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: 17
Rep Power: 11 |
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) } 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: 17
Rep Power: 11 |
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) } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Floating point exception error | lpz_michele | OpenFOAM Running, Solving & CFD | 53 | October 19, 2015 03:50 |
Running UDF with Supercomputer | roi247 | FLUENT | 4 | October 15, 2015 14:41 |
Non-constant heat flux (as a function of wall temperature)) | Laplace | CFX | 1 | February 23, 2014 17:56 |
How to write k and epsilon before the abnormal end | xiuying | OpenFOAM Running, Solving & CFD | 8 | August 27, 2013 16:33 |
[blockMesh] error message with modeling a cube with a hold at the center | hsingtzu | OpenFOAM Meshing & Mesh Conversion | 2 | March 14, 2012 10:56 |