Error reading OpenFoam files

Hello I asked this question in the Paraview discourse but didn’t get any answer yet, I am hoping someone here could help.

I am having trouble reading OpenFoam files when using a react version of this example:

I am not sure how I can add my own readers or if there is any configuration changes that need to be done in order to read them?

The error is this:

 {
  "message": "Exception raised",
  "code": -32001,
  "data": {
    "exception": "TypeError(\"'float' object is not iterable\",)",
    "method": "pv.time.values",
    "trace": "Traceback (most recent call last):\n  File \"/opt/paraview/install/lib/python2.7/site-packages/wslink/websocket.py\", line 275, in onMessage\n    results = func(obj, *args, **kwargs)\n  File \"/opt/paraview/install/lib/python2.7/site-packages/paraview/web/protocols.py\", line 1065, in getTimeValues\n    return list(simple.GetAnimationScene().TimeKeeper.TimestepValues)\nTypeError: 'float' object is not iterable\n"
  }
} 

Any help would be appreciated.

That example is using Vue not React but also looking at the error it seems that you are using the ParaView backend. The issue is related to that section which is supposed to return the timesteps values. Maybe a bug linked to the open foam reader (not sure).

You can try around with ParaView on how to patch this method to make sure it work without error.
The following code might work:

    @exportRpc("pv.time.values")
    def getTimeValues(self):
        values = simple.GetAnimationScene().TimeKeeper.TimestepValues
        try:
            return list(values)
        except:
            return [float(values)]

Yes I used the Vue example to create a React one. It’s working well, I also used the code from the Paraview Lite server. The error is the same I have when just using Paraview Lite.

With the snippet you provided the error no longer appears, but unfortunately the foam file doesn’t load. You said there could be a possible bug with the reader. Is there documentation on how to add/change readers, maybe provide a custom one?

Thank you very much for your help!

Does your file loads with ParaView? You can definitely create a ParaView Plugin and use it to load your data. You should find this kind of information online. It will just be ParaView centric.

Somewhere, someone reported something similar - was related to the skip-zero on/off.
I really don’t know exactly what is happening, but think it might be a conflict between what the class itself has its default vs what might be coming from the xml config file.
This really is uneducated guessing on my part, but also see something weird with the regular paraview reading (OpenFOAM). When the case is initially loaded in the GUI, it seems to grab the information based on the reconstructed case and this remains “sticky” when changing to the decomposed case.
It some of my cases I have decomposed geometry only, and then it has the ugly side-effect of complaining that constant/polyMesh does not exist (error message from the reconstructed case).

1 Like

Exactly, this problem only happens when trying to read decomposed OpenFoam files. Is there any way I can pass case type option “decomposed” to the server?