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

If Statement

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2010, 10:03
Default If Statement
  #1
Senior Member
 
Join Date: Jan 2010
Location: Germany
Posts: 268
Rep Power: 17
Zaktatir is on a distinguished road
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)
Zaktatir is offline   Reply With Quote

Old   June 17, 2010, 19:54
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,700
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Forget C. Try if(Water.Volume Fraction=0.5,Velocity1,Velocity2)
ghorrocks is offline   Reply With Quote

Old   June 18, 2010, 02:26
Default
  #3
Senior Member
 
Join Date: Jan 2010
Location: Germany
Posts: 268
Rep Power: 17
Zaktatir is on a distinguished road
what shall i forget, and = is not a logical operator
Zaktatir is offline   Reply With Quote

Old   June 18, 2010, 06:04
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,700
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
== 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.
ghorrocks is offline   Reply With Quote

Old   June 18, 2010, 09:43
Default
  #5
Senior Member
 
Join Date: Jan 2010
Location: Germany
Posts: 268
Rep Power: 17
Zaktatir is on a distinguished road
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)
Zaktatir is offline   Reply With Quote

Old   June 19, 2010, 06:09
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,700
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks 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
Weak statement for Galerkin Method rugabug Main CFD Forum 0 March 26, 2010 19:19
Problem Statement balkrishna Main CFD Forum 0 October 6, 2009 23:55
Need help with statement in Gambit kbs FLUENT 16 May 9, 2008 08:15
marking statement in Latex mike Main CFD Forum 0 October 8, 2006 12:01
UDF "AND" Statement Curtis FLUENT 1 December 11, 2002 21:34


All times are GMT -4. The time now is 16:11.