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. |
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) |
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) ? |
Just set the name of the expression as sigma and use it where you need
|
thanks octavyo
|
Hi oktavyo ;
need a doc about CEL Function if possible . |
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.
|
Hi octavyo ;
I used the conditional expression but it seems not working ! |
the if function don't found in cfx 11 !
|
If possible, try to use CFX 12
|
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.
|
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. |
yes, thank you so much, i used this.
|
cfl in cfx
hi all:
haw can i write a exprision for time dippendent udf? |
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. |