[HowTo]pointVectorField to volVectorField ???
Dear Foamer:
I want to read a flow field from Tecplot data into the OpenFOAM. The fluid information is based on fluid nodes, however, in OpenFOAM the fluid information is based on cells. So I want to do an interpolation. The way I think so far is that I read the fluid information into a pointVectorField, then interpolate to the volVectorField. In the creatFields.H, I wrote: Quote:
Quote:
I'm not sure if I doing in the right way or not:confused: Can anyone help me on this problem:confused: Thanks in advance!:) ycui |
I have never worked with the interpolation class, so I do not know how to use it.
However, I do know that in "dynamicRefineFvMesh" there is a local implementation to convert between cell data and point data. Have a look at the method "maxPointField", "maxCellField" and/or "cellToPoint" [path for OF4.0]: Code:
${FOAM_SRC}/dynamicFvMesh/dynamicRefineFvMesh |
Quote:
It seems there is no function like pointToVol after version 1.6, only has function volToPoint. |
I have fixed this problem, few comments:
1. copy the pointVolInterpolation from an older version of OF, then compile; 2. pointVolInterpolation is a namespace and cannot be defined in creatFields.H, should be defined in other location; 3. define the point data as pointVectorFields with pointMesh, and define the volume data as volVectorFields with mesh, then do the interpolation. 4. the difference before and after the interpolation depends on the velocity fluctuations. |
Hello YCUI,
I am trying to do the same. I copied the pointVectorField to my solver. I am getting the following error: undefined reference to `Foam::pointVolInterpolation::pointVolInterpolatio n(Foam::pointMesh const&, Foam::fvMesh const&)' My piece of code const pointMesh pMesh(mesh); volPointInterpolation vpi(mesh); pointVectorField pointn = vpi.interpolate(gradPsi); pointVolInterpolation pvi(pMesh, mesh); Also these header files are defined before main function #include "volPointInterpolation.H" #include "pointVolInterpolation.H" #include "pointMesh.H" #include "pointFields.H" |
Hi,
I don't use the pointVolInterpolation but a function called interpolatePointToCell inside a loop The loop looks like: Code:
forAll(mesh , idCell) and you need to Code:
#include "interpolatePointToCell.H" Fabien |
Hello Fabian,
Thanks for your answer. It works beautifully. Can I get a little insight of the code interpolatepointToCell(trying to do it myself also but so far no success). Like VolPointInterpolation and PointVolInterpolation interpolates using inverse distance weight function. what does interpolatepointToCell do ? |
To be honnest I didn't look into the code either. A fast check into the code show that its seems to be a simple average of all the values at the points surrounding the cell.
Code:
template<class Type> From this, it would be very easy to copy and modify to have an inverse distance wieghting. Something like Code:
if (pointHad.insert(v)) Fabien :) |
All times are GMT -4. The time now is 21:25. |