|
[Sponsors] |
June 17, 2010, 11:03 |
If Statement
|
#1 |
Senior Member
Join Date: Jan 2010
Location: Germany
Posts: 268
Rep Power: 17 |
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, 20:54 |
|
#2 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
Forget C. Try if(Water.Volume Fraction=0.5,Velocity1,Velocity2)
|
|
June 18, 2010, 03:26 |
|
#3 |
Senior Member
Join Date: Jan 2010
Location: Germany
Posts: 268
Rep Power: 17 |
what shall i forget, and = is not a logical operator
|
|
June 18, 2010, 07:04 |
|
#4 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
== 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, 10:43 |
|
#5 |
Senior Member
Join Date: Jan 2010
Location: Germany
Posts: 268
Rep Power: 17 |
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, 07:09 |
|
#6 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
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.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Weak statement for Galerkin Method | rugabug | Main CFD Forum | 0 | March 26, 2010 20:19 |
Problem Statement | balkrishna | Main CFD Forum | 0 | October 7, 2009 00:55 |
Need help with statement in Gambit | kbs | FLUENT | 16 | May 9, 2008 09:15 |
marking statement in Latex | mike | Main CFD Forum | 0 | October 8, 2006 13:01 |
UDF "AND" Statement | Curtis | FLUENT | 1 | December 11, 2002 22:34 |