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

Unable to use if statement in UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2016, 07:19
Default
  #21
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Not an error per se, but something that could be simplified:

Code:
if ( t <= 100.0 )
{
F_PROFILE(f,thread,position) = 379.48 + 0.0004*t;
}
else if (100.0 < t && t <= 180.0 )
...
At the second 'if', you already know that t>100.0, otherwise you would have been in the first 'if'. So you can simplify your code:
Code:
if ( t <= 100.0 )
{
F_PROFILE(f,thread,position) = 379.48 + 0.0004*t;
}
else if (t <= 180.0)
...
And so on for the other 'if's. In this way you don't have to repeat the number, so you are less likely to accidentally type the wrong number.

For the rest: you should tell us if there are errors, or if the udf does not do what you want. We can not guess that.
pakk is offline   Reply With Quote

Old   June 6, 2016, 10:40
Default
  #22
New Member
 
mm
Join Date: May 2016
Posts: 24
Rep Power: 9
mmunige is an unknown quantity at this point
Thank you so much for your help.
there is no error uptill now. further i can check when simulations proceed further. as i am modelling 3d with very fine mesh, so its very slow simulation.

Regards
mmunige is offline   Reply With Quote

Old   June 6, 2016, 11:03
Default
  #23
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
If you want to test this UDF quickly, you can consider to use a smaller mesh.
pakk is offline   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 08:37
USING IF statement in a UDF for defining Velocity profile at Inlet amir2920 Fluent UDF and Scheme Programming 3 May 24, 2013 00:46
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
[Commercial meshers] ST_Malloc: out of memory.malloc_storage: unable to malloc Velocity SA, cfdproject OpenFOAM Meshing & Mesh Conversion 0 April 14, 2009 16:45
UDF "AND" Statement Curtis FLUENT 1 December 11, 2002 22:34


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