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

'If' and 'and' statements on CFD-Post

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 22, 2020, 17:27
Post 'If' and 'and' statements on CFD-Post
  #1
New Member
 
Elías Bracho
Join Date: Dec 2020
Posts: 2
Rep Power: 0
elias_bracho is on a distinguished road
Hello everyone, I am having some trouble programming an expression for calculating the theta angle variable in a circumference. As it is known, the angle in a rectangle triangle can be calculated with the function theta = ATAN(Y/X). Now, for the 4 quadrants in a circumference this expression may vary, since X and Y change their signs.

What I want to programme with the 'if' statement is something like this

if X>0 and Y>0, then theta=ATAN(Y/X) (1st quadrant)
if X<0 and Y>0, then theta=ATAN(Y/X) + 90 (2nd quadrant)
if X<0 and Y<0, then theta=ATAN(Y/X) +180 (3rd quadrant)
if X>0 and Y<0, then theta=ATAN(Y/X) + 270 (4th quadrant)

I know the 'if' statement works like this on CFD-Post:

if(condition, result when true, result when false),

however, my problem is that I have two conditions for each of the four cases and haven't been able to relate them in the 'condition' part of the 'if' statement , as I mentioned before. I appreciate any tip or help.

Thank you,
Elias
elias_bracho 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



All times are GMT -4. The time now is 03:37.