Clean up code that creates PETSc viewers.

This PR simplifies the logic in petsc.py for creating PETSc viewers for different formats.

Incidentally, this fixes a couple of bugs/deficiencies:
- Write NetCDF instead of HDF5 when NetCDF is requested
- Allow reading of VTK