# Expression in cfx

 Register Blogs Members List Search Today's Posts Mark Forums Read

 July 1, 2016, 11:53 Expression in cfx #1 New Member   Join Date: Oct 2015 Posts: 3 Rep Power: 7 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 (TTlower) 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.

 July 2, 2016, 07:56 #2 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 16,544 Rep Power: 128 CEL uses the if(,,) 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.

 July 2, 2016, 14:18 #3 New Member   Join Date: Oct 2015 Posts: 3 Rep Power: 7 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

 Tags cel expression, cfx, viscosity