# If Statement

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

 June 17, 2010, 10:03 If Statement #1 Senior Member   Join Date: Jan 2010 Location: Germany Posts: 268 Rep Power: 9 hello, i want to know why my If statement doesn't work if write: if(Water.Volume Fraction==0.5,Velocity1,Velocity2) although, Water.Volume Fraction can be 0.5 in my domain (my interphase)... I want to write a special expression estimating the wave length on an interphase (for >0.5 it works)

 June 17, 2010, 19:54 #2 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 12,832 Rep Power: 100 Forget C. Try if(Water.Volume Fraction=0.5,Velocity1,Velocity2)

 June 18, 2010, 02:26 #3 Senior Member   Join Date: Jan 2010 Location: Germany Posts: 268 Rep Power: 9 what shall i forget, and = is not a logical operator

 June 18, 2010, 06:04 #4 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 12,832 Rep Power: 100 == is a logical operator in C. That's why I said forget C as CFX does not use C for expressions. = is a logical operator in CEL.

 June 18, 2010, 09:43 #5 Senior Member   Join Date: Jan 2010 Location: Germany Posts: 268 Rep Power: 9 WARNING Syntax error detected in the expression assigned to 'mfrac'. Successfully read 24 characters: if(Water.Volume Fraction then error detected at: =0.5,1,2) Details - Unexpected character. ERROR Syntax error detected in the expression assigned to 'mfrac'. Successfully read 24 characters: if(Water.Volume Fraction then error detected at: =0.5,1,2) Details - Unexpected character. ----------------------- i i should use "==" and this statement delivers wrong results ( as if Water.Volume Fraction never takes the value 0.5)

 June 19, 2010, 06:09 #6 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 12,832 Rep Power: 100 I see - in that case you may well be right about the ==. And as you say, VF is never exactly 0.5 so it will never be true anywhere. You will have to specify a range - and I don't think CEL supports AND/OR statements. You may have to construct this logic the hard way with step() functions eg step(VF-0.4)*step(0.6-VF) to find nodes where VF is between 0.4 and 0.6.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post rugabug Main CFD Forum 0 March 26, 2010 20:19 balkrishna Main CFD Forum 0 October 6, 2009 23:55 kbs FLUENT 16 May 9, 2008 08:15 mike Main CFD Forum 0 October 8, 2006 12:01 Curtis FLUENT 1 December 11, 2002 22:34

All times are GMT -4. The time now is 18:44.