|
[Sponsors] |
September 2, 2016, 02:30 |
UDF for linear temperature variation
|
#1 |
New Member
Join Date: Sep 2016
Posts: 10
Rep Power: 10 |
hey.
I am modelling a coolant flow in a rectangular channel.. I have inlet temperature, top wall temperature, bottom wall temperature, and exit pressure. i want to define a linear temperature variation for the side walls (i know the top wall and bottom wall temperatures) by means of udf. kindly help me in writing this code, as i am new to udf. The following is the code i have written. However, i am not getting the correct temperature profile. Please help Code:
# include "udf.h" DEFINE_PROFILE(tsw, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y; double y1,y2,tsw; int i,j1; double yy[1300]; real T; cell_t c; face_t f; begin_c_loop(c, thread) { C_CENTROID(x,c,thread); /* temp=C_T(c,thread);*/ for (i=0;i<100;i++) { tsw=264.341*yy[i]+600;} } if (y1>=yy[100]) {tsw=600;} F_PROFILE(c, thread, position) = tsw; /*printf("%f\t%f\t%f\t%f\n",y1,y2,tsw,temp);*/ } end_c_loop(c, thread) } |
|
September 2, 2016, 10:41 |
|
#2 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
about the code, what is the value of y1? Not defined anywhere. you can also work your code in something like if (i <100) { ... } else { ... } I will make it clear and easier. |
||
September 4, 2016, 01:36 |
|
#3 |
Member
Davoud Malekian
Join Date: Jan 2016
Posts: 53
Rep Power: 10 |
Hello nonstopthinker,
The question is that why you guys loop over cells to define a specific boundary condition. the name "boundary condition" always make it clear that it is a boundary "face thread" that you are trying to approach not bunch of cells, so maybe change the code like below : first i have to ask u some questions: do you have any source of data that "yy" is saved there?? cause yy[0] , yy[1] , ... yy[1300], won't give you anything unless you define values for all the 1300 components of this array called "yy"! another question! you have used just 101 components of this array "yy" in your code so why giving it 1301 components?! man i don't see anything in your code that defines values or something for y1 and y2! as i see in your code y2 hasn't been used even once so its better to be removed , and about y1 you must specify it's value like this "double y1 = 80;" (for example). #include "udf.h" static int conter = 0; DEFINE_PROFILE(temprature, t, i) { real x[ND_ND]; /* this will hold the position vector */ double y1,tsw; double yy[1300]; face_t f; begin_f_loop(f, t) { F_CENTROID(x,f,t); /* temp=C_T(c,t);*/ for (conter=0;conter<100;conter++) { tsw=264.341*yy[conter]+600;} } if (y1>=yy[100]) {tsw=600;} F_PROFILE(f, t, i) = tsw; /*printf("%f\t%f\t%f\t%f\n",y1,y2,tsw,temp);*/ } end_f_loop(f, t) } and one more thing , the code won't work untill u give values to y1 and yy. Last edited by D.M; September 4, 2016 at 11:29. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF to change heat transfer coefficient with wall temperature | emmkell | Fluent UDF and Scheme Programming | 18 | August 7, 2018 04:44 |
UDF for a horizontal temperature profile | CD | Fluent UDF and Scheme Programming | 9 | May 6, 2018 13:13 |
UDF problem- time dependent temperature at inlet | kaeran | FLUENT | 1 | June 16, 2015 22:48 |
UDF for heat convection coefficient with fixed surface temperature | Boo85 | Fluent UDF and Scheme Programming | 2 | July 10, 2012 19:43 |
Please Help! Temperature profile UDF for 3D geometry | subhankar_bhandari | FLUENT | 2 | April 16, 2011 06:30 |