Vtk format reader

Hi,
I’m trying to read my first .vtk file, but Paraview says that he can’t find a reader for the file. Guess there is something wrong with my file. Can someone help me with this?

variavel.vtk (352.2 KB)

This file is incorrectly formated, how was it written ?

With this FORTRAN 03 subroutine:

   subroutine visualplanoXY(var,plano)

  use modvar
  implicit none
  integer ii, jj, kk, plano
  real (kind = 8) x, z, var(nx,ny,nzt)

  ! writes data to be open by paraview
  open (3, file = 'variavel.vtk',status = 'unknown')
  write(3,*)'# vtk DataFile Version 2.0'
  write(3,*)'variavel.vtk'
  write(3,*)'ASCII'
  write(3,*)'DATASET STRUCTURED_GRID'
  write(3,*)'DIMENSIONS',nx,ny
  write(3,*)'POINTS',nx*ny,'float'
  
	do jj = 1, ny
    		do ii = 1, nx
      			x = dble(ii-1) * dx
      			write(3,71) x, y(jj)
    		end do
  	end do

write(3,*)'POINT_DATA',nx*ny
write(3,*)'SCALARS var float 1'
write(3,*)'LOOKUP_TABLE default'
do jj = 1, ny
    	do ii = 1, nx
      		x = dble(ii-1) * dx
      		write(3,72)var(ii,jj,plano)
  	end do
end do


  close (unit = 3)

71 format(2(1x, ES13.6E2))
72 format(1x, ES13.6E2)

Looks like you are trying to write 2D data ?

https://docs.vtk.org/en/latest/design_documents/VTKFileFormats.html#dataset-format

There is not 2D data in VTK, only 3D.

Was I supossed to add a third column full of zeros for z-axis? I tried this and still don’t work. Thank you for the fast replies.

variavel.vtk (464.2 KB)

You need to remove the leading space on each line, like this:

variavel(2).vtk (448.2 KB)

It worked now. Thank you very much!! :slight_smile: