"if" command in CFX-13 is not really an "if" command!!!!
I am trying to make a conditional expression with "if" command in CFX-13.
Amazingly, the if command is not true...:eek:
for example, create this expression and see the results!!!
if we see the results for any a>5 (e.g. "a=6") the results must be 10
However, the CFX-post tried to calculate the value of "loge(5-a)" which will be an mathematical error.
Seemningly, before applying the if command, the CFX-POST calculated the consequences .....
Any Idea or Alternative solution!!!???
This is answered in the CFX Reference Guide, section 13.2.2.
CEL supports the conditional if statement using the following syntax:
if( cond_expr, true_expr, false_expr )
cond_expr: is the logical expression used as the conditional test
true_expr: is the mathematical expression used to determine the result if the conditional test is true.
false_expr : is the mathematical expression used to determine the result if the conditional test is false.
Note:**The expressions true_expr and false_expr are always evaluated independent of whether the evaluation of cond_expr is true or false. As a consequence, a conditional statement cannot be used to avoid division by zero as in if( x>0, 1/x, 1.0). In this case, when x=0.0, a division by zero will still occur because the expression 1/x is evaluated independent of whether x>0 is satisfied or not.
thank you very much for your infos, which is quite helpful to me. But, what can I do, if i do need the ,,real'' conditional statement? Is there a alternative maybe?
If you are asking how to get around the caveat Chris mentions (that both true and false expression must evaluate or you get an error) - then the best way around this is to use a fortran user routine where you can use if/then/else statements. This is reasonably easy to do, use a user CEL expression linked to the fortran routine. See the documentation for details, it has examples of how to do it.
|All times are GMT -4. The time now is 23:23.|