Second Order Temporal Discretization: Crank-Nicolson

I am trying to make an unsteady incompressible isothermal Navier-Stokes FreeFEM code for 2D lid-driven cavity flow for high Reynolds number (Re). The “convect” interpolation operator allows first order discretization. How can second order temporal discretization scheme Crank-Nicolson be implemented in FreeFEM?

Thank you for sharing the above implementation. I had gone through this code earlier. The above code is for unsteady linear diffusion equation. I am looking for some code or FreeFEM implementation which involves convective terms also.

You have to put them in the variational formulation.

you can read this: https://hal.inria.fr/inria-00072140