CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] Paraview Pciture Generation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 7, 2016, 05:19
Default Paraview Pciture Generation
  #1
New Member
 
Aravind Krishnamoorthi
Join Date: Aug 2016
Location: Chemnitz, Germany
Posts: 11
Rep Power: 10
Aravind_Krish is on a distinguished road
Send a message via Skype™ to Aravind_Krish
Hi i am using Paraview 4.4.0 to generate pictures for the mixture formation in a engine.

I have many time steps form openFoam calculation eg. 384 383.1 383.2 383.3.......384.

Using trace option i generated a python script to generate the pictures.

But during picture generation i do not need pictures to be generated at all time steps but only for 383 and 384.

I am attaching the code here..

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

# create a new 'OpenFOAMReader'
casefoam = OpenFOAMReader(FileName='/usr2/tmp/Krishnamoorthi/case0383/case.foam')
casefoam.CaseType = 'Decomposed Case'
casefoam.MeshRegions = ['internalMesh', 'lagrangian/defaultCloud']
casefoam.CellArrays = ['CO', 'CO2', 'Chi', 'EqT', 'H', 'H2', 'H2O', 'N', 'N2', 'NO', 'O', 'O2', 'OH', 'RGA', 'RGA_inl', 'RGA_out', 'T', 'T_tmp', 'U', 'Ydefault', 'Ytf', 'Yto2', 'Z', 'Z2', 'alphat', 'cellMotionU', 'dRoHR', 'dropNum', 'dropVol', 'epsilon', 'fuel', 'k', 'liquidFrom0', 'liquidFrom1', 'liquidFrom2', 'liquidFrom3', 'liquidFrom4', 'meanDropMass', 'meanDropTemp', 'meanTheta', 'meanTheta0', 'meanURel', 'mut', 'omega', 'p', 'p_tmp', 'reactFuel', 'rho', 'voidFrac']
casefoam.LagrangianArrays = ['BY', 'T', 'Tboil', 'U', 'Uturb', 'Weber', 'ct', 'ctRT', 'd', 'd0', 'deltaD', 'dropletMass', 'fuel', 'fuels', 'injector', 'lifeTime', 'liquidCore', 'm', 'ms', 'n', 'origId', 'origProcId', 'peps', 'pk', 'rBubble', 'rBubbleDot', 'secondKHindex', 'tTurb', 'y', 'yDot']

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps( )

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [1499, 906]

# show data in view
casefoamDisplay = Show(casefoam, renderView1)
# trace defaults for the display properties.
casefoamDisplay.ColorArrayName = [None, '']

# reset view to fit data
renderView1.ResetCamera()

# set scalar coloring
ColorBy(casefoamDisplay, ('FIELD', 'vtkBlockColors'))

# show color bar/color legend
casefoamDisplay.SetScalarBarVisibility(renderView1 , True)

# get color transfer function/color map for 'vtkBlockColors'
vtkBlockColorsLUT = GetColorTransferFunction('vtkBlockColors')

# get opacity transfer function/opacity map for 'vtkBlockColors'
vtkBlockColorsPWF = GetOpacityTransferFunction('vtkBlockColors')

# create a new 'Slice'
slice1 = Slice(Input=casefoam)
slice1.SliceType = 'Plane'
slice1.SliceOffsetValues = [0.0]

# init the 'Plane' selected for 'SliceType'
slice1.SliceType.Origin = [0.0, -0.037722447887063026, 0.02939213067293167]

# toggle 3D widget visibility (only when running from the GUI)
Hide3DWidgets(proxy=slice1)

# get color transfer function/color map for 'p'
pLUT = GetColorTransferFunction('p')

# show data in view
slice1Display = Show(slice1, renderView1)
# trace defaults for the display properties.
slice1Display.ColorArrayName = ['POINTS', 'p']
slice1Display.LookupTable = pLUT

# hide data in view
Hide(casefoam, renderView1)

# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, True)

# get opacity transfer function/opacity map for 'p'
pPWF = GetOpacityTransferFunction('p')

# set scalar coloring
ColorBy(slice1Display, ('POINTS', 'RGA'))

# rescale color and/or opacity maps used to include current data range
slice1Display.RescaleTransferFunctionToDataRange(T rue)

# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, True)

# get color transfer function/color map for 'RGA'
rGALUT = GetColorTransferFunction('RGA')

# get opacity transfer function/opacity map for 'RGA'
rGAPWF = GetOpacityTransferFunction('RGA')

# current camera placement for renderView1
renderView1.CameraPosition = [0.3823356101683453, -0.037722447887063026, 0.02939213067293167]
renderView1.CameraFocalPoint = [0.0, -0.037722447887063026, 0.02939213067293167]
renderView1.CameraViewUp = [0.0, 0.0, 1.0]
renderView1.CameraParallelScale = 0.09895573753246074

# save screenshot
SaveScreenshot('/usr2/tmp/Krishnamoorthi/case0383/New/Test/4.png', magnification=1, quality=100, view=renderView1)

# current camera placement for renderView1
renderView1.CameraPosition = [0.3823356101683453, -0.037722447887063026, 0.02939213067293167]
renderView1.CameraFocalPoint = [0.0, -0.037722447887063026, 0.02939213067293167]
renderView1.CameraViewUp = [0.0, 0.0, 1.0]
renderView1.CameraParallelScale = 0.09895573753246074

# save screenshot
SaveScreenshot('/usr2/tmp/Krishnamoorthi/case0383/New/Test/4,1.png', magnification=1, quality=100, view=renderView1)

#### saving camera placements for all active views

# current camera placement for renderView1
renderView1.CameraPosition = [0.3823356101683453, -0.037722447887063026, 0.02939213067293167]
renderView1.CameraFocalPoint = [0.0, -0.037722447887063026, 0.02939213067293167]
renderView1.CameraViewUp = [0.0, 0.0, 1.0]
renderView1.CameraParallelScale = 0.09895573753246074

#### uncomment the following to render all views
# RenderAllViews()
# alternatively, if you want to write images, you can use SaveScreenshot(...).

Is it possible to generate pictures at certain time steps?
If yes can someone tell me where to insert the option in the code
Aravind_Krish is offline   Reply With Quote

Reply

Tags
paraview 4.4.0, screenshot


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Paraview Picuter generation Aravind_Krish ParaView 0 September 5, 2016 08:54
[OpenFOAM] Picture generation in Paraview Aravind_Krish ParaView 1 August 20, 2016 15:27
paraFoam reader for OpenFOAM 1.6 smart OpenFOAM Installation 13 November 16, 2009 22:41
Latest News in Mesh Generation Robert Schneiders Main CFD Forum 1 February 18, 2000 01:48
Latest news in mesh generation Robert Schneiders Main CFD Forum 0 March 2, 1999 05:07


All times are GMT -4. The time now is 00:59.