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

How to extract roll angles of 2D floating object?

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 6 Post By CKH

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2012, 11:46
Default How to extract roll angles of 2D floating object?
  #1
CKH
New Member
 
Kie Hian
Join Date: Aug 2011
Location: Singapore
Posts: 19
Rep Power: 14
CKH is on a distinguished road
Hi Foamers,

I'm trying to figure out how to extract / sample the roll angle of a floating box constrained to roll only (1 DoF). It seems like a simple problem but I can't seemed to find anyway of doing it!

The case I'm running is based on: Jung, K.H., Chang, K.A., Jo, H.J., Viscous Effect on the Roll Motion of a Rectangular Structure, J. of Engineering Mechanics, 2006. This was mentioned in the Eric Paterson's slides for 3rd OF workshop and seems to have been used as a demo case a few times. If anyone has ran the case before please do share some hints.

Thanks in advance.
Kie
CKH is offline   Reply With Quote

Old   February 15, 2012, 23:05
Default Get sixDoFRigidBodyMoton functionObject to output "Orientation"
  #2
CKH
New Member
 
Kie Hian
Join Date: Aug 2011
Location: Singapore
Posts: 19
Rep Power: 14
CKH is on a distinguished road
Posting my work-around if it's of help to anyone else:

Go to $FOAM_SRC/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion

Open sixDoFRigidBodyMotion.C file with your favourite editor.

Near the bottom of the file:

After
Code:
<< "Angular velocity: " << omega()
add
Code:
" << nl"
to get std IO to jump to the next line

After the angular velocity line (but before the line that says
Code:
<< endl;
insert
Code:
 << "Orientation: " << Q()
Save and close the file and rerun Allwmake. The next time interDyMFoam is run, the IO will show the values of the Orientation tensor at each time step. The entire stream can be saved in a log file (e.g. log.interDyMFoam).

A bash script (e.g. extractData script found in the simple harmonic motion tutorial) can subsequently be used to extract time step and Orientation tensor value for further post-processing.

I think the orientation (Q) tensor is a rotational matrix generated by rotating in X, Y, Z sequence (still figuring this out at the moment......). If this is the case, then roll (i.e. rotation about Y axis) will be given by asin of the 3,1 element which should be the #7 of the 9 values of the Q tensor.
donQi, zhan, Yage and 3 others like this.
CKH is offline   Reply With Quote

Old   October 13, 2022, 02:15
Default How to extract roll angles of 2D floating object?
  #3
New Member
 
Akshay
Join Date: Jun 2022
Posts: 5
Rep Power: 3
Akshay80 is on a distinguished road
Dear Sir,


I also want to extract roll motion of floating body, as per your suggestions i extract orientation vector and plotted sin(3*1 element) entry w.r.t time. But my plot results are matching with experimental results. please suggest orientation vector only give rotational motion?.


Thanks,
Akshay
Akshay80 is offline   Reply With Quote

Old   October 13, 2022, 20:59
Default
  #4
Member
 
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 13
LongGe is on a distinguished road
Hi Akshay80

The coordinate system of a floating object is defined as follows.

coodinate: x -> surging y -> swaying z -> heaving


The transformation from the orientation tensor to Euler angles is as follows.

Orientation: (1 0 8.03123e-05 0 1 0 -8.03123e-05 0 1)->(xx xy xz yx yy yz zx zy zz)

trace = xx + yy + zz
s = 0.5/sqrt(trace+1)
w = 0.25/s
vx = (zy - yz)*s
vy = (xz - zx)*s
vz = (yx - xy)*s

//make quaternions
t11 = 2*(w*vx - vy*vz)
t12 = w^2 - vx^2 - vy^2 + vz^2
s2 = 2*(vx*vz + w*vy)
t31 = 2*(w*vz - vx*vy)
t32 = w^2 + vx^2 - vy^2 -vz^2

//Conversion between quaternions and Euler angles
angX = atan2(t11, t12) //rolling
angY = asin(s2) //pitching
angZ = atan2(t31, t32) //yawing

See: https://en.wikipedia.org/wiki/Conver...d_Euler_angles
__________________
Our Work: https://www.idaj.co.jp/product/ennovacfd/openfoam_gui/
Powered by Ennova : https://ennova-cfd.com/
Ennova's Channel Partners : http://www.wolfdynamics.com/
LongGe is offline   Reply With Quote

Old   October 14, 2022, 02:57
Default
  #5
New Member
 
Akshay
Join Date: Jun 2022
Posts: 5
Rep Power: 3
Akshay80 is on a distinguished road
Dear Sir,


Thanks for replying,


I plotted the graph as per your suggestions, I got the same graph as if i choose(1*3 element) i.e 3 rd element of orientation vector.
Akshay80 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[foam-extend.org] Error compiling OpenFOAM-1.6-ext Canesin OpenFOAM Installation 137 January 20, 2016 14:56
Inserting a floating object on a restart RileyJ FLOW-3D 0 October 24, 2011 16:05
Floating object in a fluid benjaminm CFX 7 November 14, 2009 05:46
Compilation error OF1.5-dev on Suse10.3 darenyang OpenFOAM Installation 0 April 29, 2009 04:55
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 07:36


All times are GMT -4. The time now is 17:34.