CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [OpenFOAM] Plotting Cell-Center Data Over Line (https://www.cfd-online.com/Forums/paraview/250604-plotting-cell-center-data-over-line.html)

joshc June 29, 2023 09:09

Plotting Cell-Center Data Over Line
 
Hi all,

I appreciate that this problem has been raised before (mainly here: https://www.cfd-online.com/Forums/pa...-question.html) but I am having trouble implementing the suggested solutions.

I would like to use a tool akin to the "Plot Over Line" feature to save some CFD data from a 2D mesh. The problem is that the Plot Over Line feature is incapable of using solely the data produced by the CFD code and stored at the cell centres. Instead, it uses some interpolation which reduces the precision of the data I would like to analyse quite considerably.

Ideally, the solution would compute line segments within each of the cells in the mesh and then associate a cell-centered value with them and plot only the data at those cell-centres.

Is there a straight-forward way of doing this in Paraview? All suggestions are welcome.

Thanks in advance,
Josh

sinatahmooresi December 13, 2023 12:20

Hello Josh,


I am having the same problem. Did you find any solutions?


Sina

joshc December 13, 2023 12:23

Quote:

Originally Posted by sinatahmooresi (Post 861651)
Hello Josh,


I am having the same problem. Did you find any solutions?


Sina


Hi Sina,

Yes, there is a solution to this. It turns out that Paraview is not an optimal software for extracting the cell-centred data which is produced by an OpenFOAM solver. To obtain this data, you should use the sampleDict with the interpolation method set to "cell", and you can extract data along lines this way. Note that this is actually built-in functionality with the standard OpenFOAM installation, so I found in my cases that this was an easier way to deal with the data I wanted to use than going through Paraview.

Hope this helps.
Josh

sinatahmooresi December 13, 2023 13:01

Hello Josh,



Thank you for your prompt answer. Yes, the plot over line feature is the key answer. However, if you look at "sampleDict", you notice you can manage the number of points (nPoints) so that the solver interpolates data in whatever number of points along the desired line.
My question is, how can I make sure that the very first data is exactly at the very first cell above the wall, for instance? Imagine you would put the lowest point of your line on the edge of your domain. I would expect openFOAM to "extrapolate" data from the real very first cell centre (that has a values) to the desired point I asked for, which is in this example lower than the cell centre. It might be addressed with some options like "lineUniform", "libeCell", .. in sampleDict, which I am not sure yet.


Sina

joshc December 14, 2023 06:51

Quote:

Originally Posted by sinatahmooresi (Post 861655)
Hello Josh,



Thank you for your prompt answer. Yes, the plot over line feature is the key answer. However, if you look at "sampleDict", you notice you can manage the number of points (nPoints) so that the solver interpolates data in whatever number of points along the desired line.
My question is, how can I make sure that the very first data is exactly at the very first cell above the wall, for instance? Imagine you would put the lowest point of your line on the edge of your domain. I would expect openFOAM to "extrapolate" data from the real very first cell centre (that has a values) to the desired point I asked for, which is in this example lower than the cell centre. It might be addressed with some options like "lineUniform", "libeCell", .. in sampleDict, which I am not sure yet.


Sina

Hi Sina,

In order to do this, you should use the lineCell type. This option does not require that you specify the number of interpolated points; rather, you will specify the start and end points of your line and, if you have the interpolationScheme set to "cell", it will indiscriminately extract the cell centres.

Example:

sets
(
Example
{
type lineCell;
axis x;

start ( 0 0 0);
end ( 2 0 0 );

}
)

Otherwise, if you refer to a point which lies on a boundary which is not appearing, I think it's probably possible in most cases to determine "by hand" the value of the cell.

Hope this helps...
Josh

Nafiz375 January 28, 2024 10:04

1 Attachment(s)
Hello Josh,
I'm trying to extract cell-centered U and V component velocities (U_x and U_y) from the entire specified zone I marked in the attached picture. Is there any way to extract those values either in ParaView or SampleDict, as you mentioned earlier?

Attachment 98340

Regards,
Nafiz


All times are GMT -4. The time now is 00:10.