# How can I create a time dependent vtkUnstructuredGrid object?

**URL:** https://discourse.vtk.org/t/how-can-i-create-a-time-dependent-vtkunstructuredgrid-object/1822
**Category:** Support
**Created:** [September 25, 2019, 7:40pm UTC](https://discourse.vtk.org/t/how-can-i-create-a-time-dependent-vtkunstructuredgrid-object/1822 "2019-09-25T19:40:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![myousefi2016](https://discourse.vtk.org/user_avatar/discourse.vtk.org/myousefi2016/32/921_2.png) [@myousefi2016](https://discourse.vtk.org/u/myousefi2016)
#### Post date: [September 25, 2019, 7:40pm UTC](https://discourse.vtk.org/t/how-can-i-create-a-time-dependent-vtkunstructuredgrid-object/1822/1 "2019-09-25T19:40:13Z")

</div>

Currently, I’m combining some vtu files that belong to different time snapshots into one vtu file by using this function:

```auto
def Combiner(mainfiles,path):
	data_to_write = vtk.vtkUnstructuredGrid()
	writer = vtk.vtkXMLUnstructuredGridWriter()
	writer.SetNumberOfTimeSteps(len(mainfiles))  
	writer.SetInputData(data_to_write)
	writer.SetFileName(path)
	writer.Start()
	for i,filev in enumerate(mainfiles):
		print "Writing Timestep: " + str(i)
  		data_to_write.ShallowCopy(vtkReader(filev))
  		writer.WriteNextTime(i)
	writer.Stop()

	ug = vtkReader(path)

	os.remove(path)

	return ug

```

As you can see I need to write the combined vtu file and load it again, which is pretty slow. Is there any way to get away with writing stuff into the disk?

---

<div class="post-metadata">

### Author: ![Aron\_Helser](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aron_helser/32/14_2.png) [@Aron\_Helser](https://discourse.vtk.org/u/Aron_Helser)
#### Post date: [September 26, 2019, 5:06pm UTC](https://discourse.vtk.org/t/how-can-i-create-a-time-dependent-vtkunstructuredgrid-object/1822/2 "2019-09-26T17:06:34Z")

</div>

You could certainly do this with a multi-block file, which you could just update to point to each of the sub-files. But I don’t know how to specify the time steps in that case. I do think that’s possible, though.

In ParaView, sequentially numbered files will be automatically read in as a time-series…

-Aron
