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

Time variant temperature of wall

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 12, 2017, 13:50
Default Time variant temperature of wall
  #1
New Member
 
Phanikumar
Join Date: Mar 2016
Posts: 5
Rep Power: 10
phanikumar is on a distinguished road
Hi,

Could anyone please tell me how to define the temperature of the wall in fluent which depends on time. I have approched in away but it shows an error such as "invalid lvalue in assignment.". Please resolve the error in the following program or please let me know how to program this particular scenario as I'm very bad at programming.


Program:

#include "udf.h"

DEFINE_PROFILE(temperature, t, i)
{
real the_current_time;
face_t f;

the_current_time = CURRENT_TIME;

if ((the_current_time>=0) && (the_current_time<=3600))
{
temperature=20;
}
if ((the_current_time>3600) && (the_current_time<=7200))
{
temperature=19;
}
if ((the_current_time>7200) && (the_current_time<=10800))
{
temperature=18;
}
if ((the_current_time>10800) && (the_current_time<=14400))
{
temperature=17;
}
if ((the_current_time>14400) && (the_current_time<=18000))
{
temperature=16;
}
if ((the_current_time>18000) && (the_current_time<=21600))
{
temperature=21;
}
if ((the_current_time>21600) && (the_current_time<=25200))
{
temperature=31;
}
if ((the_current_time>25200) && (the_current_time<=28800))
{
temperature=43;
}
if ((the_current_time>28800) && (the_current_time<=32400))
{
temperature=56;
}
if ((the_current_time>32400) && (the_current_time<=36000))
{
temperature=66;
}
if ((the_current_time>36000) && (the_current_time<=39600))
{
temperature=70;
}
if ((the_current_time>39600) && (the_current_time<=43200))
{
temperature=70;
}
if ((the_current_time>43200) && (the_current_time<=46800))
{
temperature=75;
}
if ((the_current_time>46800) && (the_current_time<=50400))
{
temperature=72;
}
if ((the_current_time>50400) && (the_current_time<=54000))
{
temperature=72;
}
if ((the_current_time>54000) && (the_current_time<=57600))
{
temperature=63;
}
if ((the_current_time>57600) && (the_current_time<=61200))
{
temperature=55;
}
if ((the_current_time>61200) && (the_current_time<=64800))
{
temperature=47;
}
if ((the_current_time>64800) && (the_current_time<=68400))
{
temperature=39;
}
if ((the_current_time>68400) && (the_current_time<=72000))
{
temperature=29;
}
if ((the_current_time>72000) && (the_current_time<=75600))
{
temperature=24;
}
if ((the_current_time>75600) && (the_current_time<=79200))
{
temperature=22;
}
if ((the_current_time>79200) && (the_current_time<=82800))
{
temperature=21;
}
if ((the_current_time>82800) && (the_current_time<=86400))
{
temperature=19;
}

begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = temperature;
}
end_f_loop(f,t)
}
phanikumar is offline   Reply With Quote

Old   July 13, 2017, 07:00
Default
  #2
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
You use "temperature" as both variable and UDF-name. (And you do not define the variable)
KaLium is offline   Reply With Quote

Old   July 13, 2017, 07:02
Default
  #3
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
I would make something like:

Code:


#include "udf.h"

DEFINE_PROFILE(temperature, t, i)
{
real the_current_time, Temp;
face_t f;

the_current_time = CURRENT_TIME;

if ((the_current_time>=0) && (the_current_time<=3600))
{
Temp=20.0;
}
if ((the_current_time>3600) && (the_current_time<=7200))
{
Temp=19.0;
}

...

}
KaLium is offline   Reply With Quote

Old   July 13, 2017, 07:54
Default
  #4
New Member
 
Phanikumar
Join Date: Mar 2016
Posts: 5
Rep Power: 10
phanikumar is on a distinguished road
Hi KaLium,

Thank you verymuch. It's working perfectly.
phanikumar is offline   Reply With Quote

Reply

Tags
udf time 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
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 02:27
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 12:08
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 08:09
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 14:58


All times are GMT -4. The time now is 19:04.