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

[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12

Register Blogs Community New Posts Updated Threads Search

Like Tree10Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 24, 2013, 09:49
Unhappy Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12
  #1
Senior Member
 
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 14
keepfit is on a distinguished road
Hi Foamers,

It seems that "Automatically Rescale to Fit Data Range" does not work in compiled ParaView 3.12 for OpenFoam 2.1.1. This issue was always bugging me, especially when comes to saving "Animation".

System: Ubuntu 12.04 32-bit, OF 2.1.1, paraview 3.12

PV settings: 1) Edit --> Settings: Rescale Data Range Mode -->Grow every timestep
2) Color scale editor: Automatically Rescale to Fit Data Range is on

When playing saved results, the value of selected colour legend is rising while the max. exceeds the current max.. However, when the current max value drops, the max. value of the colour legend does not change!

This causes saved animations has same colour of selected fields (pressure or velocity) especially a very high value of magnitude takes places in few timesteps.

For example, if i wanna make a animation of propagation of water waves over slope, the max. velocity of wave during the overall simulation is c.a 12 m/s, while the estimated average velocity is 4~6 m/s, so the contour colour of most screen-shots looks the same and could not figure out the Velocity Fields.

1. Animation screenshot (It is difficult to find out the max velocity.)


2. Manually press the "Rescale to Data Range" button (expected output)





Having searched through the forum but could not find the solution. Has some one faced this annoying issue and solved it?

Best,

David
keepfit is offline   Reply With Quote

Old   May 25, 2013, 09:44
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings David,

Many thanks for the thorough explanation!

Here's what I've managed to figure out:
  • Can't blame the feature, since it's doing what it says it should do: "Grow every timestep" - so if the maximum doubles its value in a single iteration, it simply goes to where it should!
  • There are a few suggestions on what you can try to make it easier to see, as shown in the attached image:
    • Click on "Choose Preset" to change to "Blue to Red ... - HSV". This will make it easier to see the different colour gradings.
    • Change "Resolution" to "32", so that it'll be easier to see the different colours, since it won't be as mixed.
    • Add and move reference points in the colour scale. If you compare the bar on the top of the attached image, to the one you've got, you should see 2 new points on the attached image. You can click to add/select (use the "Del" key to remove a selected one) and use the mouse to drag the point to a better location.
  • There is also the possibility of hacking this scaling feature using the "Programmable Filter", but I haven't tried this.
  • Last but not least... the latest ParaView 4.0 (currently RC1... or maybe it was already on ParaView 3.98?), seems to have some very wicked colour range scaling techniques: http://paraview.org/Wiki/ParaView/Di...sfer_Functions
Best regards,
Bruno
Attached Images
File Type: png Screenshot from 2013-05-25 13:07:52.png (48.2 KB, 373 views)
__________________
wyldckat is offline   Reply With Quote

Old   May 25, 2013, 16:55
Default
  #3
Senior Member
 
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 14
keepfit is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings David,

Many thanks for the thorough explanation!

Here's what I've managed to figure out:
  • Can't blame the feature, since it's doing what it says it should do: "Grow every timestep" - so if the maximum doubles its value in a single iteration, it simply goes to where it should!
  • There are a few suggestions on what you can try to make it easier to see, as shown in the attached image:
    • Click on "Choose Preset" to change to "Blue to Red ... - HSV". This will make it easier to see the different colour gradings.
    • Change "Resolution" to "32", so that it'll be easier to see the different colours, since it won't be as mixed.
    • Add and move reference points in the colour scale. If you compare the bar on the top of the attached image, to the one you've got, you should see 2 new points on the attached image. You can click to add/select (use the "Del" key to remove a selected one) and use the mouse to drag the point to a better location.
  • There is also the possibility of hacking this scaling feature using the "Programmable Filter", but I haven't tried this.
  • Last but not least... the latest ParaView 4.0 (currently RC1... or maybe it was already on ParaView 3.98?), seems to have some very wicked colour range scaling techniques: http://paraview.org/Wiki/ParaView/Di...sfer_Functions
Best regards,
Bruno
thanks Bruno, i will try the methods you've mentioned.

Since the feature is not provided, is there any other hacking way to the source code that the "Rescale to Data Range" button is automatically pressed each time step?
keepfit is offline   Reply With Quote

Old   May 25, 2013, 17:07
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by keepfit View Post
Since the feature is not provided, is there any other hacking way to the source code that the "Rescale to Data Range" button is automatically pressed each time step?
Like I said:
Quote:
There is also the possibility of hacking this scaling feature using the "Programmable Filter", but I haven't tried this.
This requires that ParaView is built with Python. This way, "Programmable Filter" gives us access to the fields and should also somehow give access to the scales.

Another possibility is to do the animation purely through python scripts... ParaView does have the "Python Trace" feature, so it's just a matter of hacking the resulting macro script. But again, ParaView must be built with Python support.

Said Python support depends on how you built/installed ParaView in the first place.
__________________
wyldckat is offline   Reply With Quote

Old   August 3, 2013, 21:58
Default
  #5
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
hi Bruno
If 4 is better can i install Paraview 4.0 on ubuntu 11.10 or can't?!
@David
Hi
There is a button for automatic scale change in options,check mark it.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 17, 2013, 14:24
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

Quote:
Originally Posted by immortality View Post
hi Bruno
If 4 is better can i install Paraview 4.0 on ubuntu 11.10 or can't?!
Technically, you can have all versions of ParaView since at least 3.12.0 up to 4.0.1, by using the pre-built binaries - http://paraview.org/paraview/resources/software.php - and they should work on Ubuntu 11.10.
The problem comes when you actually need to use them, namely:
  1. You'll only be able to use the internal ".foam" reader.
  2. You'll at least need an alias command for launching each ParaView instance.
The other possibility is to build ParaView 4.0.1 from source code and adjust the official OpenFOAM plugin as hinted by this bug report: http://www.openfoam.org/mantisbt/view.php?id=621


Quote:
Originally Posted by immortality View Post
@David
Hi
There is a button for automatic scale change in options,check mark it.
Didn't you read what David wrote?
Quote:
Originally Posted by keepfit View Post
System: Ubuntu 12.04 32-bit, OF 2.1.1, paraview 3.12

PV settings: 1) Edit --> Settings: Rescale Data Range Mode -->Grow every timestep
2) Color scale editor: Automatically Rescale to Fit Data Range is on

When playing saved results, the value of selected colour legend is rising while the max. exceeds the current max.. However, when the current max value drops, the max. value of the colour legend does not change!
____________________________________

But back on the original topic - As I wrote in the past, one needs Python built into ParaView for making the following technique to work. I only managed to look into this today, because since yesterday I've been studying how to use some of of the missing ParaView features.

So, to be able to get the animation to update the ranges on each iteration, one has to:
  1. Start ParaView and open the case in question.
  2. In the menu, check the "View -> Animation View" option.
  3. Follow the numbers on the attached image:
    1. Select the Python entry from the drop-down box.
    2. Click on the + button.
    3. Double-click on the grey line where the 3 is. It should show a dialogue window with the following code:
      Code:
      def start_cue(self): pass
      
      def tick(self): pass
      
      def end_cue(self): pass
  4. Now, replace the source code shown in the dialogue window with the following code:
    Code:
    from paraview.simple import *
    
    def start_cue(self): pass
    
    def tick(self):
        source = FindSource("testTubeMixer.foam")
    
        #This works fine on ParaView 3.12.0 to 4.0.1
        source.UpdatePipeline(GetAnimationScene().TimeKeeper.Time)
    
        #The array and number of components
        arrayName = "U"
        arrayComponents = 3
        component = -1
        #options for component: -1, 0, 1 and 2 => Mag, X, Y, Z
    
        # If it's a scalar field
        #arrayName = "p"
        #arrayComponents = 1
        #component = 0
    
    
        #Get the look-up table for this array
        lookupTable = GetLookupTableForArray(arrayName, arrayComponents)
    
        #get the access to the cellData or pointData
        data = source.GetCellDataInformation()
        #data = source.GetPointDataInformation()
    
        #get the array and the respective min-max
        array = data.GetArray(arrayName)
        dataRange = array.GetRange(component)
    
        lookupTable.LockScalarRange = 1
    
        #Now let's hack in the range values
        lookupTable.RGBPoints[0] = dataRange[0] #min
        lookupTable.RGBPoints[4] = dataRange[1] #max
    
    
    def end_cue(self): pass
  5. Hit the OK button and it's ready to go, namely it will rescale the Magnitude array of the "U"data on the entry "testTubeMixer.foam" on the "Pipeline Browser".
The code is commented and explains each major group of lines, but I'd like to point out the following items:
  • This is where you define the name of the entry:
    Code:
    source = FindSource("testTubeMixer.foam")
    Note: I used the tutorial "multiphase/interDyMFoam/ras/testTubeMixer" on OpenFOAM 2.2 for testing this feature. And I ran paraFoam with the "-builtin" option:
    Code:
    paraFoam -builtin
  • These are the variables that define which value array should we be rescaling to:
    Code:
    arrayName = "U"
    arrayComponents = 3
    component = -1
    Where:
    • "arrayName" is for the name defined in the "Color By" entry.
    • "arrayComponents" depends on whether it's a vector field (3) or a scalar field (1).
    • options for "component":
      • -1 => Mag
      • 0 => X
      • 1 => Y
      • 2 => Z
  • As if this wasn't enough of settings to be configured, keep in mind that it also depends on the representation you currently are using, namely:
    • If you are using the cell/face representation, use this line of code:
      Code:
      data = source.GetCellDataInformation()
    • Otherwise, if you're using the vertex/point/interpolated representation, use this code:
      Code:
      data = source.GetPointDataInformation()
    • edit: If you don't understand what I'm talking about, read the post #10 on this thread: http://www.cfd-online.com/Forums/ope...tml#post446170
Best regards,
Bruno
Attached Images
File Type: jpg Screenshot from 2013-08-17 18:09:36.jpg (23.4 KB, 97 views)
__________________

Last edited by wyldckat; September 15, 2013 at 19:11. Reason: see "edit:"; Also fixed broken code for updating the pipeline
wyldckat is offline   Reply With Quote

Old   August 18, 2013, 11:32
Default
  #7
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
Hi dear Bruno
I did what you told except to using -builtin option and it didn't rescale data.should use -builttin necessarily? because I have reconstructed and deleted processor's folders.can't do anything?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 18, 2013, 11:41
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by immortality View Post
I did what you told
What exactly? Did you see how much I wrote on the previous post?

Quote:
Originally Posted by immortality View Post
can't do anything?
Do what?
wyldckat is offline   Reply With Quote

Old   August 18, 2013, 11:52
Default
  #9
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
I used the code as this:
Code:
from paraview.simple import *

def start_cue(self): pass

def tick(self):
    source = FindSource("WR_3.OpenFOAM")
    source.UpdatePipeline(self.GetAnimationTime())

    #The array and number of components
    #arrayName = "p"
    #arrayComponents = 1
    #component = -1
    #options for component: -1, 0, 1 and 2 => Mag, X, Y, Z

    # If it's a scalar field
    arrayName = "p"
    arrayComponents = 1
    component = 0


    #Get the look-up table for this array
    lookupTable = GetLookupTableForArray(arrayName, arrayComponents)

    #get the access to the cellData or pointData
    data = source.GetCellDataInformation()
    #data = source.GetPointDataInformation()

    #get the array and the respective min-max
    array = data.GetArray(arrayName)
    dataRange = array.GetRange(component)

    lookupTable.LockScalarRange = 1

    #Now let's hack in the range values
    lookupTable.RGBPoints[0] = dataRange[0] #min
    lookupTable.RGBPoints[4] = dataRange[1] #max


def end_cue(self): pass
only put the name and scalar field p.
is it incorrect to use .OpeFOAM extension?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 18, 2013, 12:00
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
No, the ".OpenFOAM" file is not the problem.

We've exchanged so many emails and posts, and you still don't provide enough information...
What ParaView version are you using and is there any error message?
__________________
wyldckat is offline   Reply With Quote

Old   August 18, 2013, 12:25
Default
  #11
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
paraView 3.12.0
and each time use start paraView should add the code again?it doesn't save for me.
p increases and should decrease after a time but maximum doesn't decrease to real time maximum,no there isn't any error except that paraview is closed when reaches the last time folder but saves previous images to the path.
is the field with a circle on left in a point representation not cell represent,right?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 18, 2013, 12:55
Default
  #12
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by immortality View Post
and each time use start paraView should add the code again?it doesn't save for me.
Only if you save the state file and reload the case directly from the case file when you need it again.

Quote:
Originally Posted by immortality View Post
p increases and should decrease after a time but maximum doesn't decrease to real time maximum,no there isn't any error except that paraview is closed when reaches the last time folder but saves previous images to the path.
Does the same happen when you do not save the animation? I.e., if you only click on the "play" icon button?

Quote:
Originally Posted by immortality View Post
is the field with a circle on left in a point representation not cell represent,right?
Cell vs Point is shown in this post: http://www.cfd-online.com/Forums/ope...tml#post446170 post #10
__________________
wyldckat is offline   Reply With Quote

Old   August 18, 2013, 13:54
Default
  #13
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
then I should use "save state" and "load state" after I start paraView?
Quote:
Does the same happen when you do not save the animation? I.e., if you only click on the "play" icon button?
I'll test and say.
Quote:
Cell vs Point is shown in this post: studying a valve case post #10
I don't know which one is which!
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 18, 2013, 14:03
Default
  #14
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by immortality View Post
then I should use "save state" and "load state" after I start paraView?
Yes, use "File -> Load State" after ParaView starts.

Quote:
Originally Posted by immortality View Post
I don't know which one is which!
I've edit the other post at the other thread, with a more clear indication of which is which.
__________________
wyldckat is offline   Reply With Quote

Old   August 18, 2013, 14:17
Default
  #15
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
I forgot to say this error occurs when playing or animating in paraView in all time snapshots not only first time step due to #'s in 0 folder:

Code:
ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 19 of /home/ehsan/Desktop/WR_4/0/T: Expected number, string or (, found Temperature


ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 19 of /home/ehsan/Desktop/WR_4/0/U: Expected number, string or (, found Velocity


ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 20 of /home/ehsan/Desktop/WR_4/0/k: Expected number, string or (, found turbulentK


ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 20 of /home/ehsan/Desktop/WR_4/0/omega: Expected number, string or (, found turbulentOmega


ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 19 of /home/ehsan/Desktop/WR_4/0/p: Expected number, string or (, found Pressure


Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 19 of /home/ehsan/Desktop/WR_4/0/T: Expected number, string or (, found Temperature


ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 19 of /home/ehsan/Desktop/WR_4/0/U: Expected number, string or (, found Velocity


ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 20 of /home/ehsan/Desktop/WR_4/0/k: Expected number, string or (, found turbulentK


ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 20 of /home/ehsan/Desktop/WR_4/0/omega: Expected number, string or (, found turbulentOmega


ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 19 of /home/ehsan/Desktop/WR_4/0/p: Expected number, string or (, found Pressure


Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 18, 2013, 16:13
Default
  #16
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
For other readers, I've already explained this one:
Quote:
Originally Posted by immortality View Post
Code:
ERROR: In /home/opencfd/OpenFOAM/ThirdParty-dev/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6481
vtkOpenFOAMReaderPrivate (0x1ad5ec0): Error reading line 19 of /home/ehsan/Desktop/WR_4/0/T: Expected number, string or (, found Temperature
I explained this here: http://www.cfd-online.com/Forums/ope...tml#post446210 post #35


As for this error:
Quote:
Originally Posted by immortality View Post
Code:
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
    import servermanager
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
    import paraview, re, os, os.path, new, sys, vtk
  File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
    from vtkCommonPython import *
ImportError: No module named vtkCommonPython
I reported it just now here: http://www.openfoam.org/mantisbt/view.php?id=969

I'm currently trying to figure out if there a simple fix for this.

Best regards,
Bruno
immortality likes this.
__________________
wyldckat is offline   Reply With Quote

Old   August 18, 2013, 17:15
Default
  #17
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
OK, as implied in the previous post, the bug is related to the missing "vtk*Python.so" library files. This post is meant to fix this problem.


In my DropBox account is the following file (130kB): https://www.dropbox.com/s/edbrvd6xps...so.tar.gz?dl=0 - it provides the aforementioned library binaries for x86_64, built on a virtual machine with OpenSUSE 12.1 x86_64 and Python 2.7.2, which where built for this post: http://www.cfd-online.com/Forums/ope...tml#post435470 post #5

WARNING: Given that these binaries are in my DropBox account and not signed as in Ubuntu, so there is always a risk of the binaries being contaminated with something
Nonetheless, the SHA256 of this file is:
Code:
0acb36947b1f85bf8f3e6d0d6b2958bd602527cee00a15953fd32de566a1fc4e  ParaView-3.12.0-vtk_Python_so.tar.gz
I got it by running:
Code:
sha256sum ParaView-3.12.0-vtk_Python_so.tar.gz
Now, once you download the file, close ParaView and run the following command from where you have the file:
Code:
sudo tar -xf ParaView-3.12.0-vtk_Python_so.tar.gz -C/opt/paraviewopenfoam3120/lib/paraview-3.12
Now, once you start ParaView once again, it should now work as intended.

--------------------

At the request sent to me over private message, here is the 32bit version of the "vtk*Python.so" library files: https://www.dropbox.com/s/xeon94tor1...so-i686.tar.gz - it was built in Ubuntu 12.04 i686, which uses Python 2.7.3.
The SHA256 of this file is:
Code:
2874b682999075462dd131aa0aa81994fc10a273e4e7ea8253d53752089d9910  ParaView-3.12.0-vtk_Python_so-i686.tar.gz
The instructions are the same.
__________________

Last edited by wyldckat; March 26, 2017 at 16:37. Reason: Added link and info for the 32bit | fixed link
wyldckat is offline   Reply With Quote

Old   August 18, 2013, 17:28
Default
  #18
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
With the previous post, the bug is fixed. The post #6 has been updated with instructions on how to use the script in ParaView 3.12.0.

@Ehsan: As a result, the code you should be using is this:
Code:
from paraview.simple import *

def start_cue(self): pass

def tick(self):
    source = FindSource("WR_3.OpenFOAM")
    source.UpdatePipeline(GetAnimationScene().TimeKeeper.Time)

    #The array and number of components
    #arrayName = "p"
    #arrayComponents = 1
    #component = -1
    #options for component: -1, 0, 1 and 2 => Mag, X, Y, Z

    # If it's a scalar field
    arrayName = "p"
    arrayComponents = 1
    component = 0


    #Get the look-up table for this array
    lookupTable = GetLookupTableForArray(arrayName, arrayComponents)

    #get the access to the cellData or pointData
    data = source.GetCellDataInformation()
    #data = source.GetPointDataInformation()

    #get the array and the respective min-max
    array = data.GetArray(arrayName)
    dataRange = array.GetRange(component)

    lookupTable.LockScalarRange = 1

    #Now let's hack in the range values
    lookupTable.RGBPoints[0] = dataRange[0] #min
    lookupTable.RGBPoints[4] = dataRange[1] #max


def end_cue(self): pass
__________________
wyldckat is offline   Reply With Quote

Old   August 18, 2013, 18:11
Default
  #19
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
this kind of errors is shown when play and the minimum and maximum are not correct,I have set poinData in the code:

Code:
  File "<string>", line 27
    data = source.GetPointDataInformation()
    ^
IndentationError: unexpected indent
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by wyldckat; August 18, 2013 at 18:16. Reason: fixed long post. there was no need to post the same error message several times
immortality is offline   Reply With Quote

Old   August 18, 2013, 18:19
Default
  #20
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
It means that your code is broken. This is why I don't completely like Python

The reason is because for Python, this:
Code:
def tick(self):

    #...

    #get the access to the cellData or pointData
    #data = source.GetCellDataInformation()
     data = source.GetPointDataInformation()
is incorrect. The corrected code is:
Code:
def tick(self):

    #...

    #get the access to the cellData or pointData
    #data = source.GetCellDataInformation()
    data = source.GetPointDataInformation()

Therefore, the correct complete code you want should be:
Code:
from paraview.simple import *

def start_cue(self): pass

def tick(self):
    source = FindSource("WR_3.OpenFOAM")
    source.UpdatePipeline(GetAnimationScene().TimeKeeper.Time)

    #The array and number of components
    #arrayName = "p"
    #arrayComponents = 1
    #component = -1
    #options for component: -1, 0, 1 and 2 => Mag, X, Y, Z

    # If it's a scalar field
    arrayName = "p"
    arrayComponents = 1
    component = 0


    #Get the look-up table for this array
    lookupTable = GetLookupTableForArray(arrayName, arrayComponents)

    #get the access to the cellData or pointData
    #data = source.GetCellDataInformation()
    data = source.GetPointDataInformation()

    #get the array and the respective min-max
    array = data.GetArray(arrayName)
    dataRange = array.GetRange(component)

    lookupTable.LockScalarRange = 1

    #Now let's hack in the range values
    lookupTable.RGBPoints[0] = dataRange[0] #min
    lookupTable.RGBPoints[4] = dataRange[1] #max


def end_cue(self): pass
__________________
wyldckat is offline   Reply With Quote

Reply

Tags
paraview, rescale to data range


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
Automatic Data Export (ascii format) A Kourm FLUENT 4 March 7, 2021 15:08
Issue Writing Out Surface Data rufuscws89 Tecplot 1 May 6, 2019 14:52
Parallel Block Size Issue ChiefSeaBiscuit CONVERGE 5 July 22, 2016 15:03
[OpenFOAM] Automatic range in paraview animations arno ParaView 1 August 29, 2006 05:00
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 18:27


All times are GMT -4. The time now is 20:12.