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

IntegrateVariables in paraview to get a average flow velocity

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By Flowkersma

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 19, 2017, 11:28
Default IntegrateVariables in paraview to get a average flow velocity
  #1
New Member
 
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8
Qihao is on a distinguished road
I have calculated the result of a two dimensional open channel flow in openFOAM. And I want to get the average flow velocity in a internal surface between inlet and outlet.

so I did as follows:

1. get the slide which flow through it
2. use the tool of Plot over line along the bottom to the top, then I can also get the result of the velocity distribution in vertical direction
3. use the filters of integrate variables to get the result of average of this surface, but the result seems not correct. and average velocity calculated in that face is 0.0928. anyone has used this tools?
Attached Images
File Type: png 11.png (31.8 KB, 294 views)
File Type: png 12.png (15.7 KB, 224 views)
Qihao is offline   Reply With Quote

Old   December 19, 2017, 14:43
Default
  #2
Senior Member
 
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 12
Taataa is on a distinguished road
Did you check the divide by cell volume? You better set the data type to cell instead of point, then check that box.
Why don't you use the functions in OpenFOAM itself? there is a volAverage function that you can use to get what you want easily. What I usually do is using topoSet tool to create a set of cells that I want to find the average, then add this function to controlDict.
Taataa is offline   Reply With Quote

Old   December 20, 2017, 02:48
Default
  #3
New Member
 
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8
Qihao is on a distinguished road
Quote:
Originally Posted by Taataa View Post
Did you check the divide by cell volume? You better set the data type to cell instead of point, then check that box.
Why don't you use the functions in OpenFOAM itself? there is a volAverage function that you can use to get what you want easily. What I usually do is using topoSet tool to create a set of cells that I want to find the average, then add this function to controlDict.
I am new to openfoam, how to set the data type to cell? use toposet? or I may try the second method you show me.
Qihao is offline   Reply With Quote

Old   December 20, 2017, 08:51
Default
  #4
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 12
Flowkersma is on a distinguished road
Hi Qihao,

Create the slice and then apply the integrate variables filter. A spreadsheet will open. Choose "Cell data" and you have both Area and integrated U values. So, to get the average velocity just divide U by Area.

Best, Mikko
tariq and SHUBHAM9595 like this.
Flowkersma is offline   Reply With Quote

Old   December 20, 2017, 08:55
Default
  #5
New Member
 
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8
Qihao is on a distinguished road
Quote:
Originally Posted by Flowkersma View Post
Hi Qihao,

Create the slice and then apply the integrate variables filter. A spreadsheet will open. Choose "Cell data" and you have both Area and integrated U values. So, to get the average velocity just divide U by Area.

Best, Mikko
Thank you. I have checked this morning. and the integrate variable should use the cell data. The point data seems not correct. I also want to use the function of openfoam in the code to determine this.
Qihao is offline   Reply With Quote

Old   December 20, 2017, 10:22
Default
  #6
Senior Member
 
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 12
Taataa is on a distinguished road
First create a cell zone using topoSet. If you don't know how, just follow the instruction here. It's better to use one of the existing OpenFOAM tutorial if haven't done this before, for example this one.

Then, just add these lines to the end of controlDict:

Code:
functions
{
  justAName // you can set whatever name you want
  {
    type            volFieldValue;
    libs            ("libfieldFunctionObjects.so");
    log             true;
    writeFields     false;
    regionType      cellZone;
    name            nameOfCellZone; //This is the name you've used in topoSet
    operation       volAverage; // There are other operations that you might use, check the doc
    fields
    (
        U //You can add other fields as well, check the doc given below
    );
  }
You can find more info here.

Last edited by Taataa; December 21, 2017 at 12:06.
Taataa is offline   Reply With Quote

Old   December 21, 2017, 09:18
Default
  #7
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 12
Flowkersma is on a distinguished road
There are several threads on the forum such as this but seems like they might be outdated.
Flowkersma is offline   Reply With Quote

Old   December 28, 2017, 10:15
Default
  #8
New Member
 
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8
Qihao is on a distinguished road
hi Taataa, I have another question want to consult you,
I have a case with pressure distribution along the bottom boundary obtained from experiments which are discrete values. Is there any utility that I can specify location vs value of bottom pressure and let the utility do the interpolation, then apply this interpolation function as another same geometry's boundary conditions?
Qihao is offline   Reply With Quote

Old   December 28, 2017, 10:16
Default
  #9
New Member
 
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8
Qihao is on a distinguished road
Quote:
Originally Posted by Taataa View Post
First create a cell zone using topoSet. If you don't know how, just follow the instruction here. It's better to use one of the existing OpenFOAM tutorial if haven't done this before, for example this one.

Then, just add these lines to the end of controlDict:

Code:
functions
{
  justAName // you can set whatever name you want
  {
    type            volFieldValue;
    libs            ("libfieldFunctionObjects.so");
    log             true;
    writeFields     false;
    regionType      cellZone;
    name            nameOfCellZone; //This is the name you've used in topoSet
    operation       volAverage; // There are other operations that you might use, check the doc
    fields
    (
        U //You can add other fields as well, check the doc given below
    );
  }
You can find more info here.
hi Taataa, I have another question want to consult you,
I have a case with pressure distribution along the bottom boundary obtained from experiments which are discrete values. Is there any utility that I can specify location vs value of bottom pressure and let the utility do the interpolation, then apply this interpolation function as another same geometry's boundary conditions?
Qihao is offline   Reply With Quote

Old   December 28, 2017, 23:51
Default
  #10
Senior Member
 
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 12
Taataa is on a distinguished road
You can a nonuniform value for the boundary for example:

inlet
{
type fixedValue;
value nonuniform List<scalar>
20 //number of cells in the boundary
(
123123 //desired pressure at first cell of the first boundary
234234 //desired pressure at first cell of the second boundary
.
.
.
);
}

The difficulty is finding the number of cells and the pressure at the center of the cell. If you're mesh is not dynamic then finding the number of cells is easy. Just run the simulation with your previous boundary condition for a couple of time steps then go to the directory of, for example, the last time step and check the p file. Just find the name of the boundary by for example ctrl+F and name of the boundary. Then you will see a similar format as nonuniform List<scalar> which below it you will find a number which is the number cells.

Regarding interpolation for finding the pressure at the cell centers I would suggest to do it manually using a python script or excel. Just interpolate your experimental data at the location of cell centers.

Another way of finding number of cells is using sampling utility of OF, you can find some explanation here.
Taataa is offline   Reply With Quote

Old   December 29, 2017, 01:07
Default
  #11
New Member
 
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8
Qihao is on a distinguished road
Can I use the tablefile boundary condition to load the file which consist the value of pressure and relative location, then interpolation and use it to another boundary. I think this may convenient, I have not try this now.
Qihao is offline   Reply With Quote

Old   December 29, 2017, 02:25
Default
  #12
Senior Member
 
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 12
Taataa is on a distinguished road
Yes, that's basically the same thing, instead of putting the numbers directly, you put them in a file then link it to the file.
Taataa is offline   Reply With Quote

Old   January 5, 2018, 11:22
Default
  #13
New Member
 
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8
Qihao is on a distinguished road
Quote:
Originally Posted by Taataa View Post
Yes, that's basically the same thing, instead of putting the numbers directly, you put them in a file then link it to the file.
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [1 -1 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
front
{
type empty;
}
cyc_left
{
type cyclic;
}
top
{
type fixedProfile;
profile csvFile;
profileCoeffs
{
nHeaderLine 0; // Number of header lines
refColumn 0; // Reference column index
componentColumns (1 2); // Component column indices
separator ","; // Optional (defaults to ",")
mergeSeparators no; // Merge multiple separators
fileName "dataFile.csv"; // name of csv data file
outOfBounds clamp; // Optional out-of-bounds handling
interpolationScheme linear; // Optional interpolation scheme
}
direction (1 0 0);
origin 0;
}
bottom
{
type zeroGradient;
}
back
{
type empty;
}
cyc_right
{
type cyclic;
}
}

dataFile.csv
0,0
0.005,0.043
0.01,0.158
0.015,0.311
0.02,0.482
0.025,0.663
0.03,0.845
0.035,1.022
0.04,1.187
0.045,1.334
0.05,1.46
0.055,1.561
0.06,1.637
0.065,1.69
0.07,1.723
0.075,1.737
0.08,1.735
0.085,1.717
0.09,1.688
0.095,1.648
0.1,1.599
0.105,1.543
0.11,1.48
0.115,1.412
0.12,1.34
0.125,1.263
0.13,1.183
0.135,1.099
0.14,1.012
0.145,0.922
0.15,0.829
0.155,0.733
0.16,0.633
0.165,0.531
0.17,0.425
0.175,0.315
0.18,0.201
0.185,0.083
0.19,-0.041
0.195,-0.172
0.2,-0.31
0.205,-0.457
0.21,-0.615
0.215,-0.789
0.22,-0.982
0.225,-1.21
0.23,-1.469
0.235,-1.853
0.24,-2.185
0.245,-2.948
0.25,-2.923
0.255,-2.011
0.26,-1.717
0.265,-1.562
0.27,-1.437
0.275,-1.32
0.28,-1.209
0.285,-1.101
0.29,-0.996
0.295,-0.894
0.3,-0.797
0.305,-0.702
0.31,-0.61
0.315,-0.521
0.32,-0.437
0.325,-0.358
0.33,-0.285
0.335,-0.22
0.34,-0.152
0.345,-0.065
0.35,-0.017 first column is x location, second column is value of pressure
I find this boundary condition may be can solve the problem last mentioned. but has the problem I can not solve.

keyword file is undefined in dictionary "/home/qihao/OpenFOAM/qihao-5.0/run/hyporheic/Hyporheic/Groundwater/Stratified/0/p.boundaryField.top.profileCoeffs"

file: /home/qihao/OpenFOAM/qihao-5.0/run/hyporheic/Hyporheic/Groundwater/Stratified/0/p.boundaryField.top.profileCoeffs from line 38 to line 45.

From function const Foam::entry& Foam::dictionary::lookupEntry(const Foam::word&, bool, bool) const
in file db/dictionary/dictionary.C at line 566.
Qihao is offline   Reply With Quote

Old   January 5, 2018, 13:27
Default
  #14
Senior Member
 
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 12
Taataa is on a distinguished road
You have set refColumn as 0 (which is the first col) then you've set componentColumns as (1 2) which means columns 2 and 3!. You should use componentColumns (1).
Also as the error suggests you should use file instead of fileName.
Taataa is offline   Reply With Quote

Old   January 8, 2018, 03:39
Default
  #15
New Member
 
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 8
Qihao is on a distinguished road
Quote:
Originally Posted by Taataa View Post
You have set refColumn as 0 (which is the first col) then you've set componentColumns as (1 2) which means columns 2 and 3!. You should use componentColumns (1).
Also as the error suggests you should use file instead of fileName.
I Solved this problem by using this BC. If someone wants to load files of scatters and do the interpolation. I think this is a good choice instead of using nonuiform List<>
Qihao is offline   Reply With Quote

Old   October 30, 2019, 18:55
Default
  #16
New Member
 
Ali Habibzadeh
Join Date: Apr 2009
Location: Vancouver, Canada
Posts: 15
Rep Power: 17
arhabib is on a distinguished road
Hi,

How can one generate maps of depth-averaged velocity in ParaView.
I am post-processing a VOF simulation (air/water) done in interFOAM.
What I am looking for is a 2D map of depth-averaged quantities such as velocity in the entire domain. Just integrating/averaging over a vertical line won't work (I need this done in the entire domain).

Thanks
arhabib 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
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 05:37
Problems with mass flow rate, pressure and velocity average values LucasCosta OpenFOAM Post-Processing 2 September 14, 2016 14:07
Average Rising Velocity as boundary condition Floing CFX 11 August 21, 2016 05:47
How to take average velocity at nozzle inlet in solidworks flow simulation Malli Ponnapati Autodesk Simulation CFD 0 June 25, 2016 17:39
[General] Calculating average velocity in paraview haghgoo_reza ParaView 0 October 22, 2013 20:03


All times are GMT -4. The time now is 00:01.