CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Angle variable under CEL. (

Gloria Gaynor April 15, 2004 15:13

Angle variable under CEL.
I'm working on a multiphase rotating frame of reference test case. As long as I apply the rotation (which is not constant) I have to correct the gravity components (i.e. a function of the domain rotation). This issue is explained on the manual but I could not find which is the name of the angle variable which is printed in the out file as the simulation runs. An example of the output is given below:

================================================== ==================== TIME STEP = 544 SIMULATION TIME = 2.85E+01 CPU SECONDS = 3.34E+05 (THIS RUN: 7 7.90E-01 2.71E+02) ---------------------------------------------------------------------- Domain: Rotor rotated -1.67E+02 degrees ( 0.464 pitches) ---------------------------------------------------------------------- Domain interface: Slide Interface

Non-overlap area fraction on side 1 = 0.0 %

Non-overlap area fraction on side 2 = 0.0 %

Pitch ratio: (area side 1)/(area side 2) = 1.000 ----------------------------------------------------------------------

I want to capture this angle (-1.67E+02 degrees) to apply a CEL expression of the gravity components like this:
GravX = 9.81 [m s^-2] * sin(alpha) GravY = 9.81 [m s^-2] * cos(alpha)
I look at the CFX5RULES and CFX5VAR files but it didn't help at all. The manual suggests that I should build the gravity expression as a function of the angular velocity (which, by the way, is function of time). However, the angular velocity is not constant and is hard to figure out what is the exact angle to perform the CEL expression.
Therefore I'm looking a way to get this angle to implement the expression. How is the internal solver name of this variable and how can I get it into CEL?
Thanks in advance, G. G.

Juan Carlos April 15, 2004 16:29

Re: Angle variable under CEL.
Unfortunately, that variable is not available via CEL and you will require detailed explanation (developer help) of how to access it via User Fortran.

However, since you know the expression for angular velocity, you could integrate it analitically/numerically and create a local angle variable. Then, you match the gravity vector with your local angle variable..

Good luck, Juan Carlos

Shawn_A November 17, 2012 14:51

Rotated degrees or pitches of rotating domain
Has this functionality changed in CFX since these posts? I have a rotating domain and a stationary domain and I would like to output to a monitor (or somewhere) how many degrees or pitches that my rotating domain has traveled. This value appears in the output file, but does not appear to be available as a variable or expression. Even the relative angle between the rotating and stationary domains would be enough.

Could the variable theta be used at all, applied to the rotating domain for example?


ghorrocks November 17, 2012 20:06

Not sure, why not just try it and find out?

Shawn_A November 18, 2012 15:07

I looked through the help files but couldn't find any variables for "rotated degrees" or similar. I tried a couple names like "rotated" "rotateddegrees" etc. but all gave me errors.

I'm also not sure how to use "theta" in an expression. Tried theta@blade1 and theta()@blade1 but both gave errors. Apparently theta on its own is not single valued. I had considered using time and multiplying by the rotation speed, but since I may have used anoter different speed case as the IC's, the speed would not be have been constant.

I wouldn't have a problem if rounding errors didn't very slowly cause the angular displacement to drift off the 1 degree increments I set. After maybe 4000 timesteps instead of 4000 degrees I'm at 4000.7, for example. The problem keeps getting worse if I use the results from one case as the IC's for another.

ghorrocks November 18, 2012 16:47

Try the variable "Rotation Velocity". Multiply that by time (and assuming it is constant) you have it. Theta is an available variable but I am not quite sure how to call it.

Also if you use a CEL expression to set the rotational velocity and then use that same expression to calculate theta you should not have the precision error.

Shawn_A November 19, 2012 00:00

Hi Glenn,

I used the CEL expression "1 [s] * ( 60 / 158 ) / 360" to set my timesteps as 1 degree increments corresponding an angular speed of 158 RPM for my rotating domain. The rotating domain speed was simply set as 158 with the rev/min option chosen. Rotational velocity is constant within each case.

I don't know how to calculate theta, or how to reference it to a single location or value. Error says that theta is a field variable.

ghorrocks November 19, 2012 06:09

You could convert theta to a single value with avg(theta)@domain_name.

Alternately: If you define some values with CEL, like:
RotSpeed=158 [rpm]

Then set your time step equal to TimeStep, the rotational velocity as RotSpeed and then theta will be TimeStep*RotSpeed. This might improve the accuracy of the calculation.

brunoc November 20, 2012 17:35


Originally Posted by ghorrocks (Post 392910)
Then set your time step equal to TimeStep, the rotational velocity as RotSpeed and then theta will be TimeStep*RotSpeed.

Actually, theta will be 'Time*RotSpeed'. 'TimeStep*RotSpeed' will give dTheta.


ghorrocks November 20, 2012 18:28

Yes, well spotted. Thanks for the correction.

Shawn_A November 25, 2012 11:50

I tried ave(theta)@Rotor and got the error that the "solver does not support the use of this variable in this context." Tried a couple other quantitative functions too like volume(), volumeAve() and areaAve() with the same result. Oh well...

I've defined my values a bit differently now with CEL so I'll see how that works out. Thanks for the help

brunoc November 26, 2012 07:29

The solver won't let you calculate averages of some variables, but I think you can trick it into doing that by creating an algebraic additional variable that is equal to the variable you want to measure (theta, in your case) and then average this variable instead.

But what about just getting the theta value from time and rotational speed? That didn't work out?

All times are GMT -4. The time now is 19:00.