CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Post-Processing (
-   -   sampling a plane (

Gearb0x May 10, 2010 08:25

sampling a plane

I'm trying to use sample on plane to get my velocity field in 3D.

I have normally 2500 cell centers (50 nodes * 50 nodes)
When I'm using sample with the option for the surface :

type patch
patchName inlet

then it's ok and I have 2500 values

but when I do

type plane
BasePoint (0 0 0)
normal (0 1 0)
interpolate false;
triangulate false;

then I get 5000...

I tried different values for interpolate and triangulate but cannot get my 2500.
How could I do please?

Interpolation Scheme is Cell

Thanks for your help ...

Gearb0x May 10, 2010 14:33

I made a simpler case to test that ...

On a plane I only have 36 NODES (it's a square section with 6 nodes on each side) so this gives me 25 CELL CENTRES

When sampling a surface and setting interpolate true, then I have 36 values for my sampling and the values are for each nodes
When sampling a line, then I have 25 values, values are for each centre

I would like to have the values for sampling of a surface on the centers. Does anybody know more about this?

Thanks for your help

Adrian May 12, 2010 09:04

I encountered the same problem today. I couldnt solve it yet, but I'll let you when I find out something new.

Cheers Adrian

Gearb0x May 12, 2010 09:18

Dear Adrian,

I think I'm on the way of solving the problem :)

I use "sample" combined with "timeVaryingMappedFixedValue" boundary condition. You can find an example in $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDailyExpInlet

You have to post process the data given by sample to be able to use then with
TimeVaryingMappedFixedValue but this is easily done by Matlab (can give you the code if you want but it's very specific for my case so maybe you will have to write your own or modify mine :))

Gearb0x May 13, 2010 17:04

OK after fighting with my case for Two days, it's now working with my velocity fields extracted from a plane of another case.

I had to be tricky to get it to work :
sample + matlab interpolation + non uniform velocity field at inlet (no use of TimeVaryingMappedFixedValue which, for my case, did weird interpolation)

So if someone is encoutering the same issue, I can explain to him and give my files to treat the data... It's case-specific and not fully automated but hey, it's working :)

CFD_Monkey December 17, 2012 10:49

Hi Jérémy,

I'm also working with the timeVaryingMappedFixedValue. Unfortunately I get kind of weird interpolation at the inlet. Maybe the same thing happend to you.
So I would be grateful if you can help me out.

The inlet values files and the points file are created by octave for each timestep. Even if I place the points exactly at the cell center of the inlet patch cells (where actually no interpolation is needed) I get kind of stripes in my inlet (for e.g. velocity) distribution. see figure:

While the output data of octave doesn't show those stripes:
(Due to time dependent fluctations the plot looks a bit ragged)

best regards

All times are GMT -4. The time now is 07:17.