#### import the simple module from the paraview from paraview.simple import * import time #### disable automatic camera reset on 'Show' paraview.simple._DisableFirstRenderCameraReset() LoadPalette(paletteName='WhiteBackground') # create a new 'VisItNek5000Reader' gCnek5000 = VisItNek5000Reader(registrationName='GC.nek5000', FileName='/data/S0/GC.nek5000') gCnek5000.Meshes = ['mesh'] gCnek5000.PointArrays = [] # get animation scene animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() # Properties modified on gCnek5000 gCnek5000.PointArrays = ['temperature'] # get active view renderView1 = GetActiveViewOrCreate('RenderView') tsteps = gCnek5000.TimestepValues # show data in view gCnek5000Display = Show(gCnek5000, renderView1, 'UnstructuredGridRepresentation') # trace defaults for the display properties. gCnek5000Display.Representation = 'Surface' gCnek5000Display.ColorArrayName = [None, ''] gCnek5000Display.SelectTCoordArray = 'None' gCnek5000Display.SelectNormalArray = 'None' gCnek5000Display.SelectTangentArray = 'None' gCnek5000Display.OSPRayScaleArray = 'temperature' gCnek5000Display.OSPRayScaleFunction = 'PiecewiseFunction' gCnek5000Display.SelectOrientationVectors = 'None' gCnek5000Display.ScaleFactor = 5.0 gCnek5000Display.SelectScaleArray = 'None' gCnek5000Display.GlyphType = 'Arrow' gCnek5000Display.GlyphTableIndexArray = 'None' gCnek5000Display.GaussianRadius = 0.25 gCnek5000Display.SetScaleArray = ['POINTS', 'temperature'] gCnek5000Display.ScaleTransferFunction = 'PiecewiseFunction' gCnek5000Display.OpacityArray = ['POINTS', 'temperature'] gCnek5000Display.OpacityTransferFunction = 'PiecewiseFunction' gCnek5000Display.DataAxesGrid = 'GridAxesRepresentation' gCnek5000Display.PolarAxes = 'PolarAxesRepresentation' gCnek5000Display.ScalarOpacityUnitDistance = 0.5326472615291485 gCnek5000Display.OpacityArrayName = ['POINTS', 'temperature'] gCnek5000Display.ExtractedBlockIndex = 2 # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' gCnek5000Display.ScaleTransferFunction.Points = [0.9873824119567871, 0.0, 0.5, 0.0, 1.118513822555542, 1.0, 0.5, 0.0] # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' gCnek5000Display.OpacityTransferFunction.Points = [0.9873824119567871, 0.0, 0.5, 0.0, 1.118513822555542, 1.0, 0.5, 0.0] # reset view to fit data renderView1.ResetCamera() # update the view to ensure updated data information renderView1.Update() # create a new 'Contour' contour1 = Contour(registrationName='Contour1', Input=gCnek5000) contour1.ContourBy = ['POINTS', 'temperature'] contour1.Isosurfaces = [1.05] contour1.PointMergeMethod = 'Uniform Binning' # Properties modified on contour1 contour1.Isosurfaces = [1.0015] # show data in view contour1Display = Show(contour1, renderView1, 'GeometryRepresentation') # get color transfer function/color map for 'temperature' temperatureLUT = GetColorTransferFunction('temperature') temperatureLUT.RGBPoints = [0.9983744025230408, 0.231373, 0.298039, 0.752941, 1.0529755055904388, 0.865003, 0.865003, 0.865003, 1.107576608657837, 0.705882, 0.0156863, 0.14902] temperatureLUT.ScalarRangeInitialized = 1.0 # trace defaults for the display properties. contour1Display.Representation = 'Surface' contour1Display.ColorArrayName = ['POINTS', 'temperature'] contour1Display.LookupTable = temperatureLUT contour1Display.SelectTCoordArray = 'None' contour1Display.SelectNormalArray = 'Normals' contour1Display.SelectTangentArray = 'None' contour1Display.OSPRayScaleArray = 'temperature' contour1Display.OSPRayScaleFunction = 'PiecewiseFunction' contour1Display.SelectOrientationVectors = 'None' contour1Display.ScaleFactor = 0.30000000000000004 contour1Display.SelectScaleArray = 'temperature' contour1Display.GlyphType = 'Arrow' contour1Display.GlyphTableIndexArray = 'temperature' contour1Display.GaussianRadius = 0.015 contour1Display.SetScaleArray = ['POINTS', 'temperature'] contour1Display.ScaleTransferFunction = 'PiecewiseFunction' contour1Display.OpacityArray = ['POINTS', 'temperature'] contour1Display.OpacityTransferFunction = 'PiecewiseFunction' contour1Display.DataAxesGrid = 'GridAxesRepresentation' contour1Display.PolarAxes = 'PolarAxesRepresentation' # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' contour1Display.ScaleTransferFunction.Points = [1.0015000104904175, 0.0, 0.5, 0.0, 1.0017441511154175, 1.0, 0.5, 0.0] # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' contour1Display.OpacityTransferFunction.Points = [1.0015000104904175, 0.0, 0.5, 0.0, 1.0017441511154175, 1.0, 0.5, 0.0] # hide data in view Hide(gCnek5000, renderView1) # show color bar/color legend contour1Display.SetScalarBarVisibility(renderView1, True) # update the view to ensure updated data information renderView1.Update() # get opacity transfer function/opacity map for 'temperature' temperaturePWF = GetOpacityTransferFunction('temperature') temperaturePWF.Points = [0.9873824119567871, 0.0, 0.5, 0.0, 1.118513822555542, 1.0, 0.5, 0.0] temperaturePWF.ScalarRangeInitialized = 1 # hide color bar/color legend contour1Display.SetScalarBarVisibility(renderView1, False) # Hide orientation axes renderView1.OrientationAxesVisibility = 0 # export view for TimeStepNum in range(0,len(tsteps)): print("Export scene " + str(TimeStepNum)) renderView1.ViewTime = tsteps[TimeStepNum] name = '/data/S0/rho_' + str(TimeStepNum) + '.x3d' ExportView(name, renderView1, ExportColorLegends=1) animationScene1 = GetAnimationScene() animationScene1.GoToNext() #================================================================ # addendum: following script captures some of the application # state to faithfully reproduce the visualization during playback #================================================================ # get layout layout1 = GetLayout() #-------------------------------- # saving layout sizes for layouts # layout/tab size in pixels layout1.SetSize(967, 626) #----------------------------------- # saving camera placements for views # current camera placement for renderView1 renderView1.CameraPosition = [0.6498826593160629, 0.25, 2.813673999803999] renderView1.CameraFocalPoint = [0.6498826593160629, 0.25, 0.6357862204313278] renderView1.CameraParallelScale = 0.563678835397684 #-------------------------------------------- # uncomment the following to render all views # RenderAllViews() # alternatively, if you want to write images, you can use SaveScreenshot(...).