# Plot3D reader problem with function file

**URL:** https://discourse.paraview.org/t/plot3d-reader-problem-with-function-file/16420
**Category:** Development
**Created:** [April 2, 2025, 11:30pm UTC](https://discourse.paraview.org/t/plot3d-reader-problem-with-function-file/16420 "2025-04-02T23:30:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![luismsfern](https://discourse.paraview.org/user_avatar/discourse.paraview.org/luismsfern/32/16266_2.png) [@luismsfern](https://discourse.paraview.org/u/luismsfern)
#### Post date: [April 2, 2025, 11:30pm UTC](https://discourse.paraview.org/t/plot3d-reader-problem-with-function-file/16420/1 "2025-04-02T23:30:19Z")

</div>

Hello,

It seems the Plot3D reader is unable to correctly read function files. I have a Plot3D grid file grid.xyz (binary, multi-grid, with IBlanks, double precision and written in Fortran) and a function file volume.f containing 6 scalar fields. The two files open just fine on other software such as Tecplot. Any idea what could be going on?  
[paraview\_p3d\_bug.tar.gz](https://discourse.paraview.org/uploads/short-url/tKxAY1a5pRM3DR07hyKsnFcChUr.gz) (1.1 MB)

---

<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: [April 3, 2025, 2:16pm UTC](https://discourse.paraview.org/t/plot3d-reader-problem-with-function-file/16420/2 "2025-04-03T14:16:26Z")

</div>

I confirm ParaView is unable to open the provided files.

If you are sure the files are valid, please open an issue: [https://gitlab.kitware.com/paraview/paraview/-/issues](https://gitlab.kitware.com/paraview/paraview/-/issues)

---

<div class="post-metadata">

### Author: ![luismsfern](https://discourse.paraview.org/user_avatar/discourse.paraview.org/luismsfern/32/16266_2.png) [@luismsfern](https://discourse.paraview.org/u/luismsfern)
#### Post date: [April 3, 2025, 4:25pm UTC](https://discourse.paraview.org/t/plot3d-reader-problem-with-function-file/16420/3 "2025-04-03T16:25:35Z")

</div>

> [@luismsfern](#):
>
> It seems the Plot3D reader is unable to correctly read function files. I have a Plot3D grid file grid.xyz (binary, multi-grid, with IBlanks, double precision and written in Fortran) and a function file volume.f containing 6 scalar fields. The two files open just fine on other software such as Tecplot. Any idea what could be going on?

Thanks for the reply @mwestphal, I just created an issue:  
[https://gitlab.kitware.com/paraview/paraview/-/issues/22927](https://gitlab.kitware.com/paraview/paraview/-/issues/22927)

---

<div class="post-metadata">

### Author: ![elynch](https://discourse.paraview.org/user_avatar/discourse.paraview.org/elynch/32/6418_2.png) [@elynch](https://discourse.paraview.org/u/elynch)
#### Post date: [April 5, 2025, 8:54pm UTC](https://discourse.paraview.org/t/plot3d-reader-problem-with-function-file/16420/4 "2025-04-05T20:54:28Z")

</div>

The grid file is written in Fortran unformatted format, meaning it includes byte counts before and after each record. The function file is written in C binary format (or Fortran with access=‘stream’), so it doesn’t have byte counts. Paraview’s reader needs it to be consistent. You can use the attached script to remove byte counts from the grid file.

```auto
python3 unformatted_to_cbinary.py grid.xyz grid_cbin.xyz

```

Then you should be able to open grid\_cbin.xyz and volume.f.  
[unformatted\_to\_cbinary.py](https://discourse.paraview.org/uploads/short-url/uFowCCiz8kzLcQveUzqgh4i6jso.py) (429 Bytes)

---

<div class="post-metadata">

### Author: ![luismsfern](https://discourse.paraview.org/user_avatar/discourse.paraview.org/luismsfern/32/16266_2.png) [@luismsfern](https://discourse.paraview.org/u/luismsfern)
#### Post date: [April 7, 2025, 8:45pm UTC](https://discourse.paraview.org/t/plot3d-reader-problem-with-function-file/16420/5 "2025-04-07T20:45:46Z")

</div>

Thanks for the reply Eric, this indeed worked on my end. One feature that would be worthwhile to add is the ability to input several function files (one for each timestep) similar to what is possible for .q solution files. Is there a workaround for this?

---

<div class="post-metadata">

### Author: ![elynch](https://discourse.paraview.org/user_avatar/discourse.paraview.org/elynch/32/6418_2.png) [@elynch](https://discourse.paraview.org/u/elynch)
#### Post date: [April 8, 2025, 1:40am UTC](https://discourse.paraview.org/t/plot3d-reader-problem-with-function-file/16420/6 "2025-04-08T01:40:38Z")

</div>

You can use a “PLOT3D meta file.” This is a JSON file that specifies a sequence of PLOT3D files to load. A nice bonus of this is that you can provide names for the variables in your function file rather than Function0, Function1, etc. Create a file with a .p3d extension that looks like:

```auto
{
  "function-names": [
    "sweet",
    "sour",
    "salty",
    "bitter",
    "umami",
    "funky"
  ],
  "filenames": [
    {
      "time": 0.1,
      "xyz": "grid_cbin1.xyz",
      "function": "volume1.f"
    },
    {
      "time": 0.2,
      "xyz": "grid_cbin2.xyz",
      "function": "volume2.f"
    }
  ]
}

```

I’ve only ever used this for AMR cases where the grid was changing. If you have the same grid for all time steps, I assume you have to repeat the “xyz” entry. I don’t know if the reader is smart enough to avoid re-reading the grid when it hasn’t changed.

More documentation on the meta file format is available [here](https://vtk.org/doc/release/6.0/html/classvtkPlot3DMetaReader.html). Most of the entries are optional.
