CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   SolidBodyMotion planetary rotation (https://www.cfd-online.com/Forums/openfoam-programming-development/223151-solidbodymotion-planetary-rotation.html)

RoeschA December 27, 2019 10:17

SolidBodyMotion planetary rotation
 
Hello everybody,


i hope everyone had a merry Christmas.


I'm writing a thesis and I'm stuck at a new superimposed SolidBodyMotion for the IBS methode. I'm trying to write a rotation of an object, which is rotating around its own axis and around a global point. For example like the moon is rotating around it self and around the earth.


I tried a lot of versions but nothing is working.


Version 1:



//Global Rotation

const vector rotation2 = omega2_*t;

const quaternion R2(rotation2.x(), rotation2.y(), rotation2.z());
const septernion TR2
(
septernion(origin2_)*R2*septernion(-origin2_)
);

const vector rotation = omega_*t;



//Rotation around own axis


const quaternion R(rotation.x(), rotation.y(), rotation.z());
const septernion TR
(
septernion(origin_)*R*TR2*septernion(-origin_)
);
return TR;
}


I tried to rotate the object around the global central and add the calculated coordinates to the rotation around the own axis, but it does not work.



Version 2:


//calculation of the orbital coordinates



const vector translation =
vector
(
radius_.x()*cos(omega_.x()*t),
radius_.y()*sin(omega_.y()*t),
0*sin(omega_.z()*t)
);


//addition of the orbital coordinates to the origin to move the origin on the orbit


const quaternion R(rotation.x(), rotation.y(), rotation.z());
const septernion TR
(
septernion(origin_ + translation)*R*septernion(-origin_)
);
return TR;
}


I tried a lot more, but still had no success.



I would be very thankfull for some tipps or a solution.


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