CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   conditional CEL function (https://www.cfd-online.com/Forums/cfx/85906-conditional-cel-function.html)

fek66 March 9, 2011 06:54

conditional CEL function
 
Hi all ;
How can I set a cel function in CfX PRE to make this expression :
sigma = 0.5 for z > 1 end sigma = 0 for z<=1 sigma is constant value.
thanks.

octavyo March 9, 2011 07:12

CEL supports the conditional if statement using the following syntax:

if( cond_expr, true_expr, false_expr )

where:

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.


Then for your case, CEL expression is

if(z > 1,0.5, 0)

fek66 March 9, 2011 08:20

thanks oktavyo ;
but is the condition if(z > 1,0.5, 0) return the true value 0.5?
how can I write it sigma = if(z > 1,0.5, 0) ?

octavyo March 9, 2011 08:23

Just set the name of the expression as sigma and use it where you need

fek66 March 9, 2011 08:28

thanks octavyo

fek66 March 10, 2011 06:40

Hi oktavyo ;
need a doc about CEL Function if possible .

octavyo March 10, 2011 07:25

I think CFX Help menu is good enough to solve most of problems. Just read the user manuel about CEL. You can also download training document from ansys costumer portal. or search on google.

fek66 March 11, 2011 11:38

Hi octavyo ;
I used the conditional expression but it seems not working !

fek66 March 11, 2011 12:32

the if function don't found in cfx 11 !

octavyo March 12, 2011 07:36

If possible, try to use CFX 12

mao November 14, 2016 13:17

hi, have you solved this, i want expressT322= if(0.1<E22<0.2,T3-0.5, T3) , but it always say it is not correct using 0.1<E22<0.2.

ghorrocks November 14, 2016 15:50

Just use nested if statements:

expressT322= if(0.1<E22,if(E22<0.2,T3-0.5, T3),T3)

Note that you have not defined units. You should define units if these quantities have units.

mao November 17, 2016 09:44

yes, thank you so much, i used this.

MASOD November 8, 2017 17:05

cfl in cfx
 
hi all:
haw can i write a exprision for time dippendent udf?

urosgrivc November 9, 2017 01:31

You can use wariables like (acumulated timestep, time or time this run) and similar;
something like;

if(accumulated timestep>10,1,0)
...(1,0) can have units and can be any number or seperate expression like next example.

something like;

if(time>5[s],10[W m^-2],5[W m^-2])
...5[W m^-2] <=> could also be an expresion dependant on other stuf, maybe temperature or angular velocity or whatever, the sky is the limit.

It is also posible to do it in the second way:

For time (or anithing else) dependant wariables it is very easy to use a user function,
basicaly a table of your data from vhich cfx selects the corect walue for that time.
+You firs create a new user function named (userfun)>vrite units (like [s] for time and your variable let just use [W m^-2] for this example)
+than you write the table of data
+than you make a new expresion caled let say (expresiont) and for the function you use userfun[t]
this will cause cfx to go look in the table and choose the corect number for [W m^-2] in this case.

this [t] will cause it to be time dependant but it can also be used in meny other ways like [T] temperature dependant or vhatever so it is quite a powerfull tool.


All times are GMT -4. The time now is 09:05.