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

conditional CEL function

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 4 Post By octavyo
  • 5 Post By ghorrocks

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 9, 2011, 06:54
Default conditional CEL function
  #1
Member
 
anonymous
Join Date: Jan 2011
Posts: 42
Rep Power: 15
fek66 is on a distinguished road
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.
fek66 is offline   Reply With Quote

Old   March 9, 2011, 07:12
Default
  #2
New Member
 
Join Date: Oct 2010
Posts: 14
Rep Power: 15
octavyo is on a distinguished road
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)
amin_gls, mrkmrk, mosi and 1 others like this.
octavyo is offline   Reply With Quote

Old   March 9, 2011, 08:20
Default
  #3
Member
 
anonymous
Join Date: Jan 2011
Posts: 42
Rep Power: 15
fek66 is on a distinguished road
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) ?
fek66 is offline   Reply With Quote

Old   March 9, 2011, 08:23
Default
  #4
New Member
 
Join Date: Oct 2010
Posts: 14
Rep Power: 15
octavyo is on a distinguished road
Just set the name of the expression as sigma and use it where you need
octavyo is offline   Reply With Quote

Old   March 9, 2011, 08:28
Default
  #5
Member
 
anonymous
Join Date: Jan 2011
Posts: 42
Rep Power: 15
fek66 is on a distinguished road
thanks octavyo
fek66 is offline   Reply With Quote

Old   March 10, 2011, 06:40
Default
  #6
Member
 
anonymous
Join Date: Jan 2011
Posts: 42
Rep Power: 15
fek66 is on a distinguished road
Hi oktavyo ;
need a doc about CEL Function if possible .
fek66 is offline   Reply With Quote

Old   March 10, 2011, 07:25
Default
  #7
New Member
 
Join Date: Oct 2010
Posts: 14
Rep Power: 15
octavyo is on a distinguished road
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.
octavyo is offline   Reply With Quote

Old   March 11, 2011, 11:38
Default
  #8
Member
 
anonymous
Join Date: Jan 2011
Posts: 42
Rep Power: 15
fek66 is on a distinguished road
Hi octavyo ;
I used the conditional expression but it seems not working !
fek66 is offline   Reply With Quote

Old   March 11, 2011, 12:32
Default
  #9
Member
 
anonymous
Join Date: Jan 2011
Posts: 42
Rep Power: 15
fek66 is on a distinguished road
the if function don't found in cfx 11 !
fek66 is offline   Reply With Quote

Old   March 12, 2011, 07:36
Default
  #10
New Member
 
Join Date: Oct 2010
Posts: 14
Rep Power: 15
octavyo is on a distinguished road
If possible, try to use CFX 12
octavyo is offline   Reply With Quote

Old   November 14, 2016, 13:17
Default
  #11
mao
New Member
 
mao
Join Date: Mar 2016
Posts: 20
Rep Power: 10
mao is on a distinguished road
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.
mao is offline   Reply With Quote

Old   November 14, 2016, 15:50
Default
  #12
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,703
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   November 17, 2016, 09:44
Default
  #13
mao
New Member
 
mao
Join Date: Mar 2016
Posts: 20
Rep Power: 10
mao is on a distinguished road
yes, thank you so much, i used this.
mao is offline   Reply With Quote

Old   November 8, 2017, 17:05
Default cfl in cfx
  #14
New Member
 
masod
Join Date: Nov 2017
Posts: 1
Rep Power: 0
MASOD is on a distinguished road
hi all:
haw can i write a exprision for time dippendent udf?
MASOD is offline   Reply With Quote

Old   November 9, 2017, 01:31
Default
  #15
Senior Member
 
urosgrivc
Join Date: Dec 2015
Location: Slovenija
Posts: 365
Rep Power: 11
urosgrivc is on a distinguished road
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.
urosgrivc 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
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 06:42
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 04:37
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 00:35
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 14:00


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