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/)
-   -   Help with understanding how angularOscillatingDisplacementPointPatchVectorFiel d.C (https://www.cfd-online.com/Forums/openfoam-programming-development/234232-help-understanding-how-angularoscillatingdisplacementpointpatchvectorfiel-d-c.html)

quarkz February 27, 2021 11:03

Help with understanding how angularOscillatingDisplacementPointPatchVectorFiel d.C
 
Hi,

I am trying to understand how angularOscillatingDisplacementPointPatchVectorFiel d.C works. This is the source code for angularOscillatingDisplacement, which rotates the body in a sinusoidal manner.

The main formula is:

vectorField::operator=
(
p0Rel*(cos(angle) - 1)
+ (axisHat ^ p0Rel*sin(angle))
+ (axisHat & p0Rel)*(1 - cos(angle))*axisHat

);

But this doesn't seem like a angular rotation abt a particular axis.

Also, from my understanding, it's possible to refine the motion thru:

forAll(p0_,iter)
{

sd[iter] = p0Rel[iter]*(cos(angle) - 1) + (axisHat ^ p0Rel[iter]*sin(angle)) + (axisHat & p0Rel[iter])*(1 - cos(angle))*axisHat;

}

vectorField::operator=
(
sd
);

But if I use my own 3d rotation(sd[iter] = ....), I got different results - a magnified body doing some strange rotation.

Even if I change the formulation to just a simple translation:

forAll(p0_,iter)
{

sd[iter] = p0_[iter] + (0.2,0,0)

}

I still get magnified body doing some strange translation

May I knwo why this is so? what's wrong with the formulation?

Thanks.


All times are GMT -4. The time now is 12:23.