rigidBodyMotion linearAxialAngularSpring theta angle appears to be incorrectly signed - spring acts in wrong direction
Summary
Theta angle used in (at least) linearAxialAngularSpring.C
in the rigidBodyMotion solver appears to be signed incorrectly.
Steps to reproduce
Apply the linearAxialAngularSpring restraint to a body, and observe it be pulled in the wrong direction. Have tested with pimpleDyMFoam. This has occured on another case which I cannot share, so I have created a new one from one of the tutorials.
Modifying the code for this restraint to ouptut the current angular position shows that the "theta" variable is signed incorrectly. For example a clockwise rotation around the z axis of 45° will be reported as 45° instead of -45°.
Example case
Attached a case modified from the overset airfoil simpleFoam tutorial. It has been made transient, switched to rigidBody, and a spring constraint has been applied. Increasing the stiffness of this spring exacerbates the movement of the airfoil rather than assisting.
What is the current bug behaviour?
Spring moment acts in wrong direction.
What is the expected correct behavior?
A positive rotation should create a negative torque.
Relevant logs and/or images
In the example case, I have attached a spring at the bottom of the domain to the airfoil with an Rz joint. The spring pulls the airfoil down and to the right, and this is accelerated for higher spring stiffnesses. Some movement in that direction is expected for the aerodynamic load, but it should reduce with increasing stiffness rather than worsen.
The case should be run with a stiffness of 1 and then with a stiffness of 100 to observe the issue.
Alternatively, add an Info <<
message reporting the theta angle of the airfoil body at line 143 of linearAxialAngularSpring.C
: it is signed incorrectly for the observed rotations.
Environment information
- OpenFOAM version : v2112
- Operating system : WSL - OpenSUSE Leap 15.4
- Hardware info : x86_64
- Compiler : gcc
Possible fixes
Manual flip to theta's sign on line 112
of linearAxialAngularSpring.C
. But I have not been able to get to the bottom of why this is incorrectly signed to begin with. Could this just be due to case configuration?