I have some 3D data that I need to average out across two dimensions. Specifically, I have an XYZ representation of something that is spherically symmetric, and I want to compute the average value of a cell quantity across shells of constant radius. My attempts so far go as follows:
- Compute spherical coordinates using Calculator, and use them as the new coordinates.
- Define a planar Slice.
- Use IntegrateVariables to find average quantity (density in this case).
This does what I want, but only for a single value of R. I need to compute this as a function of R (at something like all of the R values I have points at). I will then use the result to define new cell data, so that I can compute the deviation of the cartesian density field from the spherical average at every point.
I assume that I will have to do this using a Programmable filter, but I haven’t been able to figure out how to do that. All I have so far is the Trace of the operations described above. I can’t figure out how to access the data from the IntegrateVariables object, nor can I figure out how to use the results to make a new Cell Data field. Can anyone give me some kind of starting point?
I will need to make this into a Programmable Filter eventually, if that’s relevant.
Thanks in advance,
# trace generated using paraview version 5.8.0-RC2 # # To ensure correct image size when batch processing, please search # for and uncomment the line `# renderView*.ViewSize = [*,*]` #### import the simple module from the paraview from paraview.simple import * #### disable automatic camera reset on 'Show' paraview.simple._DisableFirstRenderCameraReset() # create a new 'EnSight Reader' engoldcase = EnSightReader(CaseFileName=<PATH_TO_DATA>) engoldcase.CellArrays = ['den', 'pres', 'ie', 'flg', 'vol', 'u', 'v', 'w', 'tau11', 'tau22', 'tau33', 'tau12', 'tau13', 'tau23', 'vf00', 'd00'] engoldcase.PointArrays = ['vel', 'kfix'] # create a new 'Calculator' calculator1 = Calculator(Input=engoldcase) calculator1.Function = '' calculator1.CoordinateResults = 1 # Properties modified on calculator1 calculator1.ResultArrayName = 'CoordR' calculator1.Function = 'mag(coords)*iHat+atan(sqrt(coordsX^2+coordsY^2)/coordsZ)*jHat+atan(coordsY/coordsX)*kHat' # create a new 'Slice' slice1 = Slice(Input=calculator1) slice1.SliceType = 'Plane' slice1.HyperTreeGridSlicer = 'Plane' slice1.SliceOffsetValues = [0.0] # create a new 'Integrate Variables' integrateVariables1 = IntegrateVariables(Input=slice1)