# How to write cell data changed over time into one file by \`vtk.vtkXMLUnstructuredGridWriter\`?

**URL:** https://discourse.vtk.org/t/how-to-write-cell-data-changed-over-time-into-one-file-by-vtk-vtkxmlunstructuredgridwriter/3759
**Category:** Support
**Created:** [July 13, 2020, 5:08am UTC](https://discourse.vtk.org/t/how-to-write-cell-data-changed-over-time-into-one-file-by-vtk-vtkxmlunstructuredgridwriter/3759 "2020-07-13T05:08:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![whymath](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/w/b5ac83/32.png) [@whymath](https://discourse.vtk.org/u/whymath)
#### Post date: [July 13, 2020, 5:08am UTC](https://discourse.vtk.org/t/how-to-write-cell-data-changed-over-time-into-one-file-by-vtk-vtkxmlunstructuredgridwriter/3759/1 "2020-07-13T05:08:38Z")

</div>

I have a triangle mesh, and want to write some cell data which changed over time into a `test.vtu` files by vtk python interface.

```auto
import numpy as np
import vtk
import vtk.util.numpy_support as vnp

mesh =vtk.vtkUnstructuredGrid()
# creat points, cellType, cells, (here we have NC cells)
mesh.SetPoints(points)
mesh.SetCells(cellType, cells)
writer = vtk.vtkXMLUnstructuredGridWriter()
writer.SetFileName("test.vtu")
writer.SetInputData(mesh)
writer.SetNumberOfTimeSteps(100)
writer.Start()
for i in range(100):
    # how to add the celldata array of current time level into mesh?
    # cdata = mesh.GetCellData()
    # val = ... # a numpy array
    # d = vnp.numpy_to_vtk(val)
    # cdata.AddArray(val)
    writer.WriteNextTime(i)
writer.Stop()

```

The code in the loop which was commented can not work well. Any suggestion? Thanks very much.
