HCAI
HCAI

Reputation: 2263

Temporal statistics from command line in paraview linux

I'm running paraview on a linux server with poor graphics so I'm limited to command line approach.

I'd very much like to be able to read in a CFD results file into paraview. Average them at each point by: Filter>Temporal Statistics Then plot a line : Plot over line And save plot as .csv file.

I'm not sure if a python script would be way forward or perhaps running paraview from command line. What do you recommend?

Upvotes: 0

Views: 440

Answers (1)

Kenneth Moreland
Kenneth Moreland

Reputation: 380

This definitely looks like a job for Python scripting. First, I would use the ParaView GUI's tracing capability to create the script to automate what you want to do. Then on your Linux server use the pvpython program (which comes with ParaView) to run the script. (Note that if you are on a cluster that uses MPI, you should use pvbatch instead. But it sounds like your server is a single workstation.) You might want to edit the script ParaView generates to remove all the rendering items, and you will probably need to change the filename that the script loads and saves.

Here is a quick script I made that does exactly what you are asking on one of ParaView's test data sets. I used the GUI tracing to create it and then deleted all the rendering/display commands as well as other extraneous commands.

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# create a new 'ExodusIIReader'
canex2 = ExodusIIReader(FileName=['/Users/kmorel/data/ParaViewDataNew/can.ex2'])
canex2.ElementVariables = ['EQPS']
canex2.PointVariables = ['DISPL', 'VEL', 'ACCL']
canex2.GlobalVariables = ['KE', 'XMOM', 'YMOM', 'ZMOM', 'NSTEPS', 'TMSTEP']
canex2.NodeSetArrayStatus = []
canex2.SideSetArrayStatus = []

canex2.ElementBlocks = ['Unnamed block ID: 1 Type: HEX', 'Unnamed block ID: 2 Type: HEX']

canex2.ApplyDisplacements = 0

# create a new 'Temporal Statistics'
temporalStatistics1 = TemporalStatistics(Input=canex2)

# create a new 'Plot Over Line'
plotOverLine1 = PlotOverLine(Input=temporalStatistics1,
    Source='High Resolution Line Source')

# init the 'High Resolution Line Source' selected for 'Source'
plotOverLine1.Source.Point1 = [-7.878461837768555, 0.0, -14.999999046325684]
plotOverLine1.Source.Point2 = [8.312582015991211, 8.0, 4.778104782104492]

# Properties modified on plotOverLine1
plotOverLine1.Tolerance = 2.22044604925031e-16

# Properties modified on plotOverLine1.Source
plotOverLine1.Source.Point1 = [0.0, 5.0, -15.0]
plotOverLine1.Source.Point2 = [0.0, 5.0, 0.0]

# save data
SaveData('plot_over_line.csv', proxy=plotOverLine1)

Upvotes: 2

Related Questions