|
[Sponsors] |
IntegrateVariables in paraview to get a average flow velocity |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 19, 2017, 12:28 |
IntegrateVariables in paraview to get a average flow velocity
|
#1 |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 9 |
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? |
|
December 19, 2017, 15:43 |
|
#2 |
Senior Member
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 13 |
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. |
|
December 20, 2017, 03:48 |
|
#3 | |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 9 |
Quote:
|
||
December 20, 2017, 09:51 |
|
#4 |
Senior Member
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13 |
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 |
|
December 20, 2017, 09:55 |
|
#5 |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 9 |
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.
|
|
December 20, 2017, 11:22 |
|
#6 |
Senior Member
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 13 |
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 ); } Last edited by Taataa; December 21, 2017 at 13:06. |
|
December 28, 2017, 11:15 |
|
#8 |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 9 |
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? |
|
December 28, 2017, 11:16 |
|
#9 | |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 9 |
Quote:
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? |
||
December 29, 2017, 00:51 |
|
#10 |
Senior Member
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 13 |
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. |
|
December 29, 2017, 02:07 |
|
#11 |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 9 |
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.
|
|
December 29, 2017, 03:25 |
|
#12 |
Senior Member
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 13 |
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.
|
|
January 5, 2018, 12:22 |
|
#13 | |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 9 |
Quote:
| ========= | | | \\ / 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. |
||
January 5, 2018, 14:27 |
|
#14 |
Senior Member
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 13 |
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. |
|
January 8, 2018, 04:39 |
|
#15 |
New Member
Qihao Jiang
Join Date: Dec 2017
Posts: 20
Rep Power: 9 |
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<>
|
|
October 30, 2019, 19:55 |
|
#16 |
New Member
Ali Habibzadeh
Join Date: Apr 2009
Location: Vancouver, Canada
Posts: 15
Rep Power: 17 |
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 |
|
|
|
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 06:37 |
Problems with mass flow rate, pressure and velocity average values | LucasCosta | OpenFOAM Post-Processing | 2 | September 14, 2016 15:07 |
Average Rising Velocity as boundary condition | Floing | CFX | 11 | August 21, 2016 06:47 |
How to take average velocity at nozzle inlet in solidworks flow simulation | Malli Ponnapati | Autodesk Simulation CFD | 0 | June 25, 2016 18:39 |
[General] Calculating average velocity in paraview | haghgoo_reza | ParaView | 0 | October 22, 2013 21:03 |