Creating relative fluid-velocityfield in pimpleDyMFoam
first of all I'd like to say that this is a really nice forum. It already helped me in several situations before my registration, but now my problems got too specific, so it was time to create my first thread. :)
In my bachelor thesis I have to solve a case with an angular accelerated cooling circuit.
In order to do so I have to work with the solvers pimpleDyMFoam / interDyMFoam (OpenFOAM version 2.2.0) for dynamic mesh simulation.
So at first I started with a generic 2D-case of a water circuit which is moved with a constant angular velocity.
Unfortunately, when I took a look at the velocity field of the solution I noticed that the velocity field was absolute.
Now I would like to visualise the pipe-relative movement of the fluid.
My idea is to generate field data of the mesh velocity and subtract it from the absolute U-field so that just the relative movement remains.
So I would like to create a custom solver which:
A - reads the cellCentres of each timestep-folder
B - moves the cellCentres by vector addition (because the center of gravity is not located in the origin)
C - transforms the cellCentre vectors into a velocity field with an angular rotation tensor like "RotationTensor*cellCentres=Meshvelocity"
D - subtracts the meshveolcity field from the original U-field and creates new URelative-field files in every time step folder
I am new both to OpenFOAM and C++ code and therefore encounter many problems creating a custom solver/utility that realises my idea described above.
My costumization is strongly based on page 18-21 from this tutorial http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2009/programmingTutorial.pdf
and this site
I implemented code from the writeCellCentres utility in the createFields.H code, but the custom solver just writes the 0-mesh cellCentres in all the
time-step folders. Here is the code piece:
Secondly, I would like to ask how to implement a vector/tensor operation in the solver code (step B,C) in general?
Maybe someone knows some literature/tutorials which give an introduction to this?
Heres the code I tried (which is obviously wrong because of compilation errors):
- Excerpt from file "uRelEqn.H":
And sorry if my questions are dumb, but as I said I am very new to this...
piece of code for relative velocity in rotating domain
I needed the relative velocity as well and wrote a piece of code. It is far from perfect, but hopefully it may point you in the right direction. In this code you still need to define the rotational axis, -velocity and origin. This should be obtained from other global variables inside OpenFoam. However, I didn't figure out how.
In pimpleDyMFoam.C I changed "runTime.write();" to "#include "write.H" ", and wrote the following write.H-file:
|All times are GMT -4. The time now is 20:22.|