|
[Sponsors] |
UDF of linear distribution of temperature in a 2D tank |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 18, 2010, 17:04 |
UDF of linear distribution of temperature in a 2D tank
|
#1 |
New Member
Arailos
Join Date: Aug 2010
Posts: 4
Rep Power: 16 |
Hi all,
I am simulating heat transfer from a cylindrical source immersed in a rectangular cavity and I am trying to find out how can I write a UDF in order to have thermally stratified layers with linear distribution of temperature in the whole domain of the tank at the initialization of the simulation. I am really new to UDF and this is my first attempt. So far I have written this code but.... /////////////////////////////////////// #include "udf.h" DEFINE_INIT(linear_temp,d) { cell_t c; Thread *t; real x[ND_ND]; real Tt=338., Tb=288.; real xb=0.,xt=-0.5; real dT=(Tt-Tb)/(xt-xb); /* loop over all cell threads in the domain */ thread_loop_c(t,d) { /* loop over all cells */ begin_c_loop_all(c,t) { C_CENTROID(xc,c,t); C_T(c,t) = Tb+(x-xb)dT ; } end_c_loop_all(c,t) } } /////////////////////////////// My tank has a height of 0.5m and is placed horizontally with the gravity vector pointing to the positive of x axis...The bottom temp is 288K and the top temp of the tank is 338K...I can clarify any details needed... The tank is place horizontally because I am going to solve it axisymmetrically and the axis boundary condition should have x-axis direction... Thanks in advance.... Last edited by arailos; August 19, 2010 at 15:33. |
|
August 19, 2010, 15:14 |
Code found
|
#2 |
New Member
Arailos
Join Date: Aug 2010
Posts: 4
Rep Power: 16 |
hey all,
finally I did it...This is the appropriate code for my case... //////////////////// #include "udf.h" DEFINE_INIT(linear_temp,d) { cell_t c; Thread *t; real xc[ND_ND]; real myx; real Tt=338., Tb=288.; real xb=0.,xt=-0.5; real dT=(Tt-Tb)/(xt-xb); /* loop over all cell threads in the domain */ thread_loop_c(t,d) { /* loop over all cells */ begin_c_loop_all(c,t) { C_CENTROID(xc,c,t); myx=xc[0] C_T(c,t) = Tb+(myx-xb)dT ; } end_c_loop_all(c,t) } } //////////////////// I just post it in case anyone is looking for something similar... |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
temperature gradient problem in udf | Souviktor | Fluent UDF and Scheme Programming | 6 | March 10, 2019 06:48 |
UDF velocity and temperature | Raj | FLUENT | 3 | February 1, 2009 19:29 |
UDF reading the temperature gradient | Fabian | FLUENT | 1 | May 29, 2003 21:18 |
udf for repatching a temperature in a volume | McGregor | FLUENT | 4 | April 10, 2003 05:28 |
Temperature Distribution on a circuit board | Blackadder | Main CFD Forum | 1 | March 27, 2003 12:32 |