I have the following Python script to plot the radial porosity profile for a single slice extracted from a VTK file: import paraview.simple as pvimport numpy as npimport matplotlib.pyplot as pltfrom paraview import numpy_support as nsimport sys fileName = r'porosity.vtk' # Bulk velocity and sphere diameterU0 = 0.0033D0 = 0.003 # Slice location in streamwise directionx0 = 0.01 # Translate in y and z direction to get the origin in the middle of the pipel0 = -0.00015-0.0214/2
U = []R = [] # Pipelinereader = pv.OpenDataFile(fileName)transform=pv.Transform(reader)transform.Transform.Translate = [0,l0,l0]slice = pv.Slice(transform,SliceType='Plane')slice.SliceType.Origin = [x0,0,0]slice.SliceType.Normal = [1,0,0]calc = pv.Calculator(slice, ResultArrayName = 'radius', Function = 'sqrt(coordsY^2+coordsZ^2)')contour = pv.Contour(calc,ContourBy = ['POINTS','radius'],Isosurfaces = [0])int = pv.IntegrateVariables(contour) # Loop over radial distancesfor r in np.linspace(0.00015,0.01065,200): contour.Isosurfaces = [r] intData = pv.servermanager.Fetch(int) L = ns.vtk_to_numpy(intData.GetCellData().GetArray('Length'))[0] U.append(ns.vtk_to_numpy(intData.GetPointData().GetArray('Porosity'))[0]/L) R.append(0.01065-r) # Plot the resultsplt.plot(np.array(R)/D0,np.array(U), 'b-')plt.xlabel('Distance from the wall in particle diameters')plt.ylabel('Porosity')plt.ylim(0,1)plt.show() How could I modify this Python script to average the radial porosity profiles also along the streamwise (axial) direction (x coordinate)?
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview