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

How Coorectly Run sampleDict

Register Blogs Community New Posts Updated Threads Search

Like Tree10Likes
  • 2 Post By FlyBob91
  • 1 Post By KTG
  • 7 Post By tetra-eder

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 14, 2017, 07:20
Exclamation How Coorectly Run sampleDict
  #1
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
Hello to all,
i have to run a post-processing extration of the U and P value. I decided to use for the first time the sampleDict.
I put it in the system folrder, run the simulation and finally type the command "sample" which gives me this message

Code:
sample has been superceded by the postProcess utility:
    postProcess -func sample

To re-use existing 'sampleDict' files simply add the following entries:
    type sets;
    libs ("libsampling.so");
and run
    postProcess -func sampleDict
I added the line the message suggested to the sampleDict file. Then i run the command

Code:
postProcess -func sampleDict
Here the message

Code:
Create time

Create mesh for time = 0

Time = 0

Reading fields:
    volVectorFields: U

Executing functionObjects

Time = 0.001

Reading fields:
    volVectorFields: U

Executing functionObjects

End
Unfortunately no new files are generated. What's wrong?
Here my sampleDict file.

Code:
type sets;
libs ("libsampling.so");

setFormat raw;


// Surface output format. Choice of
//      null        : suppress output
//      foamFile    : separate points, faces and values file
//      dx          : DX scalar or vector format
//      vtk         : VTK ascii format
//      raw         : x y z value format for use with e.g. gnuplot 'splot'.
//
// Note:
// other formats such as obj, stl, etc can also be written (by proxy)
// but without any values!
// surfaceFormat vtk;

// interpolationScheme. choice of
//      cell          : use cell-centre value only; constant over cells (default)
//      cellPoint     : use cell-centre and vertex values
//      cellPointFace : use cell-centre, vertex and face values.
// 1] vertex values determined from neighbouring cell-centre values
// 2] face values determined using the current face interpolation scheme
//    for the field (linear, gamma, etc.)
interpolationScheme cellPointFace;

// Fields to sample.
fields
(
	U
);

// Set sampling definition: choice of
//      uniform             evenly distributed points on line
//      face                one point per face intersection
//      midPoint            one point per cell, inbetween two face intersections
//      midPointAndFace     combination of face and midPoint
//
//      curve               specified points, not nessecary on line, uses
//                          tracking
//      cloud               specified points, uses findCell
//
// axis: how to write point coordinate. Choice of
// - x/y/z: x/y/z coordinate only
// - xyz: three columns
//  (probably does not make sense for anything but raw)
// - distance: distance from start of sampling line (if uses line) or
//             distance from first specified sampling point
//
// type specific:
//      uniform, face, midPoint, midPointAndFace : start and end coordinate
//      uniform: extra number of sampling points
//      curve, cloud: list of coordinates
sets
(

);

// Surface sampling definition: choice of
//      plane : values on plane defined by point, normal.
//      patch : values on patch.
//
// 1] patches are not triangulated by default
// 2] planes are always triangulated
// 3] iso-surfaces are always triangulated
surfaces
(
    hello
    {
        type            patch;    // always triangulated
        // make plane relative to the coordinateSystem (Cartesian)
        // coordinateSystem
        // {
        //    origin      (0.05 0 0);
        // }
		patches	("outlet");
        interpolate     false;
		triangulate     false;
    }

);
Thanks for help
roi247 and the_ichthyologist like this.
FlyBob91 is offline   Reply With Quote

Old   September 13, 2017, 01:54
Default
  #2
New Member
 
Kai Schüller
Join Date: Jun 2015
Location: Germany
Posts: 8
Rep Power: 11
tetra-eder is on a distinguished road
I have the same problem. Did you find a solution?
tetra-eder is offline   Reply With Quote

Old   September 13, 2017, 02:31
Default Re
  #3
KTG
Senior Member
 
Abe
Join Date: May 2016
Posts: 119
Rep Power: 10
KTG is on a distinguished road
I think you are missing the name of your sample, and some curly braces. Try this:

my_sample {
<your previously posed dict here>
}

It when you post process, it should put a folder called "my_sample" in the postProcessing folder.

If that doesn't work, try the template below (just change the point (1 1 1) to something in your domain).

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

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


volume_sample {

type sets;
libs            ("libsampling.so");

interpolationScheme cellPoint;

setFormat       csv;

sets
(
    data
    {
        type    cloud;
        axis    xyz;
        points    ( 

(  1 1 1 ) 

);        
    }
);

fields          ( U p );

}


// ************************************************************************* //
KTG is offline   Reply With Quote

Old   September 13, 2017, 02:56
Default
  #4
New Member
 
Kai Schüller
Join Date: Jun 2015
Location: Germany
Posts: 8
Rep Power: 11
tetra-eder is on a distinguished road
Thanks for your help. Unfortunately, when I do this, I get the error
Code:
--> FOAM FATAL IO ERROR:
keyword type is undefined in dictionary ".functions.sampleDict"

file: .functions.sampleDict from line 20 to line 324.

    From function const Foam::entry& Foam::dictionary::lookupEntry(const Foam::word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 566."
In my case, I would like to get the iso surface of a scalar field. Using your suggestion I have now
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  plus                                  |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/

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


my_sample {

type surfaces;
libs            ("libsampling.so");

interpolationScheme cellPoint;

setFormat       csv;

surfaces
(
    interface
    {
        type            isoSurface;
        isoField        gamma_L;
        isoValue        0.5;
        interpolate     true;
    }
);

fields          ( gamma_L );

}


// ************************************************************************* //
tetra-eder is offline   Reply With Quote

Old   September 13, 2017, 03:44
Default
  #5
KTG
Senior Member
 
Abe
Join Date: May 2016
Posts: 119
Rep Power: 10
KTG is on a distinguished road
Try running the solver. For example:

simpleFoam -postProcess

Some of the function objects don't work if the required fields are not loaded (works with the -parallel option and mpi too).

Check out the motorbike tutorial in tutorials/incompressible/simpleFoam/motorbike for an example of how to use some of the simple function objects. If you paste your function object in place of one of the ones used there and it doesn't run properly, the problem is in your function object. If you just run the motorbike tutorial, the function objects execute at run time because they are #include at the bottom of the controlDict.
tetra-eder likes this.
KTG is offline   Reply With Quote

Old   September 13, 2017, 05:01
Default
  #6
New Member
 
Kai Schüller
Join Date: Jun 2015
Location: Germany
Posts: 8
Rep Power: 11
tetra-eder is on a distinguished road
Thanks. It works!
Here is what I did:
1) created a file in the system folder named surfaces
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/

surfaces
{
    type            surfaces;
    libs            ("libsampling.so");
    writeControl    writeTime;

    surfaceFormat   raw;
    fields          (gamma_L);

    interpolationScheme cellPoint;

    surfaces
    (
        interface
        {
            type            isoSurface;
            isoField        gamma_L;
            isoValue        0.5;
            interpolate     true;
        }
    );
}


// ************************************************************************* //
2) run
Code:
postProcess -func surfaces
anishtain4, fumiya, Artur and 4 others like this.
tetra-eder is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fatal overflow error in the FINMES subroutine for CHT run prashant79_ss CFX 5 September 27, 2014 05:54
Cannot run phoenix on linux opensuse 13.1 kde mabal Phoenics 0 June 15, 2014 07:16
[mesh manipulation] Cannot get refineMesh to run in parallel smschnob OpenFOAM Meshing & Mesh Conversion 2 June 3, 2014 12:20
First Parallel Run - need some help Gian Maria OpenFOAM 3 June 17, 2011 13:08
Windows 64-bit, Distributed Parallel Run Issues... Erich CFX 3 March 28, 2006 17:36


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