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

"while" command in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 27, 2004, 04:30
Default "while" command in UDF
  #1
wim vos
Guest
 
Posts: n/a
hey you all, i'm modelling a user defined pressure outlet. in my model i have 4 different equations for the pressure (dependent on time). i tried to model it with a 'while' command. fluent compiles my C file but if i try to initialize fluent keeps on working (uses all possible memory of my computer, let it run over the night and still running)

i include my c-file so that u can see what i did. i hope that somebody can give me an answer.

thanks in advance

WIm

#include "udf.h"

DEFINE_PROFILE(outlet_snif1, thread, nv) { face_t f; real t = RP_Get_Real("flow-time");

begin_f_loop (f,thread)

{

do

{

F_PROFILE(f,thread,nv) = 0 * pow(t,0) + 0 * pow(t,1) - 7.615e+012 * pow(t,2) + 1.588e+012 * pow(t,3) - 1.371e+011 * pow(t,5) + 6.346e+009 * pow(t,6) - 1.708e+008 * pow(t,7) + 2.702e+006 * pow(t,8) - 2.383e+004 * pow(t,9) - 1.018 * pow(t,10);

}

while (t <= 5.133333333333333 * pow(10,-2));

do

{

F_PROFILE(f,thread,nv) = - 3.345e+004 * pow(t,0) + 6.08e+004 * pow(t,1) - 4.782e+004 * pow(t,2) + 2.131e+004 * pow(t,3) - 5915 * pow(t,5) + 1057 * pow(t,6) - 121.4 * pow(t,7) + 8.604 * pow(t,8) - 0.3407 * pow(t,9) - 94.82 * pow(t,10);

}

while (t <= 3.336666666666666 * pow(10,-1));

do

{

F_PROFILE(f,thread,nv) = 6.862e+012 * pow(t,0) - 8.426e+012 * pow(t,1) + 0 * pow(t,2) + 3.467e+012 * pow(t,3) + 0 * pow(t,5) - 2.062e+012 * pow(t,6) + 1.332e+012 * pow(t,7) - 3.89e+011 * pow(t,8) + 5.652e+010 * pow(t,9) - 3.326e+009 * pow(t,10);

}

while (t <= 3.843333333333333 * pow(10,-1));

do

{

F_PROFILE(f,thread,nv) = 3.723e+006 * pow(t,0) - 4.643e+006 * pow(t,1) + 0 * pow(t,2) + 0 * pow(t,3) + 4.662e+006 * pow(t,5) - 5.81e+006 * pow(t,6) + 3.217e+006 * pow(t,7) - 9.54e+005 * pow(t,8) + 1.485e+005 * pow(t,9) - 9587 * pow(t,10);

}

while (t > 3.843333333333333 * pow(10,-1));

} end_f_loop (f,thread) }
  Reply With Quote

Old   February 27, 2004, 09:58
Default Re: "while" command in UDF
  #2
Ale
Guest
 
Posts: n/a
Hi Wim, remember that your UDF is executed before each iteration, and all cycles need to exit before going to the following iteration. If you use the do{}while cycle, checking the value of t, but not changing t in the body of the cycle, if t satisfies the condition once, it will satisfy it again and again, and the program will never exit the cycle.

I think you should replace the do{}while cycle with an if() control

I hope this helps.

Ale
  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
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 07:37
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 04:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


All times are GMT -4. The time now is 15:39.