Advertisement
lhcamilo

probeLocation

Nov 5th, 2020
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.28 KB | None | 0 0
  1. from paraview.simple import *
  2. import numpy as np
  3. #import paraview.simple as pv
  4.  
  5. #times = np.arange(0,1,0.011)
  6.  
  7.  
  8. # create a new 'OpenFOAMReader'
  9. chamberfoam = OpenFOAMReader(FileName='/data/data05/lhcamilo/simQuarterTemplate/chamber00/chamber.foam')
  10. chamberfoam.SkipZeroTime = 0
  11. chamberfoam.MeshRegions = ['internalMesh']
  12. chamberfoam.CellArrays = ['U', 'p']
  13.  
  14.  
  15.  
  16. # get animation scene
  17. animationScene1 = GetAnimationScene()
  18.  
  19. SetActiveSource(chamberfoam)
  20.  
  21. # get the time-keeper
  22. tk = GetTimeKeeper()
  23. times = tk.TimestepValues
  24. #print(times)
  25.  
  26. # Setup probe
  27. probeLocation1 = ProbeLocation(Input=chamberfoam,
  28.     ProbeType='Fixed Radius Point Source')
  29.  
  30.  
  31.  
  32. # init the 'Fixed Radius Point Source' selected for 'ProbeType'
  33. probeLocation1.ProbeType.Center = [0.05, 0.05, 0.34]
  34.  
  35. probeLocation1.UpdatePipeline()
  36.  
  37. SetActiveSource(probeLocation1)
  38.  
  39. polyData = servermanager.Fetch(probeLocation1)
  40.  
  41. pointData = polyData.GetPointData()
  42. uArray = pointData.GetArray('U')
  43. value = np.array(uArray.GetTuple(0))
  44.  
  45. print(value)
  46.  
  47. tk.Time = 0.33
  48. tk.UpdateTimeInformation()
  49.  
  50.  
  51.  
  52. probeLocation1.UpdatePipeline()
  53.  
  54. polyData = servermanager.Fetch(probeLocation1)
  55.  
  56. pointData = polyData.GetPointData()
  57. uArray = pointData.GetArray('U')
  58. value2 = np.array(uArray.GetTuple(0))
  59.  
  60. print(value2)
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement