|
[Sponsors] |
[General] How to do user-defined weighted average in paraview? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 3, 2015, 23:15 |
How to do user-defined weighted average in paraview?
|
#1 |
Member
Di Cheng
Join Date: May 2010
Location: Beijing, China
Posts: 47
Rep Power: 16 |
I have a 3d model, Lx >> Ly,Lz, a long tube-like channel. And I want to do some weighted average in x-normal cross section like this:
I = \int(rho*u*u*u)dA/\int(rho*u*u)dA I did slice and tried integrate variable and programmable filter, but there are two problems: 1. how to define an integral like the equation above 2. how to get dA in programmable filter? I can only get rho and u Now, I get here: 1 # coding: utf-8 2 from paraview.simple import * 3 reader = OpenDataFile('./cavity.foam') 4 slice = Slice(reader) 5 slice.SliceOffsetValues.SetData(0.01) 6 calc = Calculator(slice) 7 calc.AttributeMode = 'Cell Data' 8 calc.ResultArrayName='pU' 9 calc.Function='p*U' 10 inte = IntegrateVariables(calc) 11 inte.UpdatePipeline() 12 print inte.CellData['pU'] But the result is: Array: pU Now the question is how to get the real value of this pU? I NEED it! I can see it in the tableview if I do the process in paraFoam. But how can I do it in pvpython? It seems that there is some tools to convert it to numbers, but I did find it out yet. Last edited by chengdi; February 4, 2015 at 06:11. Reason: recent progress. |
|
February 5, 2015, 00:33 |
|
#2 |
Member
Di Cheng
Join Date: May 2010
Location: Beijing, China
Posts: 47
Rep Power: 16 |
I just find out how to fetch the data:
for Integrate Variables, I can get the data by print inte.CellData['pU'].GetRange()[0] for other data, I think it should be like this: servermanager.Fetch(inte).GetCellData().GetArray(' pU').GetValue(0) |
|
Tags |
paraview, user-defined, weighted average |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Average weighted value calc at specific plane | Mark JIN | OpenFOAM | 6 | July 13, 2018 16:16 |
Near wall treatment in k-omega SST | Arnoldinho | OpenFOAM Running, Solving & CFD | 38 | March 8, 2017 14:48 |
using METIS functions in fortran | dokeun | Main CFD Forum | 7 | January 29, 2013 05:06 |
user defined turbulence model | manuutin | STAR-CD | 5 | October 14, 2009 06:29 |
User Defined Scalars - Returning Values | Carlos V. | FLUENT | 0 | April 19, 2006 19:18 |