CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

How to get a slice out of my foam results

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By wyldckat
  • 1 Post By fs82

Reply
 
LinkBack Thread Tools Display Modes
Old   August 1, 2012, 11:46
Default How to get a slice out of my foam results
  #1
Senior Member
 
Fabian Schlegel
Join Date: Apr 2009
Location: Dresden, Germany
Posts: 184
Rep Power: 8
fs82 is on a distinguished road
Dear foamers,

I am trying to extract a slice out of my data, e.g. UMean fields. I tried the sample utility but I am not satisfied with the result. I like to have a flat plane at a constant y value. This means I set up the sampleDict as follows:

Code:
surfaceFormat raw;

interpolationScheme cell;

surfaces
(
    constantPlane
    {
        type            plane;    // always triangulated
        basePoint       (-386.0 0.0 1.0);
        normalVector    (0.0 1.0 0.0);

        //- Optional: restrict to a particular zone
        // zone        zone1;
    }
);
But the result is not as I expected. My mesh is equally spaced with spacing of 2m. The origin is at 0,0,0 and defines a cell center not a vertex. As a result I get values at points like this:

Code:
-386.333333333 0 0.666666666667
-385.666666667 0 1.33333333333
-384.333333333 0 0.666666666667
But this are not the cell centers, this are more or the less arbitrary points and the also have no 2m spacing like my mesh. Is there a way to get only the cell centers with sample utility? The coordinates has to be something like (386, 0, 1), (386, 0, 2) and so on.

kind regards,
Fabian
fs82 is offline   Reply With Quote

Old   August 2, 2012, 10:55
Default
  #2
Senior Member
 
Fabian Schlegel
Join Date: Apr 2009
Location: Dresden, Germany
Posts: 184
Rep Power: 8
fs82 is on a distinguished road
Is it possible that there is a bug in the sample utility? Because if I am using vtk or foamFile as export format, I am getting coordinates which make sense. Does anybody expierenced this bug to?
fs82 is offline   Reply With Quote

Old   August 2, 2012, 15:59
Default
  #3
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,503
Blog Entries: 34
Rep Power: 86
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings Fabian,

Yes, it is possible that sample could have a bug. Any chance you can provide a tutorial case modified to reproduce the error you're getting?

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   August 3, 2012, 11:09
Default
  #4
Senior Member
 
Fabian Schlegel
Join Date: Apr 2009
Location: Dresden, Germany
Posts: 184
Rep Power: 8
fs82 is on a distinguished road
Hi Bruno,

I have played around a little bit. May be I am expecting something wrong but in the attached exampe you have a block of 4 x 4 cells with -2 <= x,y <= 2 and 0 <= z <= 4. If I am cutting a constant y plane at y = 0.5 with normal vector pointing along my y coodinate with interpolationScheme set to cell but without specifying the interpolation switch in my constantPlane subdirectory (I assume it is false) I get strange values (see sampleDict-fail and surfaces-fail). I expected to get 16 values at the cell centers but I am getting 32 values at strange positions. If I turn on the switch interpolation true I get 25 values for the vertices as expected (see sampleDict and surfaces). This behaviour is a bit strange in my opinion.

kind regards,
Fabian
Attached Files
File Type: gz example.tar.gz (5.7 KB, 10 views)
fs82 is offline   Reply With Quote

Old   August 3, 2012, 13:31
Default
  #5
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,503
Blog Entries: 34
Rep Power: 86
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi Fabian,

These values on the fail version seemed familiar... they are the centers of triangles. If you check the original "sampleDict", located at "applications/utilities/postProcessing/sampling/sample":
Code:
// Surface sampling definition
//
// 1] patches are not triangulated by default
// 2] planes are always triangulated
// 3] iso-surfaces are always triangulated
surfaces
(
Hold on, now I get it! What you're saying is that there is an inconsistency in how the raw export mode is working!

This indeed seems to either be a bug, due to the inconsistent behavior, or it's a feature, that allows one to get either the values in the center of the cells or in the vertexes...


After thinking a bit about this, it feels that the concept here is this:
  • Raw format gives you direct access to the results, without the need for processing a file format per-se.
  • In OpenFOAM, the values in the cell centers are the real ones, while the vertexes have interpolated values.
  • Therefore, this export format makes some sense to be a feature!
I hope this makes it a bit more clearer...
Although this does bring up the question: then why doesn't the VTK format comply with the same criteria? If interpolate is turned off, it should provide the values in the center of the faces, not at the points as well?!

Best regards,
Bruno
JR22 likes this.
wyldckat is offline   Reply With Quote

Old   August 3, 2012, 16:44
Default
  #6
Senior Member
 
Fabian Schlegel
Join Date: Apr 2009
Location: Dresden, Germany
Posts: 184
Rep Power: 8
fs82 is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
After thinking a bit about this, it feels that the concept here is this:
  • Raw format gives you direct access to the results, without the need for processing a file format per-se.
  • In OpenFOAM, the values in the cell centers are the real ones, while the vertexes have interpolated values.
  • Therefore, this export format makes some sense to be a feature!
Alright, but there is a big BUT If I use the interpolation (interpolation set to true) than I get interpolated values at the vertices according to the method I set up with the interpolationScheme. This is an expected behaviour. BUT if I switch off the interpolation I would like to have the real values, which are stored at the cell centers. But the failed example (sampleDict-failed) do not give you the values at the cell centers. It gives you values at some more or less arbitrary points, which may be centers of triangles. This is not a feature in my opinion it is missleading. If it is not possible to get the real values, than it would be better to remove the switch for the interpolation.

kind regards,
Fabian
fs82 is offline   Reply With Quote

Old   August 4, 2012, 05:48
Default
  #7
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,503
Blog Entries: 34
Rep Power: 86
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi Fabian,

Indeed, it still seems like an inconsistent behavior... Well, then I suggest you use the bug tracker and report this issue: http://www.openfoam.org/bugs/

Providing a good explanation about what is happening, along with the example case, will make it easier for them to diagnose and fix the issue. By the way, two details about the example you've provided:
  1. If I remember correctly, the "example.tar.gz" file you provided is considered a tarbomb, in the sense that if you unpack the contents to the current folder, it'll be a mess if there are already other files in that folder http://en.wikipedia.org/wiki/Tar_%28...mat%29#Tarbomb
  2. Using potentialFoam for initializing the fields would help the diagnose process, since that way we would have different U values for each cell, making it easier for determining if each value is really interpolated or not.
Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   April 23, 2013, 13:56
Default slice for Tecplot
  #8
New Member
 
realM
Join Date: Jan 2013
Posts: 3
Rep Power: 4
sanysaly is on a distinguished road
Hi,
It seems that the problem still persists. Did you guys find a way to solve it?
In general, any idea how to get a slice out of foam results to open in Tecplot (same feature as "slice filter in paraView")?
Thank you
sanysaly is offline   Reply With Quote

Old   April 24, 2013, 05:08
Default
  #9
Senior Member
 
Fabian Schlegel
Join Date: Apr 2009
Location: Dresden, Germany
Posts: 184
Rep Power: 8
fs82 is on a distinguished road
No I havn't solved that issure. On my TODO list there is also still a point to submit a bug report, but sorry for that I haven't had the time up to now. I use Tecplot to extract slices from my results, which works pretty well.
sanysaly likes this.
fs82 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem: Very long "write" time (~2h-3h) for results and transient results Shawn_A CFX 14 March 11, 2014 09:38
Transient Run - Output "Time" in partial results? evcelica CFX 2 May 16, 2012 21:36
error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Native Meshers: blockMesh 2 March 14, 2012 10:56
cgnsToFoam problems with "QUAD_4" cells lentschi OpenFOAM Meshing & Mesh Conversion 1 March 9, 2011 05:49
blockMesh error ... balkrishna OpenFOAM Pre-Processing 0 August 17, 2010 02:39


All times are GMT -4. The time now is 15:53.