Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

If-elseif-else statements within cfd post expression

    • bradenkerr
      Subscriber

      Hello,

      I am new to using Fluent and I am looking to create an expression in CFD post that has if-elseif-else structure. I am modeling two cylinders that are parallel in the z-axis direction and I have flow in the x direction. Hence, I have flow over the top and bottom of two cylinders. I want to plot the pressure vs theta around the cylinder, so I was hoping to use the following format but keep getting errors

      if ( 0[m] Y>-.1[m], acos(X/.05[m], acos(X/.05[m]))

      This would define theta as positive when its in on the upper half of either cylinder, or negative when its on the bottom.

      I want to do this so I can create a chart that has all four lines overlaid and from what I understand all four need the same x axis variable to do that.

      Any help is appreciated.

    • DrAmine
      Ansys Employee
      What about using abs function?
    • bradenkerr
      Subscriber
      Since I would like to chart all four "halfs" of the cylinders that are visable, using abs would map the bottom half of the upper and the lower half cylinder on the same values. Instead, I would like the bottom half of the top cylinder to be 0 to -90 and the top half of the bottom cylinder to be 0 to 90, hence the need for the or conditional. I realize my original if statement doesn't actually do that, so here is the fixed version, now I just need help figuring out how to properly implement it.
      if ( 0[m] However, I also get the error that its an invalid function call, so I don't think I am typing it correctly in the first place. To clarify, Im typing this in the expression window, not in the command editor.
    • DrAmine
      Ansys Employee
      If relying on this https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v202/en/cfx_ref/i1346469.html is not working I will then check next week. Try to put the operands in parentheses.
    • bradenkerr
      Subscriber
      Im a student so unfortunately cant access that page.
    • DrAmine
      Ansys Employee
      You can access the Online Help Just hit F1.
    • DrAmine
      Ansys Employee
      Something like this should work: if ( ((0[m]0.1[m])), Value if TRUE, Value if FALSE)
Viewing 6 reply threads
  • The topic ‘If-elseif-else statements within cfd post expression’ is closed to new replies.