Viewing .vtk files for each mesh domain in a time series - IS IT POSSIBLE?

Hi everyone,

Hope you’re well. I have been struggling with this one for a bit and haven’t been able to figure it out.

My simulation output is in .vtk format (so far so good). However, the code I’m using exports a solution output for each of my mesh domains (I have 93 for this geometry) as well as one for each time step. So each .vtk file is specific to a mesh domain and to a timestep. One example would be: solution.1029000.domain.002.time.2.087042809.vtk (describing the solution at domain number 2 and time 2.087 seconds).

I have been able to see one time step by importing all domains (0 to 92) at once and then grouping them using “Group DataSets”. But now I would like to view the whole solution in the domain changing with time.

The filter ‘Group Time Steps’ sounds like it could solve things but when I try to group multiple data set groups, ‘Group Time Steps’ is not available as an option because it doesn’t allow for “multiple input files” which is confusing…

I hope I have explained things properly but could use some help as soon as possible as it’s for a deadline.
Is this something that can be done?

Thanks!

Here’s one easy workaround.

Put together a vtk.series file for each domain. See this for the format of a vtk.series file. Thus solution.1029000.domain.002.time.2.08.vtk and solution.1029000.domain.002.time.3.08.vtk and all other timesteps for that domain will be added to solution.1029000.domain.vtk.series. Create a vtk.series for each of the 93 domains. You should be able to do that with a simple batch/python script.

Now, open each domain and apply Group Datasets to group all domains to put it in a single multiblock dataset. That should do it. Since each of the inputs to the Group Datasets filter would be temporal dataset, you should be able to animate it over time without any additional work.

Many thanks for your reply. How will ParaView interpret each time step?

Thanks

If you look at the vtk.series format, it’s simply a json with the name of the file and the timestep it corresponds to.

{
  "file-series-version" : "1.0",
  "files" : [
    { "name" : "foo1.vtk", "time" : 0 },
    { "name" : "foo2.vtk", "time" : 5.5 },
    { "name" : "foo3.vtk", "time" : 11.2 }
  ]
}

That how ParaView will know which file to load for a particular time.

You should be able to put together such a file manually too, but doing it 93 times can be tedious :), hence my suggestion to automate it using some scripting language of your choice.

How do I save in JSON for the .vtk.series file format to work? Is writing to a .txt file ok?

Sorry about these questions, really new to all this.

Yes, JSON is simply a text file. It just a format specification that requires the use of {} and [] etc. for example, a series file for a domain could look like

{
  "file-series-version" : "1.0",
  "files" : [
    { "name" : "fsolution.1029000.domain.002.time.2.087042809.vtk", "time" : 2.087042809 },
    { "name" : "fsolution.1029000.domain.002.time.3.087042809.vtk", "time" : 3.087042809 }
  ]
}

Create this file in your editor of choice and save it out using the name fsolution.1029000.domain.002.vtk.series. Do that for all domains.

1 Like

I have taken your advice and managed to write a code up to assemble each .vtk.series file for each domain.
They’re saved as .vtk.series (not .vtk.series.txt). When opening them on paraview 5.4.1 64-bit, I got the error below. I chose to open with .vtk but paraview didn’t recognise the file format and I couldn’t see any of my domains…

I then tried add .txt to open as text file but haven’t been able to get that to work either.

I can’t find any information online about .vtk.series files so could really use your help trying to get this done!

I have also tried saving as foo.N.vtk and foo.N.vtk.txt

Attached is one of the domain files just so you can see. Is there anything wrong with it?

None of these is recognised… fsolution.domain.082.vtk.series.txt (126.8 KB)

You’ll need at least ParaView 5.5.2 for this. I’d recommend the latest 5.6.0-RC1.

1 Like

Thanks for the prompt reply! I really appreciate your support with this.

Downloaded Paraview 5.6 (but not the version with MPI) and still get this error below… For some reason, there’s no option to choose .vtk.series reader, but I’d assume it would automatically accept the files?

Unfortunately really struggling with this one… feel like I’m so close!

Please don’t add the .txt extension to your filename. The filename needs to end with vtk.series. Hope that helps. Extensions are often used to decide what type of file it is. If you change extension, ParaView cannot determine what contents to expect in the file.

Attached is a working series example.
data.zip (4.9 KB)

As you can see in my last post, the error shows up when I do have the ending “vtk.series”. So that’s not the solution to the problem unfortunately…

Did you try the example dataset I attached? DId that work?

I suspect the extra “,” in your JSON file after the last entry in list may also be causing issues since that makes the file an invalid JSON. Try removing the last comma:

....

  { "name" : "solution.1145000.domain.082.time.1145000.vtk", "time" : 2.328156948 },
    { "name" : "solution.1145500.domain.082.time.1145500.vtk", "time" : 2.329265594 },
    { "name" : "solution.1146000.domain.082.time.1146000.vtk", "time" : 2.330315590 }
  ]
}

It worked! Thanks so much :slight_smile:

I am dealing with the same question that you had earlier. Did you open .vtk files before reading the .vtk.series file. Or how did you open all of your data?

I just figured that all .vtk files and the .vtk.series file should be in the same directory or the path should be specified for the files correctly.