CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   twoStrokeEngine and floating objects (https://www.cfd-online.com/Forums/openfoam-solving/108249-twostrokeengine-floating-objects.html)

 of_user_ October 18, 2012 02:13

twoStrokeEngine and floating objects

Hello friends!

I am going to solve a cfd problem similar to a two-stroke engine. Before i am going to start i would like to ask the more experienced users: is this possible to do with openfoam or should i go for another cfd tool?

Similar case:

A similar case is the two-stroke engine from this thesis:

http://www.tfd.chalmers.se/~hani/pdf...sterThesis.pdf

The difference:

The pistonhead should not use a given velocity as a boundary condition. Instead the pistonhead should be modeled as a solid body (with mass/inertia).

Is it possible to use objects from the twoStrokeEngine-library for the mesh deformation, piston layering and the sliding interfaces in combination with the piston being a floating object?

Best regards!

 kalle October 18, 2012 02:42

Hi,

This can be done with Openfoam, but it might require you to do some programming. The twostroke classes in of1.6-ext uses the functions you need, but I would build my own fvMesh class based on the linearValveLayersFvMesh class (which uses the same functions), and implement the inertia based motion into the linearValveLayersFvMesh::newPoints() method in linearValveLayersFvMesh.C.

It can be parallelized (with constraints on partitioning), but you will have to rewrite the linearValveLayersFvMesh class for that.

This cannot currently be done with 2.1.x with the same ease.

Good luck,
K

 of_user_ October 18, 2012 04:20

Thank you for your fast answer kalle! I have one more question for you ;)

Do you think this can be done with entry level C++ skills?

For applying the floating object movement to linearValveLayersFvMesh::newPoints() i would do it like this:

original code for linearValveLayersFvMesh::newPoints()
Code:

```00307 Foam::tmp<Foam::pointField> Foam::linearValveLayersFvMesh::newPoints() const 00308 { 00309    tmp<pointField> tnewPoints 00310    ( 00311        new pointField(points()) 00312    ); 00313 00314    pointField& np = tnewPoints(); 00315 00316    const word layerPatchName 00317    ( 00318        motionDict_.subDict("layer").lookup("patch") 00319    ); 00320 00321    const polyPatch& layerPatch = boundaryMesh()[layerPatchName]; 00322 00323    const labelList& patchPoints = layerPatch.meshPoints(); 00324 00325    const vector vel 00326    ( 00327        motionDict_.lookup("pistonVelocity") 00328    ); 00329 00330    forAll(patchPoints, ppI) 00331    { 00332        np[patchPoints[ppI]] += vel*time().deltaTValue(); 00333    } 00334 00335    return tnewPoints; 00336 }```
I would change this part:
Code:

```00325    const vector vel 00326    ( 00327        motionDict_.lookup("pistonVelocity") 00328    );```
to use the velocity at the surface of the floating object (pistonhead) for the current timestep, instead of a constant value from the motionDict.

Will it really be this easy? Just by editing existing code? Or do i have to write my own methods/objects to solve this problem?

/edit: This code fragments may be from OF version 2.x.x

 of_user_ October 18, 2012 05:17

And i have one more question:

Is it possible for a floating solid object to collide with another solid object in openfoam? (Lets say an object is welded on top of the piston. I would like this object to collide with the top of the cylinder.)

If yes: How are the cells between those two objects treated? Will there remain one layer between the two solid bodies?

 kalle October 19, 2012 01:42

Hi,

Yes, something like that was what I had in mind, using Newtons 2nd law to calulcate the velocity instead of looking it up.

I do not know how and if this is possible out-of-the box using 2.1.x. I would go for 1.6-ext on this one.

If you want some collision in your domain you get the problem that you have to completely remove some cells and merge some boundary faces. The problem is similar to a closing valve, which is usually handled by using different meshes. Hence stopping the simulation, mapping the results, and continue solving on the new mesh.

K

 All times are GMT -4. The time now is 21:14.