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

Unsteady temperature profile

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Sixkillers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 28, 2012, 16:19
Unhappy Unsteady temperature profile
  #1
New Member
 
Rachana Vidhi
Join Date: Dec 2012
Posts: 8
Rep Power: 13
rachana is on a distinguished road
Hi, I am trying to define unsteady temperature profile in Fluent. The same profile has to be repeated everyday, where the temperature linearly increases from 300 K to 305 K for 1st 8 hours, then linearly decreases back to 300 K in the next 8 hours and then remains constant at 292 K for the last 8 hours. I am using the following code for the udf. But the result I am getting shows the temperature to increase continuously using the 1st profile (but it doesn't stop at 305 and just keeps increasing). Please help me out here. I had been struggling with this for days.


#include "udf.h"

DEFINE_PROFILE(unsteady_temperature, thread, position)
{
face_t f;
int n;
real t = CURRENT_TIME;

begin_f_loop(f, thread)

{

for (n=1; n<=31; n+=3)

{

if (CURRENT_TIME <= 3600*8*n)
F_PROFILE(f, thread, position) = 300.0 + 5.0 * (t/8.0/3600.0);

else if(CURRENT_TIME <= (3600*8*(n+1)))
F_PROFILE(f, thread, position) = 305.0 - 5.0/8.0 * (t/3600.0-8.0);

else
F_PROFILE(f, thread, position) = 292.0 + 0.0 * t;

}

}

end_f_loop(f, thread)

}
rachana is offline   Reply With Quote

Old   December 29, 2012, 03:59
Default
  #2
Member
 
Join Date: Nov 2011
Location: Czech Republic
Posts: 97
Rep Power: 14
Sixkillers is on a distinguished road
Obviously your solution through for cycle isn't working as you want. I think that much more easier solution is just to simply subtract number of days from current time and then use it in your "decision tree". So here is my approach:

PHP Code:
#include "udf.h"

DEFINE_PROFILE(unsteady_temperaturethreadposition)
{
  
face_t f;
  
int days;
  
real t CURRENT_TIME;
  
  
days = (int)(/(24.0*3600.0));
  
24.0*3600.0*days;

  
begin_f_loop(fthread)
  {
    if (
<= 3600*8)
      
F_PROFILE(fthreadposition) = 300.0 5.0 * (t/8.0/3600.0);
    else if(
<= (3600*16))
      
F_PROFILE(fthreadposition) = 305.0 5.0/8.0 * (t/3600.0-8.0);
    else 
      
F_PROFILE(fthreadposition) = 292.0 0.0 t;
  }
  
end_f_loop(fthread)

I did not test it too much, so it is up to you
rachana likes this.
Sixkillers is offline   Reply With Quote

Old   December 29, 2012, 09:16
Default
  #3
New Member
 
Rachana Vidhi
Join Date: Dec 2012
Posts: 8
Rep Power: 13
rachana is on a distinguished road
Thank you very very much. It worked. I had done 2 days analysis by subtracting 24 hours in 2nd day profile. But didn't know how to extend it for longer period of time. Thanks a lot.
rachana is offline   Reply With Quote

Reply

Tags
for-if-else, unsteady temperature


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
Plot temperature profile David FLUENT 4 July 24, 2017 05:35
UDF: temperature profile dolores FLUENT 6 August 5, 2016 20:16
Please Help! Temperature profile UDF for 3D geometry subhankar_bhandari FLUENT 2 April 16, 2011 05:30
velocity and temperature profile panagiotis FLUENT 2 May 1, 2009 07:05
unsteady inlet profile Justin Main CFD Forum 0 July 4, 2007 13:58


All times are GMT -4. The time now is 02:20.