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

Sample different fields in different sets and surfaces

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 1, 2016, 08:10
Question Sample different fields in different sets and surfaces
  #1
New Member
 
Ion
Join Date: Mar 2014
Posts: 2
Rep Power: 0
ionelberdin is on a distinguished road
Is it possible to sample different fields for different sets and surfaces?

If the pressure field is relevant just in some patch and temperature in other one, is there a way to obtain both without having to call the sample utility twice?

The keys here are:
  • avoiding unnecessary files creation
  • loading the case in memory just once
Thanks in advance!
ionelberdin is offline   Reply With Quote

Old   April 4, 2016, 06:26
Default
  #2
Senior Member
 
Join Date: Jun 2012
Location: Germany, Bochum
Posts: 230
Rep Power: 16
Bazinga is on a distinguished road
AFAIK this is not possible. You could create multiple sampleDict files and maybe make it automatic by writing a small script.
Bazinga is offline   Reply With Quote

Old   April 4, 2016, 09:33
Default
  #3
New Member
 
Ion
Join Date: Mar 2014
Posts: 2
Rep Power: 0
ionelberdin is on a distinguished road
Quote:
Originally Posted by Bazinga View Post
AFAIK this is not possible. You could create multiple sampleDict files and maybe make it automatic by writing a small script.
Hi Bazinga!

First of all, thanks for replying

Making several calls to sample would require loading the case several times, and that's precisely what I'm trying to avoid.

Let's see if someone comes with a different solution in which the case gets loaded and then all samples are performed.

Cheers!
ionelberdin is offline   Reply With Quote

Old   November 2, 2017, 12:17
Default
  #4
New Member
 
Lennart Steffen
Join Date: Mar 2017
Location: Braunschweig, Germany
Posts: 17
Rep Power: 9
RL-S is on a distinguished road
You can do that with function objects in system/controlDict.
Not sure that helps, because you have to decide in advance what you want to get sampled, or at least changes only apply to future times.

Here's an example:
Code:
functions
(
    someSampleSets
    {
        type                   sets;
        functionObjectLibs     ("libsampling.so");
        setFormat              raw;
        interpolationScheme    cellPoint;
        outputControl          outputTime;
        sets
        (
            someSet
            {
                type        uniform;
                axis        x;
                start       (0 0 0);
                end         (1  1 1);
                nPoints     100;
            }
            someOtherSet
            {
                type        uniform;
                axis        y;
                start       (1 0 0);
                end         (0  1 1);
                nPoints     100;
            }

        );
        fields
        (
            U p
        );
    }
    someSurfaces
    {
        type                    surfaces;
        functionObjectLibs      ("libsampling.so");
        surfaceFormat           raw;
        interpolationScheme     cellPoint;
        outputControl           outputTime;
        fields
        (
            alpha
        );
        surfaces
        (
            someSurface
            {
                type        isoSurface;
                isoField    alpha;
                isoValue    0.5;
                interpolate true;
            }
        );
    }
);
RL-S is offline   Reply With Quote

Old   December 18, 2020, 05:38
Question How do you run sampling with this setting?
  #5
New Member
 
Join Date: Aug 2020
Posts: 16
Rep Power: 6
decanter is on a distinguished road
Quote:
Originally Posted by RL-S View Post
You can do that with function objects in system/controlDict.
Not sure that helps, because you have to decide in advance what you want to get sampled, or at least changes only apply to future times.

Here's an example:
Code:
functions
(
    someSampleSets
    {
        type                   sets;
        functionObjectLibs     ("libsampling.so");
        setFormat              raw;
        interpolationScheme    cellPoint;
        outputControl          outputTime;
        sets
        (
            someSet
            {
                type        uniform;
                axis        x;
                start       (0 0 0);
                end         (1  1 1);
                nPoints     100;
            }
            someOtherSet
            {
                type        uniform;
                axis        y;
                start       (1 0 0);
                end         (0  1 1);
                nPoints     100;
            }

        );
        fields
        (
            U p
        );
    }
    someSurfaces
    {
        type                    surfaces;
        functionObjectLibs      ("libsampling.so");
        surfaceFormat           raw;
        interpolationScheme     cellPoint;
        outputControl           outputTime;
        fields
        (
            alpha
        );
        surfaces
        (
            someSurface
            {
                type        isoSurface;
                isoField    alpha;
                isoValue    0.5;
                interpolate true;
            }
        );
    }
);
Hi,

the thread is a bit old but I am trying to the exact same thing. I tried the code in OF version 7 but I am not sure how I am supposed to run singleGraph utiliy. OF doesn't create sets of samples when I run my case with the "postprocess -func singleGraph" in terminal. My controlDict File is below. What am I doing wrong here?


Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     interFoam

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         10;

deltaT          2e-4;

writeControl    runTime;

writeInterval   2e-2;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable false;

adjustTimeStep  yes;

maxCo 0.4;
maxAlphaCo      0.4;

functions
{
Co
{
    // Mandatory entries (unmodifiable)
    type            CourantNo;
    libs            ("libfieldFunctionObjects.so");

    // Optional entries (runtime modifiable)
    rho             rho;

    // Optional (inherited) entries
    field           <phi>;
    result          <fieldResult>;
    region          region0;
    enabled         true;
    log             true;
    timeStart       0;
    timeEnd         10;
    executeControl  adjustableRunTime;
    executeInterval 2e-2;
    writeControl    adjustableRunTime;
    writeInterval   2e-2;
 }
singleGraph
{

 someSampleSets
    {
        type                   sets;
        functionObjectLibs     ("libsampling.so");
        setFormat              raw;
        interpolationScheme    cellPoint;
        outputControl          outputTime;
        sets
        (
           line0
            {
                type        lineCell;
                axis        y;
                start       (0.02 -0.04 0);
                end         (0.02 0.04 0);
            }
            line1
            {
                type        lineCell;
                axis        y;
                start       (0.045 -0.04 0);
                end         (0.045 0.04 0);
            }

        );
        fields
        (U p k omega nut Co);
    }
}

#includeFunc  probes;
}
decanter is offline   Reply With Quote

Reply

Tags
multiple fields, openfoam, sample

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sample not working correctly sihaqqi OpenFOAM Running, Solving & CFD 1 July 12, 2014 01:36
sample utility problem And OpenFOAM Post-Processing 36 May 20, 2014 08:50
Sample utility only samples pressure?! (not velocity) cfddwarf OpenFOAM Post-Processing 2 May 14, 2012 12:36
erros when running sample command hewei OpenFOAM Post-Processing 3 April 15, 2012 04:50
Understanding the coordinates of sample utility vishwa OpenFOAM Post-Processing 4 March 25, 2010 12:51


All times are GMT -4. The time now is 02:16.