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

Conditional IF statement errors in CEL

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2019, 12:58
Question Conditional IF statement errors in CEL
  #1
New Member
 
Join Date: Oct 2019
Posts: 2
Rep Power: 0
squar_o is on a distinguished road
I am using ANSYS Windmodeller for ANSYS CFX 18.0. This uses .pre files written in CEL to set up the physics.

I am making modifications to a .pre file as below:

original working .pre file:
Code:
LIBRARY:
  CEL:
    EXPRESSIONS:
        DX = exp(-0.5* (3.5*(RXdir-RD)/WDH) ^2) [kg m^-3 s^-1])
modified to include conditional:
Code:
LIBRARY:
  CEL:
    EXPRESSIONS:
        DX = exp(-0.5* (3.5*(RXdir-RD)/WDH) ^2) [kg m^-3 s^-1])
	    if( x>0, DX = DX, DX = 0 )
As far as I can see from the CFX docs this follows the conventions of an if statement: if( cond_expr, true_expr, false_expr ). But I get the following error:

ERROR – CCL parser failed with message:
Invalid parameter name “if(x>0, DX” : contains invalid character ‘(‘

the same '(' are used in other parts of the .pre file so I am unsure of what is causing the problem
squar_o is offline   Reply With Quote

Old   October 21, 2019, 18:20
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
You are not using the if statement correctly. Try this:

temp = exp(-0.5* (3.5*(RXdir-RD)/WDH) ^2) [kg m^-3 s^-1])
DX = if( x>0, temp, 0 )
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   October 23, 2019, 06:51
Default
  #3
New Member
 
Join Date: Oct 2019
Posts: 2
Rep Power: 0
squar_o is on a distinguished road
Thank you very much for the input, it works. Unsurprisingly the answer was right in front of me in the docs - I just misinterpreted it
squar_o is offline   Reply With Quote

Reply

Tags
cel expression, conditional if statement


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
Building OpenFOAM1.7.0 from source ata OpenFOAM Installation 46 March 6, 2022 14:21
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 05:13
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 08:09
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 03:20
Help for the small implementation in turbulence model shipman OpenFOAM Programming & Development 25 March 19, 2014 11:08


All times are GMT -4. The time now is 17:48.