CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Data Output (https://www.cfd-online.com/Forums/openfoam-post-processing/78660-data-output.html)

Rickard.Solsjo July 29, 2010 02:48

Data Output
 
I was just wondering how OpenFoam sorts the output data?
When I e.g. look in say timestep 0.0015 (whatever) there is a long list of, lets say, temperatures in the T-textfile. How can I interpret these values? I want to make correlations in MatLab and only use a plane.

Does anyone have an idea?

Palminchi July 29, 2010 04:04

As you say as an example, for temperature, it says the value of this parameter in each cell, i.e., if your mesh have 30000 cells, the first value is the temperature in cell#1 and so on. For velocity, there is a vector with the components, Ux, Uy and Uz -> (Ux, Uy, Uz) and it works the same as scalar variables. I hope it can help

akidess July 29, 2010 05:15

Based on what Palminchi says you are getting a 1D list of cells with their associated variable values. It's going to be tough extracting a plane from that. You might want to use the 'sample' tool to extract data on a plane.

cedric_duprat July 29, 2010 05:17

Hi Richard

If you are interesting in only one plane of your geometry, you should look for the samplePlane tools (at least in OF 1.4.1) and post-process only this plane.

You can get a column text file with x,y,z and T for example which can be interpreted by matlab easily.

I hope this will help you

Cedric

Rickard.Solsjo July 29, 2010 06:49

Okay that sounds great. So how do I use it ?
Is it something i have to download

cedric_duprat July 29, 2010 08:06

Nothing to download.
You'll have to add a file called sampleSurfaceDict where you'll define your plane coordinate (point + normal vector) and that's all. An example of this file can be found in a tutorial (I don't remember which one)
If you want to check the code it's in application/utilities/postProcessing/
I hope this will help

Cedric

Rickard.Solsjo July 29, 2010 08:14

Are you referring to the sampleDict? Or there is actually a folder called sampleSurfaceDict?

cedric_duprat July 29, 2010 08:27

SampleDict is the file used by the application "sample" to print in a file values along a line . So in this file you define the line.

SampleSurfaceDict is the file used by the application "sampleSurface" to print in a file values in a plane. So in this file you define the plane coordinates

cedric_duprat July 29, 2010 08:33

In OF 1.4.1, it was there:

applications/utilities/postProcessing/miscellaneous/sampleSurface

and an example of the sampleSurfaceDict can be found there too.

I don't know for more recent version of the code but, you should however find a similar tool.

Cedric

akidess July 29, 2010 08:41

Cedric, you are misinformed. sample with sampleDict can be used to extract surfaces as well, see U-165.

Rickard.Solsjo July 29, 2010 08:44

Ah okay. So I suppose that I type. e.g
55 constantPlane
56 {
57 name constantPlane;
58
59 basePoint (0.0 0 0);
60 normalVector (0 1 -1);
61
62 // Optional: whether to leave as faces or triangulate (=default)
63 triangulate false;
64 }

What about the other ones, interpolation .... and following. Can I just skip these? Does OpenFoam know which one i want to use? In the terminal later; do I type sampleSurface or just sample?
Thx

akidess July 29, 2010 08:54

There is a reference sampleDict file in ~/OpenFOAM/OpenFOAM-1.x/applications/utilities/postProcessing/sampling/sample/.

What you are missing in your example is specification of "type plane;". All the other entries are optional. How would OpenFOAM know what you want to use? You'll have to see if the default works for you or if you have to specify more to meet your expectations. The tool to use is 'sample', sampleSurface doesn't seem to be included any more in version 1.5 (and presumingly later versions).

Rickard.Solsjo July 29, 2010 09:07

Okay, so my conclusion is that I should use sampleDict instead of sampleSurfaceDict and try to get that working instead.

Rickard.Solsjo July 29, 2010 09:23

Any reason why this shouldnt work ?

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location system;
object sampleDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


setFormat raw;


surfaceFormat vtk;


interpolationScheme cellPoint;

fields
(
p
U
N-DODECANE
);



surfaces
(
constantPlane
{
type plane; // always triangulated
basePoint (0.0 0.0 0.0);
normalVector (0 0 -1);

//- Optional: restrict to a particular zone
// zoneName zone1;
}

);


// ************************************************** ********************* //

akidess July 29, 2010 09:34

Looks good to me, except you might want to set surfaceFormat to raw if you are writing your own import function for MATLAB. Are you having problems?

Rickard.Solsjo July 29, 2010 09:41

I changed what you said but i still have some problems



surfaceFormat raw;
setFormat raw;
interpolationScheme cellPoint;
fields
(
p
U
);
surfaces
(
constantPlane
{
type plane;
basePoint (0.0 0.0 0.0);
normalVector (0 0 -1);

}
);

Its when I remove the sets that it doesnt work anymore.
The sets being lines and stuff. But I dont want lines, just a plane.
Any idea?
thx

akidess July 29, 2010 09:55

Try retaining an empty list of sets ->

sets ();

Rickard.Solsjo July 29, 2010 09:58

Great! It works
thank you

desert_1250 March 27, 2011 14:10

set curve
 
Hi all, How can i use set curve for sampling date a long a curve?? (for example cylinder curve)

aaron_lan June 6, 2014 08:50

Hi s. ,

I have the same question as you had three years ago. If you already have an solution for that, can you please help me out? Thanks.

Aaron


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