CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

UDF for heat flux boundary condition

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By vinerm
  • 1 Post By vinerm
  • 1 Post By vinerm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 22, 2020, 10:45
Default UDF for heat flux boundary condition
  #1
Member
 
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6
franc1 is on a distinguished road
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)
}
How can i solve it?
Thank you in advance!
franc1 is offline   Reply With Quote

Old   April 22, 2020, 10:51
Default Two thing
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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.
franc1 likes this.
__________________
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.
vinerm is offline   Reply With Quote

Old   April 22, 2020, 12:36
Default
  #3
Member
 
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6
franc1 is on a distinguished road
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)
}
franc1 is offline   Reply With Quote

Old   April 22, 2020, 12:59
Default Try this
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Try to compile or interpret the attached file
Attached Files
File Type: c heatflux.c (440 Bytes, 16 views)
franc1 likes this.
__________________
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.
vinerm is offline   Reply With Quote

Old   April 22, 2020, 13:30
Default
  #5
Member
 
Francesco
Join Date: Apr 2020
Posts: 56
Rep Power: 6
franc1 is on a distinguished road
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!
franc1 is offline   Reply With Quote

Old   April 22, 2020, 13:35
Default Editor
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
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++.
franc1 likes this.
__________________
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.
vinerm is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 08:48.