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

UDF for time dependent heat flux

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 23, 2015, 13:00
Question UDF for time dependent heat flux
  #1
New Member
 
Join Date: Dec 2015
Posts: 2
Rep Power: 0
rontgen5 is on a distinguished road
Hello!

I am very new to ANSYS. I am modeling a simple conduction + convection model. Although the heat source in this is more like a PULSE. In a 300 msec cycle, a heat pulse of 10 msec long is sent at 50th msec. All the time except for the pulse duration is for cooling.

I have written an UDF, that can be seen below (with my negligible knowledge of writing an UDF). When I try to interpret it, I am getting an errors: 1. line 35arse error, 2. f_loop_last: undeclared variable. I am not able to understand the cause of these errors. I tried looking at other threads, but I still couldn't understand what's wrong.

Can some one please have a look and give me some kind of feedback?

I highly appreciate your time, thank you very much.


Code:

# include "udf.h"
# include "unsteady.h"

DEFINE_EXECUTE_AT_END (execute_loop)
{
face_t f;
Thread *t;
real c_time=0.0000;
real q;
c_time=CURRENT_TIME;

if (c_time<0.05)
{
q=0;
}

if ((c_time>=0.05)&&(c_time<=0.06))
{
q=10000;
}

if (c_time>0.06)
{
q=0;
}

DEFINE_PROFILE(HeatPulse, t, i)
{
begin_f_loop (f,t)
F_PROFILE(f,t,i) = q;
end_f_loop(f,t)
}
}
rontgen5 is offline   Reply With Quote

Old   January 2, 2016, 17:53
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Are you sure you're interpreting the code you've copied above? There are less than 35 lines of code (your first error mentions an error on line 35) and "f_loop_last" (your second error) is not found in your code.

Try compiling instead of interpreting UDFs (more stable) and the pulse can be applied within the DEFINE_PROFILE macro without using the second macro (CURRENT_TIME is available at each step the profile is applied to the boundary).
`e` is offline   Reply With Quote

Old   January 2, 2016, 18:29
Default
  #3
New Member
 
Join Date: Dec 2015
Posts: 2
Rep Power: 0
rontgen5 is on a distinguished road
Sorry about that, I did not copy the comments at the beginning of the code, which I had written for my benefit.

Thank you very much for your help. But, I figured out yesterday that DEFINE_PROFILE with CURRENT_TIME was all I needed. So I was able to interpret the UDF. Although now, I am trying to find a way to check if the pulse was applied or not. So its its more like a question of reading the data.

Let's see what happens, once I figure out how to read if the pulse was applied at the instances I wanted.
rontgen5 is offline   Reply With Quote

Old   August 7, 2019, 02:20
Default
  #4
New Member
 
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6
Azim07 is on a distinguished road
Rontgen can you please send your UDF which ran without error?
Azim07 is offline   Reply With Quote

Old   August 8, 2019, 00:56
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include "udf.h"
DEFINE_PROFILE(HeatPulse, t, i)
{
face_t f;
real time=0;
real q;
time=CURRENT_TIME;
if ((time>=0.05)&&(time<=0.06))
	q=10000;
else
	q=0;
begin_f_loop (f,t)
{
	F_PROFILE(f,t,i) = q;
}
end_f_loop(f,t)

}
best regards
AlexanderZ is offline   Reply With Quote

Old   August 8, 2019, 03:04
Default
  #6
New Member
 
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6
Azim07 is on a distinguished road
Thanks a lott Alaxender
Azim07 is offline   Reply With Quote

Reply

Tags
fluent, heat flux, udf


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
UDF for a time varying heat flux boundary condition B.Hamada Fluent UDF and Scheme Programming 9 August 8, 2018 12:51
temperature dependent heat flux on wall tjliang OpenFOAM Running, Solving & CFD 0 December 8, 2014 09:37
Variable heat flux with UDF with respect to Duct Area famon FLUENT 1 November 25, 2014 09:42
Problem in UDF time dependent vloumetric heat source eng_yasser_2020 Fluent UDF and Scheme Programming 0 March 30, 2014 08:07
Space- and time-dependant heat flux via UDF flotus1 Fluent UDF and Scheme Programming 4 September 10, 2012 08:00


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