#### 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的更多相关文章

  1. 分享JQuery动画插件Velocity.js的六种列表加载特效

    分享JQuery动画插件Velocity.js的六种列表加载特效.在这款实例中给中六种不同的列表加载效果.分别为从上飞入.从右侧飞入.从左侧飞入.和渐显.一起看下效果图: 在线预览   源码下载 实现 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. hbot固件配置

    又入了一台打印机,171到手,本来之前有更好的,无奈别人下手太快,只剩这台了. 175x135x180的样子. 创客的板,还带16g的闪迪内存卡,看到那会儿感觉赚大了! 拿到的时候不少螺丝松的,有的打 ...

  6. 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 ...

  7. Usage of hdf2v3 and hdf2file

    备注 修改Filetype,再执行hdf2file或hdf2tab,可以输出不同类型的数据.把Filetype设置成8,就是 Tecplot 格式的数据. <!DOCTYPE html PUBL ...

  8. Python演讲笔记1

    参考: 1. The Clean Architecture in Python (Brandon Rhodes) 2. Python Best Practice Patterns (Vladimir ...

  9. 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 ...

随机推荐

  1. 【POJ 1470】 Closest Common Ancestors

    [题目链接] 点击打开链接 [算法] 离线tarjan求最近公共祖先 [代码] #include <algorithm> #include <bitset> #include ...

  2. [loj6089]小Y的背包计数问题

    https://www.zybuluo.com/ysner/note/1285358 题面 小\(Y\)有一个大小为\(n\)的背包,并且小\(Y\)有\(n\)种物品. 对于第\(i\)种物品,共有 ...

  3. java笔记线程方式1获取对象名称

    * 如何获取线程对象的名称呢? * public final String getName():获取线程的名称. * 如何设置线程对象的名称呢? * public final void setName ...

  4. Linux 上安装 Node.js

    Linux 上安装 Node.js 直接使用已编译好的包(在个人阿里云服务器47.100.6.106上安装) Node 官网已经把 linux 下载版本更改为已编译好的版本了,我们可以直接下载解压后使 ...

  5. Linux学习笔记之Linux shell脚本运行出现问题:bash: ./test: bin/sh: bad interpreter: No such file or directory

    问题: 在Linux系统中使用“vi test.sh”命令创建.sh文件,保存文件(:wq)并赋予权限(chmod +x test.sh)后,执行(./test.sh),出现问题:“bash: ./t ...

  6. JavaScript--userAgent

    userAgent 返回用户代理头的字符串表示(就是包括浏览器版本信息等的字符串) 语法 navigator.userAgent 几种浏览的user_agent.,像360的兼容模式用的是IE.极速模 ...

  7. 大数高精度加减乘除 51nod 1005 大数加法

    1005 大数加法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题  收藏  关注 给出2个大整数A,B,计算A+B的结果. Input 第1行:大数A 第2行:大数B ...

  8. daily_journal_3 the game of thrones

    昨晚追完了最爱的美剧(the game of thrones),哇,看到结局有点崩溃.果然还是美帝淫民开放,各种乱伦,在七夕收到的万点暴击就祝天下有情人就像剧中一样终是血亲. 昨天算是完成了git的复 ...

  9. 在 NodeJs 上搭建 React 开发环境

    步骤: 1. 安装 nodejs :根据你的 Windows 类型(x86或x64)下载相应的安装包进行安装.安装完成后,可以在任一目录下打开 cmd 窗口并运行 node -v 命令,如果显示 no ...

  10. C#模拟百度登录并到指定网站评论回帖(三)

    上次说到怎么获取BAIDUID,这个相信很多人都能够拿到就不多说了,今天一连说两个,获取token和raskey 2.利用以上获得的cookie直接访问页面 https://passport.baid ...