|June 19, 2013, 05:22||
Creating relative fluid-velocityfield in pimpleDyMFoam
Join Date: Jun 2013
Posts: 2Rep Power: 0
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...
|October 23, 2013, 10:26||
piece of code for relative velocity in rotating domain
Join Date: Mar 2013
Posts: 9Rep Power: 6
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:
volVectorField mesh2D(mesh.C()); //initialise mesh mesh2D.component(2) = 0 * mesh.C().component(2); //set z dimension (along axis) to zero. I don't know if this is really needed. dimensionedVector origin ( "origin", dimensionSet(0, 1, 0, 0, 0, 0, 0), vector(0,0,0) // set the point of the origin ); vector axis(0, 0, 1); // set the rotational axis dimensionedScalar omega ( "omega", dimensionSet(0, 0, -1, 0, 0, 0, 0), 6.2832 //set the rotational velocity in rad/s. ); volVectorField Urel ( IOobject ( "Urel", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), U - ((omega * axis) ^ (mesh2D - origin)) //computes the relative velocity. The second part is the cross product of //the rotational vector with the vector from the origin to the mesh position. ); runTime.write();
|cellcentres, custom solver, pimpledymfoam, relative velocity|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Fluid Structure Interaction||Apollo||Main CFD Forum||5||July 4, 2011 16:15|
|Creating fluid zone within Fluent||Suresh||Main CFD Forum||1||November 25, 2002 08:36|
|Intl Conf Computational Methods in Fluid Power||Jacek Stecki||Main CFD Forum||0||November 10, 2002 06:49|
|My Revised "Time Vs Energy" Article For Review||Abhi||Main CFD Forum||2||July 9, 2002 09:08|
|Terrible Mistake In Fluid Dynamics History||Abhi||Main CFD Forum||12||July 8, 2002 09:11|