|
[Sponsors] |
April 22, 2020, 10:45 |
UDF for heat flux boundary condition
|
#1 |
Member
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6 |
Hi everybody
I'm new to c language, i'm writing this udf to have this specific heatflux profile, depending on the temperature of the wall. It has to be updated each time-step also, since temperature at the wall is changing during time. After solving some syntax errors now i have the following error in the ansys console: c(23): error C2064: term does not evaluate to a function taking 337 arguments Code:
#include "udf.h" DEFINE_PROFILE(wallheatflux,t,i) { face_t f; real temp; temp = F_T(f,t); real cp1=4180; real cp2=3488.3; real Tsat=373; real Tliq=293; real Ql=2257000; real flow_time = RP_Get_Real("flow-time"); begin_f_loop (f,t) { if(temp>373) F_PROFILE(f,t,i) = -1.2099*(cp1*(Tsat-Tliq)+Ql+cp2*(temp-Tsat)); elseif(temp<=373) F_PROFILE(f,t,i) = -1.2099*(cp1*(temp-Tliq)); } end_f_loop (f,t) } Thank you in advance! |
|
April 22, 2020, 10:51 |
Two thing
|
#2 |
Senior Member
|
f does not exist outside f_loop. Fluent provides its value only within the loop. Hence, F_T has to be inside the loop. That's the bug. Secondly, do not use RP_ call. This is expensive in terms of time and should be used only if really needed. Use CURRENT_TIME; this is C variable defined within Fluent and is equal to current time.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 22, 2020, 12:36 |
|
#3 |
Member
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6 |
I modified it in this way, but the error is the same.
Code:
#include "udf.h" DEFINE_PROFILE(wallheatflux,t,i) { face_t f; real cp1=4180; real cp2=3488.3; real Tsat=373; real Tliq=293; real Ql=2257000; real time = CURRENT_TIME; begin_f_loop (f,t) { real temp = F_T(f,t); if(temp>373) F_PROFILE(f,t,i) = -1.2099*(cp1*(Tsat-Tliq)+Ql+cp2*(temp-Tsat)); elseif(temp<=373) F_PROFILE(f,t,i) = -1.2099*(cp1*(temp-Tliq)); } end_f_loop (f,t) } |
|
April 22, 2020, 12:59 |
Try this
|
#4 |
Senior Member
|
Try to compile or interpret the attached file
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 22, 2020, 13:30 |
|
#5 |
Member
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6 |
Where do you write the codes? Which programme is this?
The code compile very well, you solve my problem again vinerm. Thank you a lot! |
|
April 22, 2020, 13:35 |
Editor
|
#6 |
Senior Member
|
You can use any editor. I use vi but it does not really matter as long as you save it in a proper format. If you use Windows, prefer using textpad or notepad++.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Centrifugal fan | j0hnny | CFX | 13 | October 1, 2019 13:55 |
Radiation in semi-transparent media with surface-to-surface model? | mpeppels | CFX | 11 | August 22, 2019 07:30 |
UDF for a time varying heat flux boundary condition | B.Hamada | Fluent UDF and Scheme Programming | 9 | August 8, 2018 12:51 |
Waterwheel shaped turbine inside a pipe simulation problem | mshahed91 | CFX | 3 | January 10, 2015 11:19 |
Error finding variable "THERMX" | sunilpatil | CFX | 8 | April 26, 2013 07:00 |