|
[Sponsors] |
UDF wrong output for time variant temperature profile |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 15, 2018, 09:44 |
UDF wrong output for time variant temperature profile
|
#1 | |
New Member
Join Date: Dec 2017
Posts: 12
Rep Power: 9 |
Hi all,
I'm trying to simulate a simple sine wave for a temperature profile using UDF and FLUENT. my profile is: T(t)=337 + sin(200*pi*t) - where T is the temperature and t is time. here is the code i use (I interpret the code): Quote:
https://imgur.com/a/GttWXH5 one can see that my amplitude should be +/- 1 K but it is different in the graph. Do you guys know what am I doing wrong? Thanks a lot, Tom |
||
October 15, 2018, 12:13 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Suppose that your boundary where you impose the BC is between the X's in this plot:
Code:
X---------X | | Code:
X-x-x--x--X | | Now, if you specify temperature also on the horizontal boundary as 337 K, then at t=25 ms (the maximum), you have three nodes with a temperature of 338 K, and two nodes where the temperature is 338 or 337 K, depending on in which order the boundary conditions are applied. So if you calculate the average based nodes, you would get something between 337 and 338 K, the exact value depending on your mesh. A finer mesh would give a value closer to 338 K. So, do you have an isothermal boundary condition on your 'other' walls, and are you calculating the temperature from the node values? If so, this is the explanation. |
|
October 15, 2018, 14:44 |
|
#3 |
New Member
Join Date: Dec 2017
Posts: 12
Rep Power: 9 |
Hi, thanks for the response.
my other walls has insulation condition. are you calculating the temperature from the node values? - I don't know. How can I check this one? thanks again |
|
October 15, 2018, 18:15 |
|
#4 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 12 |
Hi Timsho,
This isn't actually relevant to your code, because you do not actually use t1, but it is such an important point of basic programming that I have to mention it: Code:
10*10^-3 /* wrong!!! */ To get 'x to the power y', you would need 'pow(x,y)' (and you might need '#include "math.h"' at the start of the file). To get 'x to the power -3', you might as well type '1/(x*x*x)'. To get '7 times 10 to the power -3', you should type '7.e-3'. (I used 7 instead of 10 to make it clearer.) This is definitely the best way to do it. (Also, this is true in all the programming languages I can think of.) As a very minor point, you will find that M_PI is already defined as a macro for pi (including a fully accurate double-precision value if you happen to need it). Is it correct that you observe the correct frequency, and almost the correct amplitude but not quite? Well then, my guess is that you have applied this temperature at an inlet (or similar), and some of the heat has leaked out of the model by "inlet diffusion". I think inlet diffusion is discussed in the help files in the context of species. It also occurs by default for energy, but you can control this if you activate the energy equation by a TUI command such as "/def/mod/energy" -- you'll get a yes/no question to proceed and then a question about inlet diffusion/conduction. Please tell us if this is the correct answer! Good luck! Ed |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 10:21 |
udf to give temperature profile for a plane | Sai Krishna | Fluent UDF and Scheme Programming | 1 | June 1, 2018 11:05 |
UDF for output temperature | mariam.sara | Fluent UDF and Scheme Programming | 9 | August 19, 2017 09:22 |
UDF for Back-flow Temperature | G340 | Fluent UDF and Scheme Programming | 3 | August 21, 2013 05:56 |
Inlet won't apply UDF and has temperature at 0K! | tccruise | Fluent UDF and Scheme Programming | 2 | September 14, 2012 07:08 |