|
[Sponsors] |
May 25, 2015, 12:23 |
Temperature profile for cell zone
|
#1 |
New Member
R. Raimondi
Join Date: Mar 2015
Posts: 8
Rep Power: 11 |
hi, I have a problem in writing a UDF for a variable temperature in a 3D cell zone.
This is my first UDF and I don't know very well the C programming, so is like impossible defining the function for me in a few days. Do you know how can I write a linear function for temperature, where: Z=0 m => T=24 °C Z=-3 m => T=18 °C also: Z< -3 m => T=18 °C Thank you! |
|
May 25, 2015, 19:12 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
First, convert your temperature listing to a series of equations that you'll later code into with conditional if statements; it appears there's two segments of the temperature distribution (one linear and one constant). Then have a read of the UDF manual in the section on the DEFINE_PROFILE macro where the usage is detailed and several examples are provided.
|
|
May 26, 2015, 11:56 |
|
#3 |
New Member
R. Raimondi
Join Date: Mar 2015
Posts: 8
Rep Power: 11 |
Thanks for the advices.
I tried to write the code, but I don't know how to put the two conditions (linear and constant) in a single UDF, can you help me with this? For now I write only the linear part. The code is: #include "udf.h" DEFINE_PROFILE(pressure_profile, t, i) { real x[ND_ND]; /* this will hold the position vector */ real z; face_t f; begin_f_loop(f, t) { F_CENTROID(x,f,t); z = x[2]; F_PROFILE(f, t, i) = 297+2*z; } end_f_loop(f, t) } I also put an image of the result |
|
May 26, 2015, 12:37 |
|
#4 |
New Member
R. Raimondi
Join Date: Mar 2015
Posts: 8
Rep Power: 11 |
I solved it, i've tried a lot of time and now it's ok.
I write this one, and thanks for everything: #include "udf.h" DEFINE_PROFILE(pressure_profile, t, i) { real x[ND_ND]; /* this will hold the position vector */ real z; face_t f; begin_f_loop(f, t) { F_CENTROID(x,f,t); z = x[2]; if (z > -3) F_PROFILE(f, t, i) = 291+2*z; else F_PROFILE(f, t, i) = 291; } end_f_loop(f, t) } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for a horizontal temperature profile | CD | Fluent UDF and Scheme Programming | 9 | May 6, 2018 12:13 |
Journal file error | magicalmarshmallow | FLUENT | 3 | April 4, 2014 12:25 |
Segmentation Fault in fluent3DMeshToFoam | cwang5 | OpenFOAM Bugs | 23 | April 13, 2011 15:37 |
Error to re-open fluent case file | J.Gimbun | FLUENT | 0 | April 27, 2006 08:42 |
Fluent incident radiation problem | Michael Schwarz | Main CFD Forum | 0 | October 21, 1999 05:56 |