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/)
-   -   Rotating motion (https://www.cfd-online.com/Forums/openfoam-programming-development/155355-rotating-motion.html)

kcn June 29, 2015 08:51

Rotating motion
 
Hello,

Can someone please tell me how I can modify rotating Motion sub class in Solid Body Motion Functions, in order to use a calculated rotational speed instead of a constant rotational speed?

I am simulating a wind driven turbine. So rotation should be wind induced rather than predefined. I indent to do this as follows.

  1. Using initial position of the turbine, run the flow solver to obtain pressure field on turbine blade.
  2. Then using this pressure field, torque can be calculated.
  3. Using this torque value and moment of inertia of turbine angular velocity can be calculated.
  4. Modify Rigid body rotation class so that it can take the calculated angular velocity to define mesh rotation.

Can some one tell me how to use calculated values from a solver as inputs to a solid body motion function.

Thanks
kcn

danny123 June 30, 2015 11:31

Hello,

I have programmed a speed ramp of an impeller in the past. You will propably find in one of those posts. OpenFoam uses the time to determine the current rotation angle. At contant angle speed this is a linear function, but this can be changed in the dynamic mesh class you have to build. The mesh movement then is simply called by the mesh.update.

However, for your purpose, you will need the angle acceleration too, as well as delta T.
So, I would follow the definition of time (duration) in the dynamic mesh class and define the new entities that you need.

Regards,

Daniel

kcn July 1, 2015 03:15

Dear Daniels,

Thanks a lot for your reply, I looked at your earlier post. Once the acceleration is obtained I can use a similar way to incorporate variable rotation speed.

However in my case acceleration is flow induced in following way.

Acceleration = flow induced torque/Moment of inertia

I made a new class based on SolidBodyMotionFvMesh which I named windMotionFvMesh.

Torque is calculated by the solver during run time. My problem is, how can I communicate this torque value to windMotionFvMesh?

I tried updating the dynamicMeshDict during rum time. So that during each iteration torque can be read from there. But it didn't work. It seems solidBodyMotionFvMesh do not read dynamicMeshDict during each iteration.

Is there any way I can directly communicate torque value to windMotionFvMesh?

danny123 July 1, 2015 04:09

Hello kcn,

The moment of inertia should be a constant unless the geometry of your impeller changes, agreed?

Then, what you need is instead of angle of rotation = f(t) (as it is implemented in OpenFoam now):

angle of rotation new = angle of rotation old + rotation speed old x deltaT + deltaT^2 x Torque/(Moment of Inertia).

So, instead of time you propably have to pass the angle directly to your new dynamic mesh class. So, I would suggest you to look where the current class gets the time value from and add another variable to pass (which then is the angle).

You could also "missuse" the time variable by setting it to the angle value, do a mesh update and setting it back. But this is "dirty" programming trick and I would not recommend it.

Regards,

Daniel

kcn July 1, 2015 05:14

Dear Daniel,

Time is directly passed as runTime. I tried following code that others have used to access field values (p & U) form boundary condition classes. This was also used in post processing class "forces" to access velocity fields.

const volTypeField& X = db().objectRegistry::lookupObject<volTypeField>("X ");

How ever I get the following error

" ‘db’ was not declared in this scope"

Thanks,
kcn

kcn July 1, 2015 09:46

Hello,

It compiled when I replaced the RHS with

time_.lookupObject<volTypeField>("X")

danny123 July 2, 2015 08:53

The runTime objects are defined in time.C and time.H. You can define a new entity called e.g. "angle" similar to deltaT. This angle then can be changed by a set procedure (similar to setdeltaT).

You then need to define an object that can be called within the dynamic mesh object. In this example, it should be similar to runTime.deltaTValue().

The angle then can be set using the torque balance in your application solver. After the mesh.update() it should then appear in your dynamic mesh object.:)

I do not know how to get the forces on the shaft, since I always only see the result table only. Maybe somebody else can help you on that one.:confused:

Regards,

Daniel

pechwang August 1, 2016 17:28

Can anyone successfully implement the wind induced velocity change?

JonW September 27, 2017 15:53

Time variation in the rotation
 
I dont know if this helps, but to allow for a time variation in the rotation, I have
done the following in OF 2.3.1. (should be similar with other versions)


cd $HOME/OpenFOAM/OpenFOAM-2.3.1/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/

cd rotatingMotion

gedit rotatingMotion.C

in the function (line 73)
Foam::septernion
Foam::solidBodyMotionFunctions::rotatingMotion::tr ansformation() const
you can do your stuff

I added ...

const scalar PI = constant::mathematical::pi;

// scalar angle = omega_->integrate(0, t);
scalar angle = Foam::sin(1.0*PI*t)*omega_->integrate(0, t);

Now you have sinus type of rotation. You can add other functions, like atan if you want a steady increase and then steady state rotation.
---------------------------------------------------------------------------

In ./constant/dynamicMeshDict

dynamicFvMesh solidBodyMotionFvMesh;

solidBodyMotionFvMeshCoeffs
{
cellZone none; // none => the whole mesh rotates.
// if you want only part of it to rotate, you have to define
// that region. see examples in openfoam wiki
solidBodyMotionFunction rotatingMotion;

rotatingMotionCoeffs
{
origin ( 0 0 0 );
axis ( 0 0 1 );
omega 1.4451; // rad/s // omega = 2*pi*(0.23 rps)
}
}

kane March 13, 2018 00:23

It was a old thread.
But I want to ask something.

why the term(1.0/constant::mathematical::pi*omega_) is added???


All times are GMT -4. The time now is 07:26.