On how to save the data in xdmffile and timeseries

Dear all,
I am currently simulating the flow past a cylinder with legacy FEniCS 2019.1.0, and I would like to store the velocity and pressure data at certain timesteps.
In my code, I use the folloing code to create the files.

self.xdmffile_u = XDMFFile('navier_stokes_cylinder/velocity.xdmf')
self.xdmffile_p = XDMFFile('navier_stokes_cylinder/pressure.xdmf')

self.timeseries_u = TimeSeries('navier_stokes_cylinder/velocity_series')
self.timeseries_p = TimeSeries('navier_stokes_cylinder/pressure_series')

self.mesh_for_cylinder = File('navier_stokes_cylinder/cylinder.xml.gz')

And later I use the following lines in an attempt to write the data into the files.

self.mesh_for_cylinder << self.mesh

self.xdmffile_u.write(self.u_, self.t)
self.xdmffile_p.write(self.p_, self.t)
self.timeseries_u.store(self.u_.vector(), self.t)
self.timeseries_p.store(self.p_.vector(), self.t)

After running the code, I checked my computer. The cylinder.xml.gz is inside the folder ‘navier_stokes_cylinder’, but other files for storing the velocity and pressure are just nowhere to be found. I would be grateful if anyone could tell me why they are not created and what was wrong in my coding?

A minimal working example will be like this:

from fenics import *
from mshr import *

class Env2DCylinder():
    def __init__(self):
        # Files for storing the data
        self.xdmffile_u = XDMFFile('velocity.xdmf')
        self.xdmffile_p = XDMFFile('pressure.xdmf')

        # TimeSeries files
        self.timeseries_u = TimeSeries('velocity_series')
        self.timeseries_p = TimeSeries('pressure_series')

        self.mesh = UnitSquareMesh(10, 10)
        self.V = VectorFunctionSpace(self.mesh, 'P', 2)
        self.Q = FunctionSpace(self.mesh, 'P', 1)

        self.u = TrialFunction(self.V)
        self.v = TestFunction(self.V)
        self.p = TrialFunction(self.Q)
        self.q = TestFunction(self.Q)

        self.u_ = Function(self.V)
        self.p_ = Function(self.Q)

        self.A1 = inner(grad(self.u), grad(self.v))*dx
        self.L1 = dot(Constant((1, 0)), self.v)*dx

        self.A2 = inner(grad(self.p), grad(self.q))*dx
        self.L2 = Constant(0)*self.q*dx

    def evolve(self):
        solve(self.A1 == self.L1, self.u_)
        solve(self.A2 == self.L2, self.p_)

        # Issue with writing XDMF files
        self.xdmffile_u.write(self.u_, 0)
        self.xdmffile_p.write(self.p_, 0)

        # Issue with writing TimeSeries files
        self.timeseries_u.store(self.u_.vector(), 0)
        self.timeseries_p.store(self.p_.vector(), 0)

env = Env2DCylinder()
env.evolve()

Many thanks for the help in advance!

Without a minimal reproducible example it is hard to give any guidance.
Please write a Minimal example, i.e. a code that can reproduce your error, preferably just by creating a unit square/unit cube mesh, the function spaces, and some functions to write to file.

Thank you very much for the reminder!
I have provided a minimal reproducible example. Actually, no error is reported when running the code, but the problem is that the files are not created.

Please note that you can remove almost everything in that code and still reproduce the example. As I said above, only create the mesh, function space some functions and then try to write them to file.

I would also strongly suggest just using a built-in mesh, like UnitSquareMesh to illustrate this, as mshr is long deprecated and many people do not have it installed on their system.

Thank you for your patience and kindness again!
I have modified the minimal reproducible example, but this time the files are created in the folder yet I still can not write data into it successfully, as the picture shows.
And it made me wonder why those files were not created in my original program? Does it have sth to do with other lines of my code?