CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   How to calculate the field value of a arbitrary point (http://www.cfd-online.com/Forums/openfoam-solving/60622-how-calculate-field-value-arbitrary-point.html)

luckyluke April 11, 2005 04:13

Given a position as (x,y,z), I
 
Given a position as (x,y,z), I want the u or p value in this point by using interpolation.

Thanks all.

mattijs April 11, 2005 05:20

As a postprocessing step use t
 
As a postprocessing step use the 'sample' utility.

Inside a code use the probe functionality (See e.g. oodles/createProbes.H). This does no interpolation however.

luckyluke April 11, 2005 06:51

Hi,Mattijs. I can find out the
 
Hi,Mattijs. I can find out the cell which contain the given point (x,y,z) using mesh.finCell(), then how I can know the cell's neighbour cells?

Thanks.

eugene April 11, 2005 07:18

vector probePoint(x,y,z); lab
 
vector probePoint(x,y,z);
label probeCell = mesh.findCell(probePoint);

const labelList& probeCellNeighbours = mesh.cellCells()[probeCell];

forAll(probeCellNeighbours, cellI)
{
Do your stuff
}

But if you want to interpolate, you might want to look at the built-in interpolation classes.

luckyluke April 11, 2005 08:13

Thank all. By the way, if I kn
 
Thank all. By the way, if I knew the 'label' of one cell,e.g. cellI, then I can access the field value of this cell using U[cellI]. Is that right?

Can a field loop be performed as follows:
forALL(mesh.cells(),i) {U[i]=...}
Or
forALL(U,i) {U[i]=...}?

These are simple questions. Could anybody give me a answer?

eugene April 11, 2005 08:25

Right Both forALL(mesh.ce
 
Right

Both
forALL(mesh.cells(),i) {U[i]=...}
and
forALL(U,i) {U[i]=...}
will give you the same result, i.e. the ordering of cells and volFields are identical.

Most operations however do not require that you loop over the cells explicitly as they can be performed using field algebra.

hfs October 19, 2012 05:45

How can get my results at the patch using points' coordinates
 
Quote:

Originally Posted by eugene (Post 203118)
vector probePoint(x,y,z);
label probeCell = mesh.findCell(probePoint);

const labelList& probeCellNeighbours = mesh.cellCells()[probeCell];

forAll(probeCellNeighbours, cellI)
{
Do your stuff
}

But if you want to interpolate, you might want to look at the built-in interpolation classes.


Hello,

I need the same BUT!:

I am doing a comparison between wind tunnel results and OpenFOAM simulation. Available from wind tunnel are the pressure coefficients (Cp) on 32 points. The coordinates of those points are available. I need to get P field on the body patch at those 32 points.

I mean, the coordinates of a point may not guarantee that It belongs to the patch (due to lack of accuracy of snappyHexMesh). How can get my results at the patch using points' coordinates?

ripudaman February 28, 2014 16:14

HFS, were you able to find a solution to your problem? I have a similar concern. I am using stressAnalysisFoam and I need the D field on the body patch at a particular point as well.

Quote:

Originally Posted by hfs (Post 387475)
Hello,

I need the same BUT!:

I am doing a comparison between wind tunnel results and OpenFOAM simulation. Available from wind tunnel are the pressure coefficients (Cp) on 32 points. The coordinates of those points are available. I need to get P field on the body patch at those 32 points.

I mean, the coordinates of a point may not guarantee that It belongs to the patch (due to lack of accuracy of snappyHexMesh). How can get my results at the patch using points' coordinates?



All times are GMT -4. The time now is 08:03.