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

Expression in cfx

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 1, 2016, 11:53
Default Expression in cfx
  #1
New Member
 
Join Date: Oct 2015
Posts: 3
Rep Power: 11
dfernandez is on a distinguished road
Hi

I will like to insert a cel expression with the following information

Visupper = 271.8171 [kg m^-1 s^-1]
Vislower = 7689.3521 [kg m^-1 s^-1]
Tupper = 338.7055 [K]
Tlower = 310.9278 [K]
IF (T>Tupper)
VisT = 271.8171 [kg m^-1 s^-1]
END IF
IF (T<Tlower)
VisT = 7689.3521 [kg m^-1 s^-1]
IF (T=Tupper)
VisT = 271.8171 [kg m^-1 s^-1]
END IF
IF (T=Tlower)
VisT = 7689.3521 [kg m^-1 s^-1]
END IF
IF (T<Tupper.AND.T>Tlower)
VisT = Vislower+ (Visupper-Vislower)*(T-Tlower)/(Tupper-Tlower)

I wrote it in FORTRAN language but i got this error for example

ERROR
CCL parser failed with message:
parseCCLLineH: syntax error near "IF (T>Tupper)"

If use IF (T.GT.Tupper), I got the same error.


Can any one guide me to write it well? . Or is there another easy way to introduce that calculation?

Thanks in advance.
dfernandez is offline   Reply With Quote

Old   July 2, 2016, 07:56
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
CEL uses the if(<true/false>,<action if true>,<action if false>) format which is a little different to fortran. But still pretty simple so I will let you transcribe it. Note that CEL does not execute line by line like fortran - so you will have to put the entire logic in a single line (or break it up with intermediate variables).

But your function is complex enough that it will require several nested if statements. Thus I recommend you use a 1D interpolation function as it is much simpler and you can put in as many bends and wiggles as you like and the function stays simple.
ghorrocks is offline   Reply With Quote

Old   July 2, 2016, 14:18
Default
  #3
New Member
 
Join Date: Oct 2015
Posts: 3
Rep Power: 11
dfernandez is on a distinguished road
Thanks for your response.

i figured out and i did this.

I did an aproximation for the curve i had ( can't attached the curve) to two linear equations.

y = -270.99x + 92062
y = -13.083x + 4707.2

then i created 3 expressions

Vis1= -270.99x + 92062
Vis2 = -13.083x + 4707.2
VisT= if ( T<=338.7055333[K],Vis1,Vis2)

I hope not to get the ENFORCED BOUNDS error.

Thanks for your advice Glenn
dfernandez is offline   Reply With Quote

Reply

Tags
cel expression, cfx, viscosity


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
Outlet boundary condition in interFoam Andrea_85 OpenFOAM Running, Solving & CFD 51 July 20, 2017 14:31
CFX CEL expression for the Dyer boundary layer model equation mujahidbadshah CFX 0 April 21, 2016 11:21
How to install CGNS under windows xp? lzgwhy Main CFD Forum 1 January 11, 2011 19:44
CFX Expression Statement Ivan CFX 3 June 5, 2006 12:42
cfx expression variables Manoj Kumar CFX 2 February 16, 2006 11:03


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