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

If statement for time dependent UDF

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 24, 2014, 06:57
Default If statement for time dependent UDF
  #1
New Member
 
Serhan TATAR
Join Date: Jul 2014
Posts: 6
Rep Power: 8
serhan is on a distinguished road
Hello my friends;

I am currently working on defroster performance on inclined surfaces and I have the attached temperature warm-up curve for inlet condition. I try to write an UDF but every single time it gives parse error for "else" statement line. Anyone knows the rootcause of this error could help me?

************************************************** ******

#include "udf.h"
DEFINE_PROFILE(temperature,thread,position)
{
face_t f;
real t=CURRENT_TIME;
begin_f_loop(f,thread)
t=t-floor(t);
{
if (t>=1750.);
F_PROFILE(f,thread,position)= 323.;
else
F_PROFILE(f,thread,position)=6.*0.000000001*t*t*t-3.*0.00001*t*t+0.0636*t+265.;
}
end_f_loop(f,thread)

************************************************** ******
Thank you..
Attached Images
File Type: jpg Warm up curve.jpg (40.3 KB, 23 views)
serhan is offline   Reply With Quote

Old   July 29, 2014, 00:44
Default
  #2
Senior Member
 
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 21
mprinkey will become famous soon enough
Quote:
Originally Posted by serhan View Post
Hello my friends;

I am currently working on defroster performance on inclined surfaces and I have the attached temperature warm-up curve for inlet condition. I try to write an UDF but every single time it gives parse error for "else" statement line. Anyone knows the rootcause of this error could help me?

************************************************** ******

#include "udf.h"
DEFINE_PROFILE(temperature,thread,position)
{
face_t f;
real t=CURRENT_TIME;
begin_f_loop(f,thread)
t=t-floor(t);
{
if (t>=1750.);
F_PROFILE(f,thread,position)= 323.;
else
F_PROFILE(f,thread,position)=6.*0.000000001*t*t*t-3.*0.00001*t*t+0.0636*t+265.;
}
end_f_loop(f,thread)

************************************************** ******
Thank you..
This is just a C coding error. Remove the semicolon from the end of the if (t>=1750.) line. You are getting a parse error because that semicolon ends the if statement. The following F_PROFILE() is its own statement independent of the if. The else line doesn't have an associated if, so you get a parse error.
mprinkey is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
temperature dependent deviation hebeldebel STAR-CCM+ 7 July 30, 2014 11:44
Temperature dependent propertys and finalIteration in chtMultiRegionFoam waiter120 OpenFOAM 0 February 20, 2013 06:22
question about a temperature dependent HTC Christoph Ley Phoenics 2 June 5, 2008 10:05
Temperature dependent property kdarc OpenFOAM Running, Solving & CFD 3 March 27, 2007 17:21
to take K & Cp as temperature dependent kishore rathore FLUENT 1 February 17, 2004 05:33


All times are GMT -4. The time now is 21:33.