-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpp_lineouts.py
74 lines (61 loc) · 2.25 KB
/
pp_lineouts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# ----------------------------------------------------------------
# imports
# ----------------------------------------------------------------
# import the simple module from the paraview
from paraview.simple import *
# disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
import os
import glob
import shutil
import argparse
import math
# ----------------------------------------------------------------
# setup
# ----------------------------------------------------------------
parser = argparse.ArgumentParser(description="Post process using paraview")
parser.add_argument(
"-f", "--folder", help="Folder to post process", type=str, required=True
)
args = parser.parse_args()
# Get file names
fdir = os.path.abspath(args.folder)
pattern = "*.e*"
fnames = sorted(glob.glob(os.path.join(fdir, pattern)))
yname = os.path.join(os.path.dirname(fdir), "channelflow.yaml")
odir = os.path.join(os.path.dirname(fdir), "lineouts")
shutil.rmtree(odir, ignore_errors=True)
os.makedirs(odir)
opfx = os.path.join(odir, "output")
# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------
# create list of fields
fields = ["velocity_", "turbulent_ke"]
blocks = ["unspecified-2-hex"]
# create a new 'ExodusIIReader'
exoreader = ExodusIIReader(FileName=fnames)
exoreader.PointVariables = fields
exoreader.SideSetArrayStatus = []
exoreader.ElementBlocks = blocks
# get active view
renderView1 = GetActiveViewOrCreate("RenderView")
# create a new 'Plot Over Line'
plotOverLine1 = PlotOverLine(Input=exoreader, Source="High Resolution Line Source")
plotOverLine1.Source.Resolution = 100000
# Line out coordinates
xcens = [3.0]
for k, xcen in enumerate(xcens):
plotOverLine1.Source.Point1 = [xcen, 0.0, math.pi * 0.5]
plotOverLine1.Source.Point2 = [xcen, 2.0, math.pi * 0.5]
# ----------------------------------------------------------------
# save data
# ----------------------------------------------------------------
SaveData(
opfx + "_lineout_{0:d}.csv".format(k),
proxy=plotOverLine1,
Precision=5,
UseScientificNotation=0,
WriteTimeSteps=1,
FieldAssociation="Points",
)