CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

how to calculate the volume averaged values in version 4.1

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By Nathanael3
  • 1 Post By 6863523

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2017, 12:04
Default how to calculate the volume averaged values in version 4.1
  #1
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 11
6863523 is on a distinguished road
Dear all,
I have used the commands below to calculate the volume averaged values for version 3.0.1 and it works fine for me.
Code:
functions 
(   

    functionObjects_all_volAverage
    {
        type            cellSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   timeStep;
        outputInterval  2000;
        log             false;
        valueOutput     false;
        source          all;
        sourceName      none;
        operation       volAverage;
        fields
        (
            p
	    U
        );
    }

    probes
    {
        // Where to load it from
        functionObjectLibs ( "libsampling.so" );

        type            probes;

        // Name of the directory for probe data
        name            probes;

        // Write at same frequency as fields
        outputControl   timeStep;
        //outputInterval  1;

        // Fields to be probed
        fields
        (

            U
        );

        probeLocations
        (
            ( 0 0.5 0 )   
            ( 1 0.5 0 )


            ( 0.5 0 0 )

        );
    }

);
I know there is a difference between different versions, and I have found one at https://github.com/OpenFOAM/OpenFOAM...es/controlDict.
and modified as
Code:
functions 
{   

    cellObj1
    {
        type            volRegion;
        libs ("libfieldFunctionObjects.so");
        enabled         true;
        writeControl   timeStep;
        writeInterval  2000;
        log             false;
        writeFields     false;
        regionType      cellZone;
        name            0();
        operation       volAverage;
        fields
        (
            p
	    U
        );
    }

    probes
    {
        // Where to load it from
        libs ( "libsampling.so" );

        type            probes;

        // Name of the directory for probe data
        name            probes;

        // Write at same frequency as fields
        writeControl   timeStep;
        //outputInterval  1;

        // Fields to be probed
        fields
        (

            U
        );

        probeLocations
        (
            ( 0 0.5 0 )   
            ( 1 0.5 0 )


            ( 0.5 0 0 )

        );
    }

}
But there is always a problem for me as
Code:
[11] --> FOAM FATAL IO ERROR:
[11] wrong token type - expected word, found on line 0 the label 0
[11]
[11] file: IOstream.functions.cellObj1.name at line 0.
[11]
[11]     From function Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::word&)
[11]     in file primitives/strings/word/wordIO.C at line 74.
[11]
FOAM parallel run exiting
[11]
Thank you in advance.
Best Regards,
Bill

Last edited by 6863523; February 20, 2017 at 13:02. Reason: wrong info
6863523 is offline   Reply With Quote

Old   February 21, 2017, 03:50
Default fieldAverage function in controlDict
  #2
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 11
6863523 is on a distinguished road
BTW: I have found the fieldAverage function. I wonder what is the difference between the fieldAverage and the volume average.
Code:
fieldAverage1
     {
     type fieldAverage;
     functionObjectLibs ( "libfieldFunctionObjects.so" );
     enabled true;
     outputControl outputTime;
     outputInterval  100;
     fields
     (
      U
      {
      mean on;
      prime2Mean on;
      base time;
      }

      p
      { 
      mean on;
      prime2Mean on;
      base time;
      }
      );
      }
Thank you in advance.
Any suggestion is appreciated.
Best Regards,
Bill
6863523 is offline   Reply With Quote

Old   February 21, 2017, 04:33
Default
  #3
New Member
 
Join Date: Apr 2013
Posts: 20
Rep Power: 13
Nathanael3 is on a distinguished road
Hi,

I am working with 1612+ version. Here is a minimal working example to calculate volume averaged value. I tested it over pitzdaily. I works like a charm.

Code:
functions
{
    volumeAverage
    {
        type            volFieldValue;
        libs            ("libfieldFunctionObjects.so");

        log             true;
        writeControl    writeTime;
        writeFields     true;

        regionType      all;
        operation       volAverage;

        fields
        (
            p
            U
        );
    }
}
Best regards,
Nathanaël.
6863523 and wht like this.
Nathanael3 is offline   Reply With Quote

Old   February 21, 2017, 04:45
Default failed
  #4
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 11
6863523 is on a distinguished road
Quote:
Originally Posted by Nathanael3 View Post
Hi,

I am working with 1612+ version. Here is a minimal working example to calculate volume averaged value. I tested it over pitzdaily. I works like a charm.

Code:
functions
{
    volumeAverage
    {
        type            volFieldValue;
        libs            ("libfieldFunctionObjects.so");

        log             true;
        writeControl    writeTime;
        writeFields     true;

        regionType      all;
        operation       volAverage;

        fields
        (
            p
            U
        );
    }
}
Best regards,
Nathanaël.
Dear Nathanael,
Thank you for the reply.
I have tested the code, but got an error.
Code:
[11] --> FOAM FATAL ERROR:
[11] Unknown function type volFieldValue
Then I modified the volFieldValue to volRegion. There is no such error any more.
Thank you.
Best Regards,
Bill
rpenha likes this.
6863523 is offline   Reply With Quote

Old   February 21, 2017, 04:53
Default
  #5
New Member
 
Join Date: Apr 2013
Posts: 20
Rep Power: 13
Nathanael3 is on a distinguished road
Hi,

Nice to hear that you found a solution.
The discrepancy may arise from the differences between our OpenFOAM versions.

Best regards,
Nathanaël.
Nathanael3 is offline   Reply With Quote

Old   February 21, 2017, 05:09
Default
  #6
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 11
6863523 is on a distinguished road
Quote:
Originally Posted by Nathanael3 View Post
Hi,

Nice to hear that you found a solution.
The discrepancy may arise from the differences between our OpenFOAM versions.

Best regards,
Nathanaël.
Dear Nathanaël,
Thank you very much for your professional reply. It is really helpful and saved me a lot of time.
I wonder if you have experience with the bash script execution to start the case running.
I have posted the problem here #13-#18
error when compile a new solver on version 4.1
Forget about the "functions" problem, because you just solved it.
Thank you for your time and kind help.
Best Regards,
Bill
6863523 is offline   Reply With Quote

Old   December 9, 2017, 04:22
Default How to calculate the volume averaged values only in a part of the domain
  #7
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 11
6863523 is on a distinguished road
Dear Nathanaël,
I wonder if you have any experience of calculating the volume averaged values only in a part of the domain, say, the values averaged in a 1/3 of the fluid domain?
Thank you in advance.
Best Regards,
Bill
6863523 is offline   Reply With Quote

Old   January 5, 2018, 11:43
Default volRegion in chtMultiRegionSimpleFoam
  #8
Member
 
Join Date: Sep 2016
Posts: 63
Rep Power: 9
sitajeje is on a distinguished road
Dear Foamers,

I cannot excute volRegion in chtMultiRegionSimpleFoam, although this functionObject works fine for pimpleDyMFoam. In the controlDict I wrote almost the same, except field "p" for pimpleDyMFoam and field "T" for chtMultiRegionSimpleFoam.

Code:
functions
{
  volRegion1
    {
        type             volRegion;
        libs               ("libfieldFunctionObjects.so");
        writeFields     true;
        regionType    cellZone;
        name            heater;
        operation       volAverage;
        fields
        (
            T
        );
    }
}
I would appreciate if anyone can help me to execute volRegion in chtMultiRegionSimpleFoam.

Thank you very much in advance!

Best regards,
sitajeje
sitajeje is offline   Reply With Quote

Old   November 9, 2020, 11:14
Default
  #9
Member
 
Bineet Mehra
Join Date: Aug 2013
Posts: 61
Rep Power: 12
bineet_aero is on a distinguished road
Quote:
Originally Posted by sitajeje View Post
Dear Foamers,

I cannot excute volRegion in chtMultiRegionSimpleFoam, although this functionObject works fine for pimpleDyMFoam. In the controlDict I wrote almost the same, except field "p" for pimpleDyMFoam and field "T" for chtMultiRegionSimpleFoam.

Code:
functions
{
  volRegion1
    {
        type             volRegion;
        libs               ("libfieldFunctionObjects.so");
        writeFields     true;
        regionType    cellZone;
        name            heater;
        operation       volAverage;
        fields
        (
            T
        );
    }
}
I would appreciate if anyone can help me to execute volRegion in chtMultiRegionSimpleFoam.

Thank you very much in advance!

Best regards,
sitajeje
Hii i am having similar problem, were you able to solve it ? thanks
bineet_aero is offline   Reply With Quote

Old   November 15, 2020, 10:40
Default
  #10
Senior Member
 
Join Date: Oct 2017
Posts: 121
Rep Power: 8
Krapf is on a distinguished road
This is working in OpenFOAM 8:
Code:
volAverage
{
    libs              ("libfieldFunctionObjects.so");
    type            volFieldValue;
    operation      volAverage;
    region          fluid;
    fields           (T);
    writeFields    false;
}
Krapf is offline   Reply With Quote

Old   February 4, 2021, 20:03
Default
  #11
New Member
 
Join Date: Jun 2020
Posts: 3
Rep Power: 5
Rustralia is on a distinguished road
I have the same issue. Did anyone find a solution?
Quote:
Originally Posted by bineet_aero View Post
Hii i am having similar problem, were you able to solve it ? thanks
Rustralia is offline   Reply With Quote

Old   April 14, 2021, 06:30
Default
  #12
New Member
 
Carlo Cintolesi
Join Date: Jan 2013
Posts: 1
Rep Power: 0
CarCin is on a distinguished road
Quote:
Originally Posted by Krapf View Post
This is working in OpenFOAM 8:
Code:
volAverage
{
    libs              ("libfieldFunctionObjects.so");
    type            volFieldValue;
    operation      volAverage;
    region          fluid;
    fields           (T);
    writeFields    false;
}
Dear Krapf,

I'm trying to use the same function but it does not work for me in OpenFOAM 8.
I have added the lines you report in my controlDict, like this:

Code:
functions
{
    volAverage
    {
        libs              ("libfieldFunctionObjects.so");
        type             volFieldValue;
        operation     volAverage;
        //region        fluid;
        fields           (T);
        writeFields   false;
    }
}
and then run by typing "pimpleFoam -postProcess -func volFieldValue". The error is the following:

Code:
--> FOAM FATAL IO ERROR: 
keyword type is undefined in dictionary "controlDict/functions/volFieldValue"

file: controlDict/functions/volFieldValue from line 6 to line 15.

    From function const Foam::entry& Foam::dictionary::lookupEntry(const Foam::word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 797.

Do you have any suggestion? How do you make it work?
Thank you in advance,
Best
Carlo
CarCin 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
Reporting volume averaged temperature dsfakianakis FLUENT 5 March 30, 2021 07:20
How to calculate Statistical values (Mean, Mode, Median, Standard Deviation, etc..) Mukkarum Tecplot 1 February 1, 2017 19:50
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 03:21
Calculate averaged value (mass- or area-weighted) on type:interior boundary conditio jorbuiga Fluent UDF and Scheme Programming 0 June 25, 2012 09:36
calculate values for eps and k from Re or u????? sbar OpenFOAM Pre-Processing 5 August 16, 2010 04:10


All times are GMT -4. The time now is 11:27.