Facing problem in running vtk or pvd file


How we can resolve this issue ?

T_M = pow(((1/(dt*dt))+inner(u_n,dot(u_n,G))+30*nu*nu*inner(G,G)),-0.5)
file = File("T_M.vtk")
file << T_M

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***     fenics-support@googlegroups.com
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
*** -------------------------------------------------------------------------
*** Error:   Unable to open file.
*** Reason:  Unknown file type (".vtk") for file "T_M.vtk".
*** Where:   This error was encountered inside File.cpp.
*** Process: 0
*** DOLFIN version: 2019.2.0.dev0
*** Git changeset:  ubuntu

As far as I am aware, dolfin doe snot support the vtk file extesnion, but the pvd file extension. i.e. you should use File("T_M.pvd")

after using

 File("T_M.PVD") << T_M


File "/home/ayush/lid_driven_vms_nits.py", line 88, in <module>
    file << T_M
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfin/io/__init__.py", line 21, in __lshift__
AttributeError: 'Power' object has no attribute '_cpp_object'

You need to project T_M into a suitable function space before saving it to file.