save density, pressure, velocity, temperature contour at one slice in xy plane-- paraview with batch Python scripts
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# create a new 'EnSight Reader' and assign it to a variable, 'transientcase'
transientcase = EnSightReader(CaseFileName='/home/kaiming/Documents/ZJU_Projects/Jet/data/transient.case')
transientcase.PointArrays = ['v', 'density', 'pressure', 'temperature']
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [788, 837]
# get color transfer function/color map for 'density'
densityLUT = GetColorTransferFunction('density')
# show data in view
transientcaseDisplay = Show(transientcase, renderView1)
# trace defaults for the display properties.
transientcaseDisplay.ColorArrayName = ['POINTS', 'density']
transientcaseDisplay.LookupTable = densityLUT
transientcaseDisplay.GlyphType = 'Arrow'
transientcaseDisplay.ScalarOpacityUnitDistance = 0.0016420380639339577
# reset view to fit data
renderView1.ResetCamera()
# show color bar/color legend
transientcaseDisplay.SetScalarBarVisibility(renderView1, False)
# get opacity transfer function/opacity map for 'density'
densityPWF = GetOpacityTransferFunction('density')
# reset view to fit data
renderView1.ResetCamera()
#################
## slice
################
# create a new 'Slice'
slice1 = Slice(Input=transientcase)
slice1.SliceType = 'Plane'
slice1.SliceOffsetValues = [0.0]
# init the 'Plane' selected for 'SliceType'
slice1.SliceType.Origin = [-0.21849990739250558, 0.0, 0.0]
# Properties modified on slice1.SliceType
slice1.SliceType.Origin = [0.0, 0.0, 0.0]
slice1.SliceType.Normal = [0.0, 0.0, 1.0]
# show data in view
slice1Display = Show(slice1, renderView1)
# trace defaults for the display properties.
slice1Display.ColorArrayName = ['POINTS', 'density']
slice1Display.LookupTable = densityLUT
slice1Display.GlyphType = 'Arrow'
# hide data in view
Hide(transientcase, renderView1)
# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, True)
# set active source
SetActiveSource(transientcase)
# reset view to fit data
renderView1.ResetCamera()
# current camera placement for renderView1
renderView1.CameraPosition = [-0.21849990739250558, 0.0, 0.9599974287600782]
renderView1.CameraFocalPoint = [-0.21849990739250558, 0.0, 0.0]
renderView1.CameraParallelScale = 0.2494169143257604
# *****************
# change legend layout, and its font color, position
# *****************
# get color legend for 'densityLUT' in view 'renderView1'
densityLUTColorBar = GetScalarBar(densityLUT, renderView1)
# Properties modified on densityLUTColorBar
densityLUTColorBar.AutoOrient = 0
## legend orientation
densityLUTColorBar.Orientation = 'Horizontal'
## legend normalized position
densityLUTColorBar.Position = [0.3, 0.2]
# change label color to 'black'
densityLUTColorBar.LabelColor = [0.0, 0.0, 0.0]
# change titile color to 'black'
densityLUTColorBar.TitleColor = [0.0, 0.0, 0.0]
# ***************
# set Background color as 'White'
renderView1.Background =[1,1,1]
# get layout
viewLayout1 = GetLayout()
# save screenshot
SaveScreenshot('/home/kaiming/Documents/ZJU_Projects/Jet/paraview/d_63.png', layout=viewLayout1, magnification=1, quality=100)
#################
# pressure contour
##################
# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, False)
# set active source
SetActiveSource(slice1)
# set scalar coloring
ColorBy(slice1Display, ('POINTS', 'pressure'))
# rescale color and/or opacity maps used to include current data range
slice1Display.RescaleTransferFunctionToDataRange(True)
# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, True)
# get color transfer function/color map for 'pressure'
pressureLUT = GetColorTransferFunction('pressure')
# get opacity transfer function/opacity map for 'pressure'
pressurePWF = GetOpacityTransferFunction('pressure')
# set active source
SetActiveSource(transientcase)
# *****************
# change legend layout, and its font color, position
# *****************
# get color legend for 'densityLUT' in view 'renderView1'
pressureLUTColorBar = GetScalarBar(pressureLUT, renderView1)
# Properties modified on vLUTColorBar
pressureLUTColorBar.AutoOrient = 0
## legend orientation
pressureLUTColorBar.Orientation = 'Horizontal'
## legend normalized position
pressureLUTColorBar.Position = [0.3, 0.2]
# change label color to 'black'
pressureLUTColorBar.LabelColor = [0.0, 0.0, 0.0]
# change titile color to 'black'
pressureLUTColorBar.TitleColor = [0.0, 0.0, 0.0]
# ***************
# current camera placement for renderView1
renderView1.CameraPosition = [-0.21849990739250558, 0.0, 0.9599974287600782]
renderView1.CameraFocalPoint = [-0.21849990739250558, 0.0, 0.0]
renderView1.CameraParallelScale = 0.2494169143257604
# save screenshot
SaveScreenshot('/home/kaiming/Documents/ZJU_Projects/Jet/paraview/p_63.png', layout=viewLayout1, magnification=1, quality=100)
######################
# #temperature contour
######################
# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, False)
# set active source
SetActiveSource(slice1)
# set scalar coloring
ColorBy(slice1Display, ('POINTS', 'temperature'))
# rescale color and/or opacity maps used to include current data range
slice1Display.RescaleTransferFunctionToDataRange(True)
# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, True)
# get color transfer function (color map) for 'temperature'
temperatureLUT = GetColorTransferFunction('temperature')
# get opacity transfer function/opacity map for 'temperature'
temperaturePWF = GetOpacityTransferFunction('temperature')
# ******
# legend layout, and its font color, position
# *****
temperatureLUTColorBar = GetScalarBar(temperatureLUT, renderView1)
# Properties modified on vLUTColorBar
temperatureLUTColorBar.AutoOrient = 0
## legend orientation
temperatureLUTColorBar.Orientation = 'Horizontal'
## legend normalized position
temperatureLUTColorBar.Position = [0.3, 0.2]
# label color to 'black'
temperatureLUTColorBar.LabelColor = [0.0, 0.0, 0.0]
# change 'titile' color to 'black'
temperatureLUTColorBar.TitleColor = [0.0, 0.0, 0.0]
# *****************
# set active source
SetActiveSource(transientcase)
# current camera placement for renderView1
renderView1.CameraPosition = [-0.21849990739250558, 0.0, 0.9599974287600782]
renderView1.CameraFocalPoint = [-0.21849990739250558, 0.0, 0.0]
renderView1.CameraParallelScale = 0.2494169143257604
# save screenshot
SaveScreenshot('/home/kaiming/Documents/ZJU_Projects/Jet/paraview/t_63.png', layout=viewLayout1, magnification=1, quality=100)
# *****************
# velocity
# ****************
# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, False)
# set active source
SetActiveSource(slice1)
# set scalar coloring
ColorBy(slice1Display, ('POINTS', 'v'))
# rescale color and/or opacity maps used to include current data range
slice1Display.RescaleTransferFunctionToDataRange(True)
# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, True)
# get color transfer function/color map for 'v'
vLUT = GetColorTransferFunction('v')
# get opacity transfer function/opacity map for 'v'
vPWF = GetOpacityTransferFunction('v')
# *****************
# change legend layout, and its font color, position
# *****************
# get color legend for 'densityLUT' in view 'renderView1'
vLUTColorBar = GetScalarBar(vLUT, renderView1)
# Properties modified on vLUTColorBar
vLUTColorBar.AutoOrient = 0
## legend orientation
vLUTColorBar.Orientation = 'Horizontal'
## legend normalized position
vLUTColorBar.Position = [0.3, 0.2]
# change label color to 'black'
vLUTColorBar.LabelColor = [0.0, 0.0, 0.0]
# change titile color to 'black'
vLUTColorBar.TitleColor = [0.0, 0.0, 0.0]
# ***************
# set active source
SetActiveSource(transientcase)
# current camera placement for renderView1
renderView1.CameraPosition = [-0.21849990739250558, 0.0, 0.9599974287600782]
renderView1.CameraFocalPoint = [-0.21849990739250558, 0.0, 0.0]
renderView1.CameraParallelScale = 0.2494169143257604
# save screenshot
SaveScreenshot('/home/kaiming/Documents/ZJU_Projects/Jet/paraview/v_63.png', layout=viewLayout1, magnification=1, quality=100)
#### saving camera placements for all active views
# current camera placement for renderView1
renderView1.CameraPosition = [-0.21849990739250558, 0.0, 0.9599974287600782]
renderView1.CameraFocalPoint = [-0.21849990739250558, 0.0, 0.0]
renderView1.CameraParallelScale = 0.2494169143257604
#### uncomment the following to render all views
# RenderAllViews()
# alternatively, if you want to write images, you can use SaveScreenshot(...).
save density, pressure, velocity, temperature contour at one slice in xy plane-- paraview with batch Python scripts的更多相关文章
- 分享JQuery动画插件Velocity.js的六种列表加载特效
分享JQuery动画插件Velocity.js的六种列表加载特效.在这款实例中给中六种不同的列表加载效果.分别为从上飞入.从右侧飞入.从左侧飞入.和渐显.一起看下效果图: 在线预览 源码下载 实现 ...
- post processing in CFD
post post Table of Contents 1. Post-processing 1.1. Reverse flow 1.1.1. reasons 1.1.2. solutions 1.2 ...
- jet flow in a combustion chamber
Table of Contents 1. contacts 2. Paper digest 2.1. LES vs. RANS 2.2. Dynamics of Transient Fuel Inje ...
- saving snaps iteratively with for loop in Paraview
Goal: read data 1 and slice, then save pressure, velocity contours, close data, then do loop for the ...
- hbot固件配置
又入了一台打印机,171到手,本来之前有更好的,无奈别人下手太快,只剩这台了. 175x135x180的样子. 创客的板,还带16g的闪迪内存卡,看到那会儿感觉赚大了! 拿到的时候不少螺丝松的,有的打 ...
- Fast-tracking approach for building routing topologies in fast-moving networks
In one embodiment, a local node in a communication network determines a set of its neighbor nodes, a ...
- Usage of hdf2v3 and hdf2file
备注 修改Filetype,再执行hdf2file或hdf2tab,可以输出不同类型的数据.把Filetype设置成8,就是 Tecplot 格式的数据. <!DOCTYPE html PUBL ...
- Python演讲笔记1
参考: 1. The Clean Architecture in Python (Brandon Rhodes) 2. Python Best Practice Patterns (Vladimir ...
- Disposable microfluidic devices: fabrication, function, and application Gina S. Fiorini and Daniel T
Disposable microfluidic devices: fabrication, function, and application Gina S. Fiorini and Daniel T ...
随机推荐
- 列表渲染v-for
v-for我们用v-for指令根据一组数据的选项列表进行渲染.v-for指令需要以item in items形式的特殊语法,items是源数据数组并且item是数组元素迭代的别名. demo: < ...
- bzoj2419
http://www.lydsy.com/JudgeOnline/problem.php?id=2419 ∑Ui−UjRi,j=0∑Ui−UjRi,j=0 ∑U1−UjR1,j=1∑U1−UjR1,j ...
- CI CD系统整合
转载_CI 系统搭建:Git.Gerrit与Jenkins 2014-08-11 20:55 15678人阅读 评论(1) 收藏 举报 分类: 软件集成和项目管理(3) 目录(?)[+] 去年写的这五 ...
- 响应在此上下文中不可用 asp.net
(一)实例1: 在asp.net程序中添加了一个 类.cs 如下 using System; using System.Collections; using System.ComponentModel ...
- TCP/IP 3握手4挥手
转:摘自<图解TCP/IP>P204 三次握手与四次挥手的状态转移图如下: 如图,由于第二次握手接收端发送SYN+ACK信号所以握手只用了三次,挥手由于接收端ACK和FIN分两次发的,所以 ...
- Java多线程——线程的死锁
Java多线程——线程的死锁 摘要:本文主要介绍了Java多线程中遇到的死锁问题. 部分内容来自以下博客: https://www.cnblogs.com/wy697495/p/9757982.htm ...
- LN : leetcode 513 Find Bottom Left Tree Value
lc 513 Find Bottom Left Tree Value 513 Find Bottom Left Tree Value Given a binary tree, find the lef ...
- poj1778 All Discs Considered
思路: 拓扑排序.贪心. 实现: #include <bits/stdc++.h> using namespace std; vector<]; int n1, n2; inline ...
- 关于定位中left和right,top和bottom的权重问题
关于定位中left和right,top和bottom的权重问题 在共同类中设置了定位并且设置了left等定位,如果你引用这个类并加入其他的类中也有left和right等定位,那么你设置的right或是 ...
- 联想 S5【K520】免解锁BL 免rec 保留数据 Magisk Xposed 救砖 ROOT ZUI 3.7.490
>>>重点介绍<<< 第一:本刷机包可卡刷可线刷,刷机包比较大的原因是采用同时兼容卡刷和线刷的格式,所以比较大第二:[卡刷方法]卡刷不要解压刷机包,直接传入手机后用 ...