|
[Sponsors] |
[General] Pass variable from programmable filter to Plot Over Line Filter |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 29, 2016, 14:18 |
Pass variable from programmable filter to Plot Over Line Filter
|
#1 |
Member
Jack
Join Date: May 2015
Posts: 98
Rep Power: 11 |
My problem is as follows. The script below basically orders unstructured points of an airfoil profile so that I get points ordered from the Leading edge to trailing edge on both suction and pressure surfaces. This is accomplished inside the Programmable filter. The point of interest is
Code:
point_coord Code:
#### import the simple module from the paraview from paraview.simple import * # create a new 'EnSight Reader' cFX_00 = EnSightReader(CaseFileName='/Users/CFD/Rotor/user_files/CFX_001_ensight.case') # create a new 'Extract Block' extractBlock1 = ExtractBlock(Input=cFX_00) # Properties modified on extractBlock1 extractBlock1.BlockIndices = [4] # create a new 'Extract Surface' extractSurface1 = ExtractSurface(Input=extractBlock1) # create a new 'Generate Surface Normals' generateSurfaceNormals1 = GenerateSurfaceNormals(Input=extractSurface1) generateSurfaceNormals1.FlipNormals = 0 # create a new 'Programmable Filter' programmableFilter1 = ProgrammableFilter(Input=generateSurfaceNormals1) script1 = [ 'from vtk.util.numpy_support import vtk_to_numpy', 'import numpy as np', 'try:', ' import ordering', 'except ImportError:', ' import sys', ' sys.path.append("/Users/CFXPost")', ' import ordering', 'def order(input, output):', ' output.ShallowCopy(input)', ' numPoints = input.GetNumberOfPoints()', ' coords = []', ' for i in range(0, numPoints):', ' coord = input.GetPoint(i)', ' coords.append(coord) ', ' coords = np.asarray(coords)', ' x,y,z = coords[:,0],coords[:,1],coords[:,2]', ' r,th = ordering.convert_to_cyl(x,y)', ' iss,ips = ordering.order_chord(coords)', ' ss = ordering.perc_arc(z[iss],th[iss])', ' ps = ordering.perc_arc(z[ips],th[ips])', ' ind = (np.abs(ss-%0.4f)).argmin()' % chord_loc, ' point_ind = iss[ind]', ' point_coord = input.GetPoints().GetPoint(point_ind)', ' ', 'input = self.GetInputDataObject(0, 0)', 'output = self.GetOutputDataObject(0)', ' ', 'if input.IsA("vtkMultiBlockDataSet"):', ' output.CopyStructure(input)', ' iter = input.NewIterator()', ' iter.UnRegister(None)', ' iter.InitTraversal()', ' while not iter.IsDoneWithTraversal():', ' curInput = iter.GetCurrentDataObject()', ' curOutput = curInput.NewInstance()', ' curOutput.UnRegister(None)', ' output.SetDataSet(iter, curOutput)', ' order(curInput, curOutput)', ' iter.GoToNextItem();', 'else:', ' order(input, output)' ] programmableFilter1.Script = str("\n".join(script1)) programmableFilter1.RequestInformationScript = '' programmableFilter1.RequestUpdateExtentScript = '' programmableFilter1.PythonPath = '' # create a new 'Plot Over Line' plotOverLine1 = PlotOverLine(Input=cFX_00, Source='High Resolution Line Source') plotOverLine1.Source.Point2 = point_coord # <-- From programmable filter! plotOverLine1.Source.Point2 = [0.05050000175833702, 0.020051924511790276, 0.0] |
|
Tags |
paraview, plot over line, programmable filter |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Derivative of velocity and mean velocity | hiuluom | OpenFOAM Post-Processing | 1 | May 30, 2015 00:42 |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 06:42 |
8x icoFoam speed up with Cufflink CUDA solver library | kmooney | OpenFOAM Running, Solving & CFD | 42 | November 6, 2012 12:37 |
Problems of Duns Codes! | Martin J | Main CFD Forum | 8 | August 15, 2003 00:19 |
error while compiling the USER Sub routine | CFD user | CFX | 3 | November 25, 2002 16:16 |