# PVFoamReader is not defined when using pvpython with openfoam result

**URL:** https://discourse.paraview.org/t/pvfoamreader-is-not-defined-when-using-pvpython-with-openfoam-result/2430
**Category:** ParaView Support
**Created:** [August 14, 2019, 12:20pm UTC](https://discourse.paraview.org/t/pvfoamreader-is-not-defined-when-using-pvpython-with-openfoam-result/2430 "2019-08-14T12:20:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bagbagwan](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bagbagwan/32/1915_2.png) [@bagbagwan](https://discourse.paraview.org/u/bagbagwan)
#### Post date: [August 14, 2019, 12:20pm UTC](https://discourse.paraview.org/t/pvfoamreader-is-not-defined-when-using-pvpython-with-openfoam-result/2430/1 "2019-08-14T12:20:50Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 14, 2019, 1:52pm UTC](https://discourse.paraview.org/t/pvfoamreader-is-not-defined-when-using-pvpython-with-openfoam-result/2430/2 "2019-08-14T13:52:19Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![olesenm](https://discourse.paraview.org/user_avatar/discourse.paraview.org/olesenm/32/17416_2.png) [@olesenm](https://discourse.paraview.org/u/olesenm)
#### Post date: [August 14, 2019, 2:51pm UTC](https://discourse.paraview.org/t/pvfoamreader-is-not-defined-when-using-pvpython-with-openfoam-result/2430/3 "2019-08-14T14:51:07Z")

</div>

If you are using OpenFOAM 1806, 1812, 1906 (see [https://www.openfoam.com/download/](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](https://www.openfoam.com/releases/openfoam-v1812/post-processing.php#post-processing-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](https://www.openfoam.com/releases/openfoam-v1806/post-processing.php#post-processing-paraview-catalyst), or the [runTimePostProcessing function object](https://www.openfoam.com/releases/openfoam-v1906/post-processing.php#post-processing-run-time-images)

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

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

```
