PVFoamReader is not defined when using pvpython with openfoam result

Hello

I am trying to make automated post-process for particle simulation solved by OpenFOAM

First, I made test.OpenFOAM file first using
paraFoam -touch

Then, then run
pypython test.py

the message below, however, is popped up.

Traceback (most recent call last):
File “test.py”, line 33, in
ppOpenFOAM = PVFoamReader(FileName=‘test.OpenFOAM’)
NameError: name ‘PVFoamReader’ is not defined

It is wired because this function is working when I type it on python script shell in paraview.
It seems that PVFoamReader is not loaded when I use pvbatch. Could you let me know how to pre-load PVFoamReader?

I am using paraview v5.6 and latest openfoam-dev now.

Thank you in advance.

paraFOAM is not developed nor maintained by Kitware and the ParaView team.

You are having this error because paraview release does not contain the OpenFOAM plugin.
you should use paraFOAM or use the paraivew open foam reader instead of the PVFoamReader.

1 Like

If you are using OpenFOAM 1806, 1812, 1906 (see https://www.openfoam.com/download/) you can simply use the builtin reader to process your Lagrangian results. This would be my recommendation since this lets you use paraview in various flavours (Mesa, MPI, python, etc) without any hassle. The reader plugin (which is called by paraFoam) does allow some specialized OpenFOAM handling, such as faceSets etc, but is not parallelized and not the preferred solution.

If you are handling lots of Lagragian particles, you might find that the vtkCloud function object added in 1812 to be particularly useful. This lets you filter particles based on various characteristics and generate VTP datasets during the run. For people with many, many particles, you can filter based on the span (eg, only writing every 100th particle).

The other possibilities would be to render directly with the ParaView/Catalyst function object, or the runTimePostProcessing function object

For convenience, I have a parafoam alias with the following:

alias parafoam='touch log.foam; paraview log.foam'